/* ═══════════════════════════════════════════════════════════════════
   EzDown — Main Stylesheet
   Modern, mobile-first, dark/light theme, glassmorphism
   ═══════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Custom Properties — Dark Theme (default) ────────────────── */
:root {
    --bg-primary:    #0a0e1a;
    --bg-secondary:  #111827;
    --bg-card:       rgba(17, 24, 39, 0.85);
    --bg-card-hover: rgba(25, 34, 56, 0.95);
    --bg-glass:      rgba(17, 24, 39, 0.6);
    --bg-input:      rgba(255, 255, 255, 0.06);
    --bg-input-focus:rgba(255, 255, 255, 0.1);

    --accent:        #00d4aa;
    --accent-hover:  #00f0c0;
    --accent-glow:   rgba(0, 212, 170, 0.25);
    --accent-2:      #667eea;
    --accent-2-glow: rgba(102, 126, 234, 0.2);
    --gradient:      linear-gradient(135deg, #00d4aa 0%, #667eea 100%);
    --gradient-text:  linear-gradient(135deg, #00d4aa 0%, #667eea 100%);

    --text-primary:   #e8edf5;
    --text-secondary: rgba(232, 237, 245, 0.55);
    --text-tertiary:  rgba(232, 237, 245, 0.35);

    --border:         rgba(255, 255, 255, 0.08);
    --border-hover:   rgba(255, 255, 255, 0.15);
    --border-accent:  rgba(0, 212, 170, 0.3);

    --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
    --shadow-md:  0 8px 32px rgba(0,0,0,0.4);
    --shadow-lg:  0 16px 64px rgba(0,0,0,0.5);
    --shadow-glow:0 0 40px var(--accent-glow);

    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-full:9999px;

    --nav-height: 56px;
    --bottom-nav-height: 64px;
    --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --danger:     #ef4444;
    --danger-bg:  rgba(239, 68, 68, 0.12);
    --success:    #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --warning:    #f59e0b;
}

/* ── Light Theme ─────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg-primary:    #f0f2f5;
    --bg-secondary:  #ffffff;
    --bg-card:       rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-glass:      rgba(255, 255, 255, 0.7);
    --bg-input:      rgba(0, 0, 0, 0.04);
    --bg-input-focus:rgba(0, 0, 0, 0.07);

    --accent:        #059669;
    --accent-hover:  #047857;
    --accent-glow:   rgba(5, 150, 105, 0.15);
    --accent-2:      #6366f1;
    --accent-2-glow: rgba(99, 102, 241, 0.12);
    --gradient:      linear-gradient(135deg, #059669 0%, #6366f1 100%);
    --gradient-text:  linear-gradient(135deg, #059669 0%, #6366f1 100%);

    --text-primary:   #111827;
    --text-secondary: rgba(17, 24, 39, 0.55);
    --text-tertiary:  rgba(17, 24, 39, 0.3);

    --border:         rgba(0, 0, 0, 0.08);
    --border-hover:   rgba(0, 0, 0, 0.15);
    --border-accent:  rgba(5, 150, 105, 0.3);

    --shadow-sm:  0 2px 8px rgba(0,0,0,0.06);
    --shadow-md:  0 8px 32px rgba(0,0,0,0.08);
    --shadow-lg:  0 16px 64px rgba(0,0,0,0.1);
    --shadow-glow:0 0 40px var(--accent-glow);
}

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

html {
    font-family: var(--font);
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.3s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-height);
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease;
}

.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.navbar-brand:hover { text-decoration: none; }

.navbar-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    font-weight: 800;
}

/* ── Bottom Navigation ────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-height);
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-family: var(--font);
    transition: color 0.25s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    min-width: 60px;
}

.bottom-nav-item::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px;
    height: 3px;
    border-radius: 2px;
    background: var(--gradient);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.bottom-nav-item.active {
    color: var(--accent);
}

.bottom-nav-item:active {
    transform: scale(0.92);
}

.bottom-nav-icon {
    width: 22px;
    height: 22px;
}

.bottom-nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* ── Main Content ────────────────────────────────────────────────── */
.main-content {
    padding-top: var(--nav-height);
    padding-bottom: var(--bottom-nav-height);
    min-height: 100vh;
}

/* ── Tab Pages ───────────────────────────────────────────────────── */
.tab-page {
    display: none;
    animation: fadeSlideIn 0.3s ease;
}

.tab-page.active {
    display: block;
}

/* ── Hero Section ────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 60px 20px 40px;
    max-width: 700px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.hero-title .gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 36px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Download Form ───────────────────────────────────────────────── */
.download-form {
    display: flex;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--bg-input);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.url-input {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
}

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

.paste-btn {
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    border-left: 1px solid var(--border);
}

.paste-btn:hover {
    color: var(--accent);
}

.download-btn {
    padding: 14px 28px;
    border-radius: var(--radius-lg);
    border: none;
    background: var(--gradient);
    color: #fff;
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

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

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Error Message ───────────────────────────────────────────────── */
.error-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 0.875rem;
    text-align: center;
    animation: fadeSlideIn 0.3s ease;
}

/* ── Result Card ─────────────────────────────────────────────────── */
.result-section {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    animation: fadeSlideIn 0.5s ease;
}

.result-cover-wrap {
    position: relative;
    max-height: 70vh;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-cover {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

/* ── Image Slider ────────────────────────────────────────────────── */
.image-slider {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    aspect-ratio: 9/16;
    max-height: 70vh;
}

.slider-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.slider-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.slider-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.slide-download-btn-text {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--gradient);
    color: white !important;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    font-size: 0.85rem;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
}

.slide-download-btn-text:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,212,170,0.4);
}

.slide-download-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--gradient);
    color: white !important;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    font-size: 1.2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
}

.slide-download-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,212,170,0.4);
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s, transform 0.2s;
    z-index: 5;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.slider-nav:hover {
    background: rgba(0,0,0,0.8);
    transform: translateY(-50%) scale(1.1);
}

.slider-prev { left: 12px; }
.slider-next { right: 12px; }

.slider-dots {
    position: absolute;
    bottom: 16px;
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 5;
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-dot.active {
    background: white;
    transform: scale(1.3);
}

.result-duration {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.result-body {
    padding: 20px;
}

.result-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.result-author-info {
    display: flex;
    flex-direction: column;
}

.result-author-name {
    font-weight: 600;
    font-size: 0.9rem;
}

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

.result-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-icon {
    font-size: 1rem;
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Download Buttons ────────────────────────────────────────────── */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: none;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #fff;
}

.action-btn:hover { text-decoration: none; }

.action-btn-primary {
    background: var(--gradient);
}
.action-btn-primary:hover {
    box-shadow: 0 4px 16px var(--accent-glow);
    transform: translateY(-1px);
}

.action-btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.action-btn-secondary:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-hover);
}

.action-btn-music {
    background: rgba(102, 126, 234, 0.15);
    color: var(--accent-2);
    border: 1px solid rgba(102, 126, 234, 0.2);
}
.action-btn-music:hover {
    background: rgba(102, 126, 234, 0.25);
}

/* ── Skeleton Loading ────────────────────────────────────────────── */
.skeleton {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: fadeSlideIn 0.3s ease;
}

.skeleton-cover {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(90deg,
        var(--bg-input) 25%,
        var(--bg-input-focus) 50%,
        var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-body {
    padding: 20px;
}

.skeleton-line {
    height: 14px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg,
        var(--bg-input) 25%,
        var(--bg-input-focus) 50%,
        var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    margin-bottom: 10px;
}

.skeleton-line-short   { width: 60%; }
.skeleton-line-medium  { width: 80%; }
.skeleton-line-full    { width: 100%; }

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg,
        var(--bg-input) 25%,
        var(--bg-input-focus) 50%,
        var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.skeleton-btn {
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg,
        var(--bg-input) 25%,
        var(--bg-input-focus) 50%,
        var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    margin-bottom: 8px;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Loading overlay text ────────────────────────────────────────── */
.loading-text {
    text-align: center;
    padding: 12px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* ── Guide Section ───────────────────────────────────────────────── */
.guide-section {
    padding: 40px 20px 60px;
    max-width: 800px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
    letter-spacing: -0.01em;
}

.guide-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.guide-step {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.guide-step:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.guide-step-number {
    width: 44px;
    height: 44px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.guide-step-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.guide-step-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.guide-step-desc {
    font-size: 0.825rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── History Section ─────────────────────────────────────────────── */
.history-section {
    padding: 40px 20px 80px;
    max-width: 800px;
    margin: 0 auto;
}

.history-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    gap: 12px;
}

.clear-btn {
    padding: 10px 24px;
    border-radius: var(--radius-full);
    border: none;
    background: #ef4444;
    color: #fff;
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.clear-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.history-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.history-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    animation: fadeSlideIn 0.3s ease;
    cursor: pointer;
    text-align: center;
}

.history-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.history-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-secondary);
    margin-bottom: 10px;
}

.history-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.history-title {
    display: none;
}

.history-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.history-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.history-date {
    display: none;
}

.history-actions {
    margin-top: 10px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.history-delete-btn {
    width: auto;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--danger-bg);
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.history-delete-btn:hover {
    background: var(--danger);
    color: #fff;
}

/* Modal CSS */
.media-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}
.media-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}
.media-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.media-modal-close:hover {
    background: rgba(255,255,255,0.4);
}
.media-modal-video {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-md);
    outline: none;
}

.history-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.history-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.history-empty-text {
    font-size: 0.9rem;
}

/* ── Toast ────────────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    padding: 10px 20px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
    pointer-events: auto;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

/* ── Fade / Slide Animations ─────────────────────────────────────── */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Mobile Menu Toggle ──────────────────────────────────────────── */
.menu-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* ── Footer ──────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    border-top: 1px solid var(--border);
}

/* ── Confirm Dialog ──────────────────────────────────────────────── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.confirm-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 380px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: fadeSlideIn 0.3s ease;
}

.confirm-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.confirm-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.confirm-cancel,
.confirm-ok {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-cancel {
    background: var(--bg-input);
    color: var(--text-primary);
}
.confirm-cancel:hover { background: var(--bg-input-focus); }

.confirm-ok {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.confirm-ok:hover {
    background: #dc2626;
}

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS SECTION
   ═══════════════════════════════════════════════════════════════════ */

.settings-section {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.settings-item:last-child { border-bottom: none; }

.settings-item:hover {
    background: var(--bg-input);
}

.settings-item-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.settings-item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-input);
}

.settings-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.settings-item-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.settings-item-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ── Theme Switcher ──────────────────────────────────────────────── */
.theme-switcher {
    display: flex;
    gap: 4px;
    border-radius: var(--radius-full);
    background: var(--bg-input);
    padding: 3px;
    flex-shrink: 0;
}

.theme-option {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.theme-option.active {
    background: var(--gradient);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* ── Language Select (Settings page) ─────────────────────────────── */
.lang-select-full {
    padding: 8px 32px 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    flex-shrink: 0;
    max-width: 140px;
}

.lang-select-full:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.lang-select-full option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.settings-footer {
    text-align: center;
    padding: 32px 20px 0;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.clear-input-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    margin: 0 8px 0 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    flex-shrink: 0;
}

.clear-input-btn:hover {
    color: var(--text-primary);
    background: rgba(128, 128, 128, 0.15);
    transform: scale(1.05);
}

.clear-input-btn:active {
    transform: scale(0.95);
    background: rgba(128, 128, 128, 0.25);
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .hero { padding: 32px 16px 24px; }
    .hero-title { font-size: 1.6rem; }

    .download-form {
        flex-direction: column;
    }

    .download-btn {
        justify-content: center;
        width: 100%;
    }

    .guide-steps { grid-template-columns: 1fr; }
    .result-stats { gap: 12px; }
    .history-item { flex-direction: column; }

    .settings-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Fix navbar moving up on keyboard open */
@media screen and (max-height: 450px) {
    .bottom-nav {
        display: none !important;
    }
}
