/* ============================================================
   QR CODE STUDIO PRO - MODERN STUDIO DESIGN SYSTEM
   ============================================================ */

:root {
    --bg-base: #090d16;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(24, 33, 53, 0.85);
    --bg-input: rgba(15, 23, 42, 0.7);
    --border-card: 1px solid rgba(255, 255, 255, 0.08);
    --border-focus: rgba(16, 185, 129, 0.6);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-emerald: #10b981;
    --accent-cyan: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --accent-gradient-hover: linear-gradient(135deg, #059669 0%, #0891b2 100%);
    --shadow-card: 0 20px 40px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-glow: 0 8px 25px -5px rgba(16, 185, 129, 0.3);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    --font-heading: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Sarabun', system-ui, -apple-system, sans-serif;
}

/* Base Resets */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14.5px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Ambient Background Glow */
.background-ambient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    background: 
        radial-gradient(circle at 10% 15%, rgba(16, 185, 129, 0.09) 0%, transparent 45%),
        radial-gradient(circle at 85% 25%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 85%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
        #090d16;
}

/* Studio Wrapper */
.studio-wrapper {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 36px 24px 60px;
}

/* Header */
.studio-header {
    text-align: center;
    margin-bottom: 32px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 999px;
    color: var(--accent-emerald);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.1);
}

.studio-title {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.studio-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    max-width: 640px;
    margin: 0 auto;
    font-weight: 400;
}

/* Main Studio Layout: 2 Columns */
.studio-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 420px);
    gap: 28px;
    align-items: start;
}

/* ============================================================
   LEFT PANEL: INPUTS & SETTINGS
   ============================================================ */
.editor-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Mode Navigation Pills */
.mode-nav {
    display: flex;
    gap: 8px;
    background: rgba(15, 23, 42, 0.65);
    padding: 6px;
    border-radius: var(--radius-md);
    border: var(--border-card);
}

.mode-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.mode-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Tab Contents */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Input Cards */
.input-card {
    background: var(--bg-card);
    border: var(--border-card);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(16px);
}

.card-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.input-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Live Status Pill */
.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-emerald);
}

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

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Instant Gen Button */
.btn-instant-gen {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-instant-gen:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Form Inputs */
.studio-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14.5px;
    resize: vertical;
    transition: all 0.25s ease;
}

.studio-textarea:focus,
.studio-input:focus,
.studio-select:focus {
    outline: none;
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    background: rgba(15, 23, 42, 0.9);
}

.studio-input,
.studio-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 11px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13.5px;
    transition: all 0.2s ease;
}

/* WiFi Grid */
.wifi-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field-sublabel {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.toggle-group {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.radio-chip {
    flex: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.radio-chip:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.radio-chip input[type="radio"]:checked + span {
    color: var(--accent-emerald);
    font-weight: 600;
}

/* Batch Drop Zone */
.batch-drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
}

.batch-drop-zone:hover {
    border-color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.05);
}

.batch-drop-zone i {
    font-size: 38px;
    color: var(--accent-emerald);
    display: block;
    margin-bottom: 10px;
}

.drop-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.drop-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.batch-table-wrap {
    margin-top: 16px;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.batch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.batch-table th, .batch-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.batch-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
}

.batch-progress {
    margin-top: 14px;
}

.progress-bar-wrap {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    transition: width 0.2s;
}

.progress-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: right;
}

.batch-actions-bar {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* ============================================================
   COLLAPSIBLE ACCORDION SECTIONS
   ============================================================ */
.accordion-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accordion-card {
    background: var(--bg-card);
    border: var(--border-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    backdrop-filter: blur(16px);
    transition: all 0.25s ease;
}

.accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.acc-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.acc-title i {
    font-size: 16px;
    color: var(--accent-emerald);
}

.acc-arrow {
    font-size: 13px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.accordion-card.open .acc-arrow {
    transform: rotate(180deg);
}

.accordion-body {
    display: none;
    padding: 4px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.accordion-card.open .accordion-body {
    display: block;
}

.section-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Setting Controls */
.setting-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Preset Color Pills */
.color-presets-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.color-preset-pill {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.color-preset-pill::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--c);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.color-preset-pill:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
}

.color-preset-pill.active {
    border-color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.12);
    color: var(--text-primary);
}

/* Color Picker Box */
.color-picker-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 6px 12px;
}

.color-picker-box input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.color-picker-box input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-box input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.color-hex-tag {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Style Selector (Square, Rounded, Dots) */
.style-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.style-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.style-chip:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.style-chip.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
}

/* Logo Grid */
.logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
}

.logo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 4px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-item:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.logo-item.active {
    border-color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.12);
}

.logo-icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
}

.logo-item i.bi-x-circle-fill {
    font-size: 26px;
    color: var(--text-muted);
}

.custom-upload-wrap {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.logo-item span {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn-clear-logo {
    padding: 2px 8px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
}

/* Frame Selector */
.frame-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.frame-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.frame-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.frame-card.active {
    border-color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.12);
}

.frame-card span {
    font-size: 10.5px;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
}

/* Frame Card Mockups */
.frame-card-preview {
    width: 44px;
    height: 48px;
    background: #ffffff;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4px;
}

.qr-mock {
    width: 24px;
    height: 24px;
    background: #0f172a;
    border-radius: 2px;
}

.text-mock {
    width: 28px;
    height: 4px;
    background: #0f172a;
    border-radius: 2px;
    margin-top: 3px;
}
.text-mock.top { margin-top: 0; margin-bottom: 3px; }

.bubble-mock {
    width: 28px;
    height: 6px;
    background: #0f172a;
    border-radius: 3px;
    margin-top: 2px;
}

.frame-card-phone-outline {
    border: 2px solid #0f172a;
}
.notch-mock { width: 10px; height: 2px; background: #0f172a; margin-bottom: 2px; }
.home-mock { width: 12px; height: 2px; background: #0f172a; margin-top: 2px; }

.frame-card-focus-corners { position: relative; }
.corner-mock { position: absolute; width: 6px; height: 6px; border-color: #0f172a; border-style: solid; }
.corner-mock.tl { top: 3px; left: 3px; border-width: 2px 0 0 2px; }
.corner-mock.tr { top: 3px; right: 3px; border-width: 2px 2px 0 0; }
.corner-mock.bl { bottom: 3px; left: 3px; border-width: 0 0 2px 2px; }
.corner-mock.br { bottom: 3px; right: 3px; border-width: 0 2px 2px 0; }

.badge-mock { width: 14px; height: 4px; background: #0f172a; border-radius: 2px; margin-bottom: 3px; }

.frame-settings-subpanel {
    margin-top: 14px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    cursor: pointer;
}

/* ============================================================
   RIGHT PANEL: STICKY LIVE STUDIO PREVIEW
   ============================================================ */
.preview-panel {
    position: relative;
}

.preview-sticky-card {
    position: sticky;
    top: 24px;
    background: var(--bg-card);
    border: var(--border-card);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.preview-title i {
    color: var(--accent-emerald);
}

.canvas-res-tag {
    font-family: monospace;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.08);
    padding: 3px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
}

/* QR Stage (White contrast frame container) */
.qr-stage {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    min-height: 280px;
}

.qr-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.qr-display-frame {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.qr-frame-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

#qrcode canvas, #qrcode img {
    max-width: 100%;
    height: auto !important;
    display: block;
    border-radius: 6px;
}

/* Framing Elements CSS */
.custom-frame-top-badge,
.custom-frame-top,
.custom-frame-bottom,
.custom-frame-bubble-tail,
.custom-frame-phone-home,
.custom-frame-corner,
.qr-frame-header {
    display: none;
}

/* Scan Verify Pill */
.scan-verify-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--accent-emerald);
    transition: all 0.25s ease;
}

.scan-verify-pill.warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: #f59e0b;
}

/* ============================================================
   UNIFIED DOWNLOAD ACTION BAR
   ============================================================ */
.download-action-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.btn-main-download {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-main-download:hover {
    background: var(--accent-gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -5px rgba(16, 185, 129, 0.45);
}

.btn-main-download:active {
    transform: translateY(0);
}

.secondary-actions-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.btn-sub-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sub-action:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Footer */
.studio-footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ============================================================
   MODALS & TOASTS
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-box {
    background: #0f172a;
    border: var(--border-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.template-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.template-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.template-card.active {
    border-color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-emerald);
    font-weight: 600;
}

.btn-ghost {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.btn-secondary {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary-gradient {
    padding: 10px 18px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

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

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13.5px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: slideIn 0.3s ease;
}

.toast.success { border-color: rgba(16, 185, 129, 0.5); }
.toast.error { border-color: rgba(239, 68, 68, 0.5); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
    .studio-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    .editor-panel {
        display: contents;
    }
    .mode-nav {
        order: 1;
    }
    .tab-content {
        order: 2;
    }
    .preview-panel {
        order: 3;
    }
    .accordion-group {
        order: 4;
    }
    .preview-sticky-card {
        position: static;
    }
}

@media (max-width: 640px) {
    .studio-wrapper {
        padding: 20px 14px 40px;
    }
    .studio-title {
        font-size: 21px;
        word-break: keep-all;
    }
    .studio-subtitle {
        font-size: 13.5px;
    }
    .mode-tab {
        padding: 9px 8px;
        font-size: 12px;
    }
    .mode-tab span {
        display: inline;
    }
    .style-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    .frame-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    .secondary-actions-row {
        grid-template-columns: 1fr;
    }
    .qr-stage {
        padding: 14px;
        min-height: 240px;
    }
}
