/* --- MP3shki Studio Design System --- */
:root {
    /* Colors - Notion Palette */
    --bg-main: #FFFFFF;
    --bg-alt: #F7F6F3;
    --bg-control: #FFFFFF;

    --fg-main: #37352F;
    --fg-sec: #787774;
    --fg-ter: #9B9A97;

    --border: #E0E0E0;
    --border-hover: #D1D1D1;

    --accent: #F1C800;
    /* Yellow */
    --accent-dark: #D9B300;

    --success: #0F8953;
    --success-bg: #E6F3EB;

    --error: #DF5452;
    --error-bg: #FBEAEA;

    /* Spacing & Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-float: 0 4px 12px rgba(0, 0, 0, 0.08);

    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    color: var(--fg-main);
    height: 100vh;
    overflow-x: hidden;
}

/* --- Layout: The Studio --- */
.studio-layout {
    display: grid;
    grid-template-columns: 1fr;
    /* Mobile Default */
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-main);
    grid-template-rows: auto 1fr;
    border: 1px solid var(--border);
    /* Row 1: Header, Row 2: Content */
}

/* Global Header */
.global-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 6px 24px;
    z-index: 20;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.global-header h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.global-header .subtitle {
    font-size: 13px;
    color: var(--fg-sec);
    margin-top: 2px;
}

/* Desktop Grid: Controls LEFT, Workspace RIGHT */
@media (min-width: 900px) {
    .studio-layout {
        grid-template-columns: 320px 1fr;
        grid-template-rows: auto 1fr;
        /* Header | Content */
        overflow: hidden;
    }

    .global-header {
        grid-column: 1 / -1;
        /* Span full width */
    }
}

/* --- Area: Controls (Sidebar) --- */
.studio-controls {
    background: #FAFAFA;
    border-right: 1px solid var(--border);
    /* Right border for left sidebar */
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: auto;
    /* Internal scrolling */
    z-index: 10;
}

@media (max-width: 899px) {
    .studio-controls {
        border-right: none;
        height: auto;
        border-bottom: 1px solid var(--border);
    }
}

.controls-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border);
}

.controls-header h2 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--fg-sec);
    margin: 0;
    letter-spacing: 0.05em;
}

/* Format Section (Always Visible primarily) */
.format-section {
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid var(--border);
}

.chips-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.chip {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: all 0.1s;
    color: var(--fg-sec);
}

.chip:hover {
    border-color: var(--fg-main);
    color: var(--fg-main);
}

.chip.active {
    background: var(--bg-main);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
    color: black;
    font-weight: 600;
}

/* Collapsible Sections */
.settings-block {
    border-bottom: 1px solid var(--border);
}

.settings-summary {
    padding: 16px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.1s;
}

.settings-summary:hover {
    background: rgba(0, 0, 0, 0.02);
}

.settings-summary::after {
    content: '›';
    font-size: 18px;
    color: var(--fg-ter);
    transition: transform 0.2s;
}

.settings-block[open] .settings-summary::after {
    transform: rotate(90deg);
}

.settings-content {
    padding: 0 24px 20px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Inputs */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
    color: var(--fg-sec);
}

.input-box {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.input-box:focus {
    outline: none;
    border-color: var(--accent);
}

/* Range Slider */
.range-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-val {
    font-size: 13px;
    width: 40px;
    text-align: right;
}

/* --- Area: Workspace (Main) --- */
.studio-workspace {
    padding: 10px 40px;
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

@media (max-width: 899px) {
    .studio-workspace {
        padding: 20px 10px;
    }
}

.workspace-header {
    margin-bottom: 32px;
}

.workspace-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.workspace-header .subtitle {
    color: var(--fg-sec);
    font-size: 15px;
}

/* Dynamic Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 24px;
}

.drop-zone:hover {
    border-color: var(--fg-sec);
    background: #F0F0F0;
}

/* Compact mode for when files exist */
.drop-zone.compact {
    padding: 12px;
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--fg-sec);
    margin-bottom: 16px;
}

.drop-zone.compact .dz-large {
    display: none;
}

.drop-zone.compact .dz-small {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
}

.drop-zone .dz-small {
    display: none;
}

/* Hidden by default */

.file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    /* File list takes available space */
}

/* File Card */
.file-card {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    box-shadow: var(--shadow-sm);
}

.file-card.done {
    border-left: 4px solid var(--success);
}

.file-card.error {
    border-left: 4px solid var(--error);
}

.file-card.processing {
    border-left: 4px solid var(--accent);
}

.card-info {
    flex: 1;
    margin-left: 12px;
    min-width: 0;
}

.card-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 12px;
    color: var(--fg-ter);
}

.download-link {
    color: var(--success);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid var(--success);
    border-radius: 100px;
}

.download-link:hover {
    background: var(--success);
    color: white;
}

/* Console / Logs (Bottom of workspace) */
.console-area {
    margin-top: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #1e1e1e;
    color: #a0a0a0;
    font-family: monospace;
    font-size: 11px;
    /* Smaller font */
    padding: 8px;
    min-height: 200px;
    max-height: 200px;
    /* Minimal height */
    overflow-y: auto;
    display: none;
    /* Hidden if empty */
}

.console-area.visible {
    display: block;
}

.console-line {
    margin-bottom: 2px;
    border-bottom: 1px solid #333;
    padding-bottom: 2px;
}

/* Mobile Action Bar */
.mobile-action-bar {
    display: none;
}

@media (max-width: 899px) {

    /* Make Controls flow naturally */
    .studio-layout {
        display: block;
        /* No grid on mobile */
        height: auto;
        overflow: visible;
    }

    .studio-controls {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow: visible;
    }

    .studio-workspace {
        height: auto;
        overflow: visible;
        padding-bottom: 80px;
        /* Space for sticky footer */
    }

    .mobile-action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 12px 20px;
        border-top: 1px solid var(--border);
        display: flex;
        gap: 12px;
        z-index: 1000;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    }

    .drop-zone {
        padding: 30px 20px;
    }
}

.btn-primary {
    background: var(--accent);
    color: black;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Desktop Action (Visible on PC) */
@media (min-width: 900px) {
    /* CSS for Effects and Metadata Helpers */

    .chips-row-mini {
        display: inline-flex;
        gap: 4px;
    }

    .chip-mini {
        background: #f0f0f0;
        border: 1px solid transparent;
        border-radius: 4px;
        padding: 2px 6px;
        font-size: 11px;
        font-weight: 500;
        color: var(--fg-sec);
        cursor: pointer;
        transition: 0.1s;
    }

    .chip-mini:hover {
        background: #e0e0e0;
        color: var(--fg-main);
    }

    .tag-pill {
        background: white;
        border: 1px solid var(--border);
        border-radius: 100px;
        padding: 4px 10px;
        font-size: 11px;
        font-weight: 500;
        cursor: pointer;
        color: var(--fg-sec);
        transition: 0.1s;
        user-select: none;
    }

    .tag-pill:hover {
        border-color: var(--accent);
        color: var(--fg-main);
        background: var(--bg-main);
    }

    .tag-pill:active {
        transform: translateY(1px);
    }
}

/* Mobile First Sliders */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 18px;
    color: var(--fg-main);
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.1s;
}

.slider-btn:hover {
    background: var(--bg-alt);
}

.slider-btn:active {
    background: #e0e0e0;
    transform: scale(0.96);
}

/* Custom Range Input */
.custom-range {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    cursor: pointer;
    height: 24px;
    /* Touch target height */
}

/* Track */
.custom-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: #E0E0E0;
    border-radius: 100px;
}

.custom-range::-moz-range-track {
    width: 100%;
    height: 6px;
    background: #E0E0E0;
    border-radius: 100px;
}

/* Thumb */
.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--fg-sec);
    margin-top: -7px;
    /* Center on track */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.custom-range:focus::-webkit-slider-thumb {
    border-color: var(--accent);
    transform: scale(1.1);
}

.custom-range::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--fg-sec);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* --- Action Buttons & Menus (Unified) --- */

/* Base Action Button (Global tools like Reset/Clear) */
.btn-action-tool {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    color: var(--fg-sec);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.1s;
    font-weight: 500;
}

.btn-action-tool:hover {
    background: var(--bg-alt);
    color: var(--fg-main);
    border-color: var(--fg-sec);
}

/* Primary File Action (Download) */
.btn-file-primary {
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.1s;
    cursor: pointer;
}

.btn-file-primary:hover {
    background: #0d7a4a;
    /* Darker success */
    transform: translateY(-1px);
}

/* Menu Trigger (Three Dots) */
.menu-trigger {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--fg-sec);
    cursor: pointer;
    font-size: 18px;
    transition: 0.1s;
}

.menu-trigger:hover {
    background: var(--bg-alt);
    color: var(--fg-main);
}

.menu-trigger.active {
    background: var(--bg-alt);
    border-color: var(--border);
}

/* Dropdown Menu */
.action-menu-container {
    position: relative;
}

.menu-popup {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-float);
    width: 160px;
    display: none;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    padding: 4px;
}

.menu-popup.visible {
    display: flex;
    animation: fadeIn 0.1s ease-out;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--fg-main);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.1s;
}

.menu-item:hover {
    background: var(--bg-alt);
}

.menu-item.danger {
    color: var(--error);
}

.menu-item.danger:hover {
    background: var(--error-bg);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}