:root {
    --bg-body: #050505;
    --bg-sidebar: #0a0a0a;
    --bg-card: #121212;
    --accent: #10b981;
    --accent-glow: rgba(16, 185, 129, 0.4);
    --border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --text-muted: #a1a1aa;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    background: var(--bg-body);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    height: 100vh;
    overflow: hidden;
}

.ambient-glow {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 50vw;
    height: 50vh;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    filter: blur(150px);
    opacity: 0.3;
    z-index: -1;
}

.app-shell {
    display: flex;
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 400px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 30px;
    z-index: 10;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mobile-menu-icon {
    display: none;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.brand {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.brand i {
    color: var(--accent);
}

.badge {
    background: var(--accent);
    color: #000;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    vertical-align: middle;
}

.back-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    transition: 0.3s ease;
    margin-bottom: 30px;
    width: fit-content;
}

.back-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(-2px);
}

.scroll-controls {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.scroll-controls::-webkit-scrollbar {
    width: 4px;
}

.scroll-controls::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

.control-group label {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sub-label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 5px;
}

input[type="text"],
select {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    transition: 0.3s;
    font-size: 0.9rem;
}

input[type="text"]:focus,
select:focus {
    border-color: var(--accent);
}

/* Range Slider */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    margin-top: -6px;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--border);
    border-radius: 2px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Color Pickers */
.color-picker-row {
    display: flex;
    gap: 10px;
}

.cp-wrapper {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

input[type="color"] {
    border: none;
    width: 30px;
    height: 30px;
    padding: 0;
    background: none;
    cursor: pointer;
}

.cp-wrapper span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Switch Toggle */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* File Upload */
.file-upload {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
}

.file-upload:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.file-upload input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

#fileName {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Actions */
.action-area {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px;
}

.btn-primary {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}

.btn-primary:hover {
    background: #34d399;
    transform: translateY(-2px);
}

/* Main Preview */
.main-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
}

.preview-card {
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
    width: 450px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.card-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
}

.live-indicator {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
    animation: pulse 2s infinite;
}

.qr-canvas-wrapper {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    display: inline-block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.preview-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #18181b;
    border: 1px solid var(--border);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s forwards;
}

.toast i {
    color: var(--accent);
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* ================================================= */
/* MOBILE RESPONSIVE STYLES (Max-Width: 900px)       */
/* ================================================= */
@media (max-width: 900px) {

    /* 1. Main Layout: Switch from Row to Column */
    .app-shell {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    /* 2. REORDER: Preview First, Controls Second */
    .main-area {
        order: 1;
        padding: 20px;
        min-height: auto;
        background: none;
    }

    .sidebar {
        order: 2;
        width: 100%;
        border-right: none;
        border-top: 1px solid var(--border);
        padding: 20px;
        height: auto;
    }

    /* 3. Sticky Preview Card */
    .preview-card {
        width: 100%;
        max-width: 350px;
        /* Limit width */
        padding: 20px;
        margin: 0 auto;
        border-radius: 16px;
        /* Sticky positioning for better UX */
        position: sticky;
        top: 10px;
        z-index: 50;
    }

    .card-header {
        margin-bottom: 15px;
    }

    .qr-canvas-wrapper {
        padding: 10px;
        margin-bottom: 10px;
    }

    /* 4. Controls Adjustment */
    .sidebar-header {
        display: none;
    }

    /* Hide brand in controls on mobile to save space */
    .back-link {
        display: none;
    }

    /* Hide back link in controls */

    .scroll-controls {
        overflow: visible;
        padding-right: 0;
    }

    /* 5. Touch Targets */
    input[type=range]::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
        margin-top: -8px;
    }

    .btn-primary {
        padding: 15px;
        font-size: 1rem;
    }

    /* Adjust input grid */
    .grid-2 {
        gap: 15px;
    }
}

