﻿/* CSS Variables */
:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #60A5FA;
    --accent: #06B6D4;
    --accent-glow: #22D3EE;
    --bg-dark: #0A0A0F;
    --bg-card: #12121A;
    --bg-card-hover: #1A1A25;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border: #1E293B;
    --border-light: #334155;
    --gradient-start: #3B82F6;
    --gradient-end: #06B6D4;
    --glass-bg: rgba(18, 18, 26, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --error: #ef4444;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Effects */
.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
}

.bg-glow-1 {
    top: -200px;
    left: -200px;
    background: var(--primary);
}

.bg-glow-2 {
    bottom: -200px;
    right: -200px;
    background: var(--accent);
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f3f5f9, var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
}

    .nav-links a {
        color: var(--text-secondary);
        text-decoration: none;
        font-weight: 500;
        transition: color 0.3s;
    }

        .nav-links a:hover,
        .nav-links a.active {
            color: var(--text-primary);
        }

.nav-cta {
    display: flex;
    gap: 1rem;
}

.language-selector {
    display: flex;
    align-items: center;
}

    .language-selector select {
        padding: 0.5rem 0.75rem;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 6px;
        color: var(--text-primary);
        font-size: 0.85rem;
        cursor: pointer;
        outline: none;
        transition: all 0.2s;
    }

        .language-selector select:hover {
            border-color: var(--primary);
        }

        .language-selector select:focus {
            border-color: var(--primary);
        }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 30px rgba(59, 130, 246, 0.5);
    }

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

    .btn-secondary:hover {
        background: var(--bg-card);
        border-color: var(--primary);
    }

.btn-glow {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: white;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
    animation: glow-pulse 2s infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
    }

    50% {
        box-shadow: 0 4px 40px rgba(6, 182, 212, 0.6);
    }
}

/* Main Content */
.main-content {
    padding: 6rem 2rem 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

    .page-header h1 {
        font-size: 2.5rem;
        font-weight: 700;
        margin-bottom: 1rem;
        background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .page-header p {
        color: var(--text-secondary);
        font-size: 1.1rem;
        max-width: 600px;
        margin: 0 auto;
    }

/* Main Viewer Container - Side by Side Layout */
.viewer-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Top Row - Editor and Preview Side by Side */
.viewer-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    height: 550px;
}

/* Editor Panel */
.editor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(15, 15, 26, 0.8);
    border-bottom: 1px solid var(--border);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

    .panel-title i {
        color: var(--primary);
    }

.editor-toolbar {
    display: flex;
    gap: 0.5rem;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

    .toolbar-btn:hover {
        background: var(--bg-card-hover);
        color: var(--text-primary);
        border-color: var(--primary);
    }

.editor-container {
    flex: 1;
    position: relative;
}

#zpl-editor {
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    background: #1a1a2e;
    border: none;
    color: #a5b3ce;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

    #zpl-editor::placeholder {
        color: var(--text-muted);
    }

/* Preview Panel */
.preview-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-container {
    flex: 1;
    background: white;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

    .preview-container.checkerboard {
        background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%), linear-gradient(-45deg, #e0e0e0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e0e0e0 75%), linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
        background-size: 20px 20px;
        background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
        background-color: #ffffff;
    }

#preview-image {
    max-width: 100%;
    max-height: 100%;
    transition: transform 0.3s ease;
}

.preview-placeholder {
    text-align: center;
    color: #666;
}

    .preview-placeholder i {
        font-size: 4rem;
        color: var(--primary);
        margin-bottom: 1rem;
    }

    .preview-placeholder p {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .preview-placeholder span {
        font-size: 0.85rem;
        color: #999;
    }

/* Loading State */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}

    .loading-overlay.active {
        display: flex;
    }

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: var(--primary);
    font-weight: 500;
}

/* Error State */
.error-message {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

    .error-message.active {
        display: flex;
    }

/* Options Row - Below Editor and Preview */
.options-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* Option Cards */
.option-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}

    .option-card h3 {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 1rem;
        color: var(--text-secondary);
    }

        .option-card h3 i {
            color: var(--primary);
        }

/* Label Size Selection */
.size-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.size-option {
    padding: 0.6rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

    .size-option:hover {
        border-color: var(--primary);
        background: var(--bg-card-hover);
    }

    .size-option.active {
        border-color: var(--primary);
        background: rgba(59, 130, 246, 0.1);
    }

    .size-option .size-name {
        font-weight: 600;
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }

    .size-option .size-dims {
        font-size: 0.7rem;
        color: var(--text-muted);
    }

/* Label Size Inputs */
.size-inputs {
    display: flex;
    gap: 1rem;
}

.size-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

    .size-input-group label {
        font-size: 0.75rem;
        color: var(--text-muted);
        font-weight: 500;
    }

    .size-input-group input {
        padding: 0.6rem 0.8rem;
        background: var(--bg-dark);
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text);
        font-size: 0.9rem;
        outline: none;
        transition: all 0.2s;
    }

        .size-input-group input:focus {
            border-color: var(--primary);
            background: var(--bg-card);
        }

        .size-input-group input::-webkit-inner-spin-button,
        .size-input-group input::-webkit-outer-spin-button {
            opacity: 1;
        }

/* Output Format Selection */
.format-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.format-option {
    padding: 0.8rem 0.3rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

    .format-option:hover {
        border-color: var(--accent);
        background: var(--bg-card-hover);
    }

    .format-option.active {
        border-color: var(--accent);
        background: rgba(6, 182, 212, 0.1);
    }

    .format-option i {
        font-size: 1.3rem;
        color: var(--accent);
        margin-bottom: 0.3rem;
    }

    .format-option .format-name {
        font-weight: 600;
        font-size: 0.8rem;
    }

/* DPI Selection */
.dpi-options {
    display: flex;
    gap: 0.5rem;
}

.dpi-option {
    flex: 1;
    padding: 0.6rem 0.3rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
}

    .dpi-option:hover {
        border-color: var(--primary);
    }

    .dpi-option.active {
        border-color: var(--primary);
        background: rgba(59, 130, 246, 0.1);
        color: var(--primary-light);
    }

/* Zoom Control */
.zoom-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.zoom-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    outline: none;
}

    .zoom-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 18px;
        height: 18px;
        background: linear-gradient(135deg, var(--primary), var(--accent));
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
    }

.zoom-value {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
    color: var(--primary-light);
}

/* Sample Code Section */
.sample-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}

    .sample-section h3 {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 1rem;
        color: var(--text-secondary);
    }

        .sample-section h3 i {
            color: var(--accent);
        }

.sample-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.sample-item {
    padding: 0.6rem 0.8rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

    .sample-item:hover {
        border-color: var(--accent);
        color: var(--text-primary);
        background: var(--bg-card-hover);
    }

    .sample-item i {
        margin-right: 0.5rem;
        color: var(--accent);
    }

/* Action Row */
.action-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.btn-convert {
    padding: 1rem 3rem;
    font-size: 1.1rem;
}

.btn-download {
    padding: 1rem 3rem;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--success), #059669);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

    .btn-download:hover {
        box-shadow: 0 6px 30px rgba(16, 185, 129, 0.5);
    }

    .btn-download:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

    .toast.active {
        transform: translateY(0);
        opacity: 1;
    }

    .toast.success {
        border-color: var(--success);
    }

    .toast.error {
        border-color: var(--error);
    }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

    .modal.active {
        display: flex;
    }

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    max-width: 350px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

    .modal-close:hover {
        color: var(--text);
    }

.modal-content h3 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.qr-placeholder {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 2rem;
}

    .qr-placeholder p {
        margin-top: 1rem;
        margin-bottom: 0;
        font-weight: 500;
    }

.toast i {
    font-size: 1.2rem;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--error);
}

/* Footer */
footer {
    padding: 4rem 2rem 2rem;
    background: #0a0a0f;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

.footer-container {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand {
    max-width: 300px;
}

    .footer-brand .logo {
        margin-bottom: 1rem;
    }

    .footer-brand p {
        color: var(--text-muted);
        font-size: 0.9rem;
        line-height: 1.6;
    }

.footer-column h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: 0.75rem;
}

.footer-column a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

    .footer-column a:hover {
        color: var(--primary-light);
    }

.footer-bottom {
    max-width: 1600px;
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .footer-bottom p {
        color: var(--text-muted);
        font-size: 0.85rem;
    }

.social-links {
    display: flex;
    gap: 1rem;
}

    .social-links a {
        width: 40px;
        height: 40px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        transition: all 0.2s;
    }

        .social-links a:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 1200px) {
    .viewer-row {
        grid-template-columns: 1fr;
        height: auto;
    }

    .editor-panel {
        height: 400px;
    }

    .preview-panel {
        height: 400px;
    }

    .options-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links, .nav-cta {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .main-content {
        padding: 5rem 1rem 1rem;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .options-row {
        grid-template-columns: 1fr;
    }

    .size-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .format-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sample-list {
        grid-template-columns: 1fr;
    }

    .action-row {
        flex-direction: column;
    }

    .btn-convert, .btn-download {
        width: 100%;
    }

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--border-light);
    }
