/* ════════════════════════════════════════════════════════════════════════════
   Gamdl Web — Design System
   Dark theme inspired by Apple Music / gamm-dl
   ════════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ─────────────────────────────────────────────────── */
:root {
    --bg-primary: #1a1a1e;
    --bg-secondary: #242428;
    --bg-tertiary: #2e2e34;
    --bg-card: #28282e;
    --bg-input: #2a2a30;
    --bg-hover: #34343c;

    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-muted: #6e6e73;
    --text-placeholder: #555560;

    --accent: #ff375f;
    --accent-hover: #ff5277;
    --accent-glow: rgba(255, 55, 95, 0.25);
    --accent-gradient: linear-gradient(135deg, #ff375f 0%, #ff6482 100%);

    --success: #30d158;
    --success-bg: rgba(48, 209, 88, 0.12);
    --warning: #ffd60a;
    --warning-bg: rgba(255, 214, 10, 0.12);
    --error: #ff453a;
    --error-bg: rgba(255, 69, 58, 0.12);

    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 55, 95, 0.5);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}


/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--accent);
    color: #fff;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}


/* ── App Layout ────────────────────────────────────────────────────────────── */
.app {
    width: 100%;
    max-width: 600px;
    padding: 40px 0 60px;
    position: relative;
}


/* ── Header Icons ──────────────────────────────────────────────────────────── */
.header-icons {
    position: absolute;
    top: 40px;
    right: 0;
    display: flex;
    gap: 6px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.icon-btn:active {
    transform: scale(0.92);
}


/* ── Auth Badge ────────────────────────────────────────────────────────────── */
.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 24px;
    transition: all var(--transition-fast);
}



.auth-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--error);
    transition: background var(--transition-normal);
}

.auth-badge.connected .auth-dot {
    background: var(--success);
    box-shadow: 0 0 6px rgba(48, 209, 88, 0.5);
}

.auth-badge.connected {
    color: var(--success);
    border-color: rgba(48, 209, 88, 0.2);
}

.auth-badge.restricted .auth-dot {
    background: var(--warning);
}


/* ── Title ─────────────────────────────────────────────────────────────────── */
.app-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    text-align: center;
    /* Create a repeating gradient that can slide smoothly */
    background: linear-gradient(110deg,
            #ffffff 0%,
            #d1d1d6 20%,
            var(--accent) 50%,
            #d1d1d6 80%,
            #ffffff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 5s linear infinite;
}

@keyframes textShimmer {
    to {
        background-position: -200% center;
    }
}

.app-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 32px;
    text-align: center;
}

.app-subtitle strong {
    color: var(--text-primary);
    font-weight: 500;
}


/* ── URL Form ──────────────────────────────────────────────────────────────── */
.url-form {
    margin-bottom: 30px;
}

.url-input-wrap {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.url-input {
    flex: 1;
    height: 52px;
    padding: 0 18px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
}

.url-input::placeholder {
    color: var(--text-placeholder);
}

.url-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-download {
    height: 52px;
    padding: 0 28px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 12px var(--accent-glow);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-download:active {
    transform: translateY(0) scale(0.97);
}

.btn-download:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}


/* ── Download Queue ────────────────────────────────────────────────────────── */
.queue-section {
    display: none;
    animation: fadeSlideUp 0.3s ease;
}

.queue-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


/* ── Job Card ──────────────────────────────────────────────────────────────── */
.job-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.job-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.job-header:hover {
    background: var(--bg-hover);
}

.job-url {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.job-status {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 100px;
    text-transform: capitalize;
}

.job-status.queued {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.job-status.parsing,
.job-status.preparing {
    background: var(--warning-bg);
    color: var(--warning);
}

.job-status.downloading,
.job-status.decrypting,
.job-status.tagging {
    background: rgba(10, 132, 255, 0.12);
    color: #0a84ff;
}

.job-status.done {
    background: var(--success-bg);
    color: var(--success);
}

.job-status.error {
    background: var(--error-bg);
    color: var(--error);
}

.job-status.cancelled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.job-tracks {
    display: none;
    border-top: 1px solid var(--border);
}

.job-card.expanded .job-tracks {
    display: block;
}


/* ── Track Item ────────────────────────────────────────────────────────────── */
.track-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: background var(--transition-fast);
}

.track-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.track-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.track-cover {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    overflow: hidden;
    flex-shrink: 0;
}

.track-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-info {
    flex: 1;
    min-width: 0;
}

.track-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-artist {
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-status-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.track-status-icon.downloading {
    color: #0a84ff;
    animation: pulse 1.5s ease-in-out infinite;
}

.track-status-icon.done {
    color: var(--success);
}

.track-status-icon.error {
    color: var(--error);
}

.track-status-icon.queued {
    color: var(--text-muted);
}


/* ── Progress bar ──────────────────────────────────────────────────────────── */
.track-progress {
    width: 100%;
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.track-progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.5s ease;
    box-shadow: 0 0 8px var(--accent-glow);
}


/* ── Save buttons ──────────────────────────────────────────────────────── */
.track-save-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.track-save-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
    color: #fff;
}



/* ── Retry buttons ─────────────────────────────────────────────────────── */
.track-retry-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 214, 10, 0.15);
    border: 1px solid rgba(255, 214, 10, 0.3);
    border-radius: var(--radius-sm);
    color: var(--warning);
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.track-retry-btn:hover {
    background: rgba(255, 214, 10, 0.25);
    border-color: var(--warning);
    transform: scale(1.1);
}

.track-retry-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.job-retry-all {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
}

.btn-retry-all {
    width: 100%;
    height: 44px;
    background: rgba(255, 214, 10, 0.1);
    border: 1px solid rgba(255, 214, 10, 0.25);
    border-radius: var(--radius-sm);
    color: var(--warning);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.btn-retry-all:hover {
    background: rgba(255, 214, 10, 0.2);
    border-color: var(--warning);
}

.btn-retry-all:active {
    transform: scale(0.97);
}

.btn-retry-all:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* ── Modals ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 85dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s ease;
}

.modal-sm {
    max-width: 400px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
}


/* ── Settings Groups ───────────────────────────────────────────────────────── */
.settings-group {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.settings-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-group h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.field-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}


/* ── Inputs ────────────────────────────────────────────────────────────────── */
.text-input,
.select-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition-fast);
    -webkit-appearance: none;
}

.text-input:focus,
.select-input:focus {
    border-color: var(--border-focus);
}

.select-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a6' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.wrapper-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 6px;
    background: var(--text-muted);
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.wrapper-status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px rgba(48, 209, 88, 0.5);
}

.wrapper-status-dot.offline {
    background: var(--error);
}

/* ── Wrapper Restart Button ───────────────────────────────────────────────── */
.btn-restart-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 10px;
    background: rgba(255, 159, 10, 0.1);
    border: 1px solid rgba(255, 159, 10, 0.3);
    border-radius: var(--radius-sm);
    color: #ff9f0a;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    margin-left: auto;
}

.btn-restart-wrapper:hover {
    background: rgba(255, 159, 10, 0.2);
    border-color: #ff9f0a;
}

.btn-restart-wrapper:active {
    transform: scale(0.95);
}

.btn-restart-wrapper:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-restart-wrapper .spin-icon {
    animation: spin 1s linear infinite;
}

.btn-restart-wrapper.restarting {
    border-color: rgba(255, 159, 10, 0.5);
}


/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
    height: 44px;
    padding: 0 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    height: 44px;
    padding: 0 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-secondary:active {
    transform: scale(0.97);
}


/* ── Cookie Upload ─────────────────────────────────────────────────────────── */
.cookie-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cookie-status {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.cookie-status.success {
    color: var(--success);
}


/* ── About ─────────────────────────────────────────────────────────────────── */
.about-content {
    text-align: center;
    padding: 10px 0;
}

.about-name {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #ffffff 0%, #ff375f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.about-version {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.about-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.about-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.about-links a {
    font-size: 0.85rem;
    font-weight: 500;
}


/* ── Toast ─────────────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    animation: toastSlideIn 0.3s ease;
    pointer-events: auto;
    max-width: 360px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--error);
}

.toast.info {
    border-left: 3px solid #0a84ff;
}

.toast.out {
    animation: toastSlideOut 0.3s ease forwards;
}


/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .app {
        padding: 24px 0 40px;
    }

    .header-icons {
        top: 24px;
    }

    .app-title {
        font-size: 2rem;
    }

    .app-subtitle {
        font-size: 0.82rem;
    }

    .url-input-wrap {
        flex-direction: column;
    }

    .url-input {
        width: 100%;
        height: 60px;
        padding: 16px 18px;
        font-size: 1rem;
    }

    .btn-download {
        width: 100%;
        height: 56px;
        font-size: 1rem;
    }

    .modal {
        border-radius: var(--radius-lg);
        max-height: 90dvh;
    }

    .modal-header {
        padding: 16px 20px 12px;
    }

    .modal-body {
        padding: 16px 20px;
    }

    .modal-footer {
        padding: 12px 20px 16px;
    }

    #toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .toast {
        max-width: 100%;
    }

    .preview-header {
        gap: 12px;
        padding: 14px;
    }

    .preview-artwork {
        width: 80px;
        height: 80px;
    }

    .preview-title {
        font-size: 1rem;
    }

    .preview-artist {
        font-size: 0.8rem;
    }

    .preview-genre {
        font-size: 0.7rem;
    }

    .preview-download-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        top: 14px;
        right: 14px;
    }

    .preview-track-item {
        padding: 8px 14px;
    }

    .preview-footer {
        padding: 12px 14px;
        font-size: 0.7rem;
    }
}


/* ── Preview Section ──────────────────────────────────────────────────────── */

/* Status container */
.status-container {
    margin-top: 1.25em;
    margin-bottom: 1em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75em;
    min-height: 0;
}

.status-container:empty {
    display: none;
}

.status-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.status-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.status-progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.status-track-list {
    width: 100%;
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
}

.status-track {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.status-track.done {
    color: var(--text-secondary);
}

.status-track.active {
    color: var(--text-primary);
}

.status-track.error {
    color: var(--danger);
}

.status-track-icon {
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.7rem;
}

.status-track-icon.done {
    color: var(--success);
}

.status-track-icon.active {
    color: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

.status-track-icon.error {
    color: var(--danger);
}

.status-track-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}



.preview-section {
    display: none;
    margin-bottom: 32px;
    animation: fadeSlideUp 0.4s ease;
}

.preview-section.visible {
    display: block;
}

.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.preview-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    position: relative;
    background: linear-gradient(180deg, var(--preview-bg, rgba(100, 100, 100, 0.3)) 0%, transparent 100%);
}

.preview-artwork {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.preview-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 4px;
}

.preview-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.preview-artist {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-genre {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.explicit-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    line-height: 1;
    flex-shrink: 0;
}

.inline-badge {
    margin-left: 6px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.preview-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.preview-badge {
    display: inline-block;
    width: fit-content;
    padding: 2px 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: rgba(255, 43, 92, 0.12);
    border: 1px solid rgba(255, 43, 92, 0.25);
    border-radius: 999px;
}

.preview-download-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 12px var(--accent-glow);
    align-self: center;
}

.preview-download-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px var(--accent-glow), var(--shadow-glow);
}

.preview-download-btn:active {
    transform: scale(0.95);
}

.preview-download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Track list */
.preview-tracks {
    border-top: 1px solid var(--border);
    max-height: 320px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.preview-track-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    transition: background var(--transition-fast);
}

.preview-track-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.preview-track-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.preview-track-num {
    width: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.preview-track-info {
    flex: 1;
    min-width: 0;
}

.preview-track-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.preview-track-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-track-artist {
    font-size: 0.73rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-track-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Footer */
.preview-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-size: 0.73rem;
    color: var(--text-muted);
    line-height: 1.6;
}