/* ═══════════════════════════════════════════════
   ONESHOTTED — Editor
   ═══════════════════════════════════════════════ */

/* ─── Layout ─── */
.editor-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.topbar-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ─── Canvas Area ─── */
.canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

#preview-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ─── Sidebar ─── */
.editor-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: rgba(20, 20, 32, 0.9);
    backdrop-filter: blur(12px);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-title {
    font-size: 1.1rem;
    color: var(--text-accent);
    margin-bottom: 8px;
}

/* ─── Control Sections ─── */
.control-section {
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.control-section:last-child {
    border-bottom: none;
}

.section-header {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: lowercase;
    letter-spacing: 0.03em;
    margin-bottom: 12px;
}

/* ─── Template Grid ─── */
.template-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.template-thumb {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.template-thumb:hover {
    background: var(--bg-hover);
    border-color: rgba(124, 58, 237, 0.3);
}

.template-thumb.active {
    border-color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.15);
    color: var(--text-primary);
    box-shadow: var(--glow-purple);
}

.template-thumb .template-preview {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

/* ─── Gradient Grid ─── */
.gradient-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.gradient-swatch {
    aspect-ratio: 1.4;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.gradient-swatch:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.gradient-swatch.active {
    border-color: var(--text-accent);
    box-shadow: var(--glow-green);
}

.gradient-swatch .swatch-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3px 6px;
    font-size: 0.65rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    text-align: center;
    font-family: var(--font-heading);
}

/* ─── Color Picker ─── */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.color-picker {
    width: 40px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* ─── Text Input ─── */
.text-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.text-input:focus {
    border-color: var(--accent-primary);
}

.text-input::placeholder {
    color: var(--text-secondary);
}

/* ─── Phrase Chips ─── */
.phrase-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.phrase-chip {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.phrase-chip:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: rgba(124, 58, 237, 0.3);
}

/* ─── Text Controls ─── */
.text-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.control-row label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.select-input {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

.range-input {
    flex: 1;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* ─── Export Buttons ─── */
.export-section {
    margin-top: auto;
    padding-top: 16px;
}

.btn-export {
    width: 100%;
    margin-bottom: 8px;
    padding: 14px 20px;
    font-size: 1rem;
}

/* ─── Mobile Tab Bar (hidden on desktop) ─── */
.mobile-tab-bar {
    display: none;
}

/* ═══════════════════════════════════════════════
   MOBILE LAYOUT (<=768px) — Tabbed Editor
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Editor layout: full viewport, vertical stack */
    .editor-layout {
        height: 100vh;
        height: 100dvh;
    }

    /* Topbar: compact */
    .editor-topbar {
        padding: 8px 16px;
    }

    .topbar-brand {
        font-size: 0.95rem;
    }

    .editor-topbar .btn-ghost {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    /* Main area: switch from row to column */
    .editor-main {
        flex-direction: column;
        overflow: hidden;
    }

    /* Canvas area: ~50% of viewport */
    .canvas-area {
        order: 1;
        flex: none;
        height: 50vh;
        height: 50dvh;
        padding: 12px;
        min-height: 200px;
    }

    /* Mobile Tab Bar */
    .mobile-tab-bar {
        display: flex;
        order: 2;
        flex-shrink: 0;
        background: var(--bg-secondary);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding: 0;
        gap: 0;
    }

    .mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 10px 4px;
        background: none;
        border: none;
        border-bottom: 3px solid transparent;
        color: var(--text-secondary);
        font-family: var(--font-heading);
        font-size: 0.65rem;
        font-weight: 600;
        cursor: pointer;
        transition: color var(--transition-fast), border-color var(--transition-fast);
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-tab .tab-icon {
        font-size: 1.2rem;
        line-height: 1;
    }

    .mobile-tab .tab-label {
        text-transform: lowercase;
        letter-spacing: 0.02em;
    }

    .mobile-tab.active {
        color: var(--text-accent);
        border-bottom-color: var(--text-accent);
    }

    /* Sidebar: scrollable panel below tab bar */
    .editor-sidebar {
        order: 3;
        width: 100%;
        flex: 1;
        border-left: none;
        border-top: none;
        padding: 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide sidebar title on mobile (tabs replace it) */
    .editor-sidebar .sidebar-title {
        display: none;
    }

    /* Hide section headers on mobile (tab labels replace them) */
    .editor-sidebar .section-header {
        display: none;
    }

    /* Tab content: hide all by default */
    .editor-sidebar .control-section {
        display: none;
        border-bottom: none;
        padding-top: 0;
    }

    /* Show the active tab's section */
    .editor-sidebar[data-active-tab="frames"] .control-section[data-tab="frames"],
    .editor-sidebar[data-active-tab="vibes"] .control-section[data-tab="vibes"],
    .editor-sidebar[data-active-tab="text"] .control-section[data-tab="text"],
    .editor-sidebar[data-active-tab="export"] .control-section[data-tab="export"] {
        display: block;
    }

    /* Template grid: larger touch targets */
    .template-grid {
        gap: 10px;
    }

    .template-thumb {
        padding: 14px 10px;
        font-size: 0.85rem;
    }

    /* Gradient grid: bigger swatches */
    .gradient-grid {
        gap: 10px;
    }

    .gradient-swatch {
        aspect-ratio: 1.2;
    }

    /* Phrase chips: no max-height on mobile */
    .phrase-chips {
        max-height: none;
    }

    /* Export buttons: large thumb-friendly */
    .export-section {
        margin-top: 0;
        padding-top: 0;
    }

    .btn-export {
        padding: 18px 24px;
        font-size: 1.1rem;
        border-radius: var(--radius-md);
        margin-bottom: 12px;
    }

    /* Color picker: larger */
    .color-picker {
        width: 48px;
        height: 40px;
    }

    /* Text input: larger for mobile */
    .text-input {
        padding: 14px 16px;
        font-size: 1rem;
    }

    /* Select input: larger for mobile */
    .select-input {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
}

