:root {
    --yt-red: #ff0000;
    --ig-pink: #e1306c;
    --ig-purple: #833ab4;
    --sc-yellow: #fffc00;
    --bg: #0d0d0f;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-border: rgba(255, 255, 255, 0.08);
    --gradient-start: #833ab4;
    --gradient-mid: #fd1d1d;
    --gradient-end: #fcb045;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: #e5e5e5;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* main grows to push footer to the very bottom of the viewport */
main {
    flex: 1;
}

/* Navbar */
.navbar {
    background: rgba(13, 13, 15, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--surface-border);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.3px;
    color: white !important;
}

/* Navbar logo image — replaces the old play-circle icon + text. */
.navbar-logo {
    height: 36px;
    width: auto;
    display: block;
}
@media (max-width: 576px) {
    .navbar-logo { height: 30px; }
}

/* Text gradient */
.text-gradient {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hero — no min-height; body flex+main flex:1 handles footer pinning */
.hero-section {
    padding: 3rem 0 2rem;
    background: radial-gradient(ellipse at 50% 0%, rgba(131, 58, 180, 0.12) 0%, transparent 60%);
}

/* Glass card */
.glass-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    backdrop-filter: blur(8px);
    transition: border-color 0.2s;
}

.glass-card:focus-within {
    border-color: rgba(131, 58, 180, 0.5);
    box-shadow: 0 0 0 3px rgba(131, 58, 180, 0.1);
}

/* URL input */
#urlInput {
    font-size: 1rem;
    color: white;
}

#urlInput::placeholder { color: rgba(255, 255, 255, 0.3); }
#urlInput:focus { box-shadow: none; outline: none; }

/* Platform badges */
.platform-badges {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.platform-badge.youtube {
    background: rgba(255, 0, 0, 0.15);
    color: #ff4444;
    border: 1px solid rgba(255, 0, 0, 0.2);
}

.platform-badge.instagram {
    background: rgba(225, 48, 108, 0.15);
    color: #e1306c;
    border: 1px solid rgba(225, 48, 108, 0.2);
}

.platform-badge.snapchat {
    background: rgba(255, 252, 0, 0.12);
    color: #ffe600;
    border: 1px solid rgba(255, 252, 0, 0.2);
}

.platform-badge.facebook {
    background: rgba(24, 119, 242, 0.15);
    color: #4a9ff5;
    border: 1px solid rgba(24, 119, 242, 0.25);
}

.platform-badge.twitter {
    background: rgba(255, 255, 255, 0.08);
    color: #e7e9ea;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.platform-badge.tiktok {
    background: rgba(255, 0, 80, 0.12);
    color: #ff4d7d;
    border: 1px solid rgba(255, 0, 80, 0.2);
}

.platform-badge.threads {
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Thumbnail */
.thumbnail-img {
    width: 140px;
    height: 90px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.05);
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Format select */
.bg-dark-select {
    background-color: rgba(255, 255, 255, 0.07) !important;
    color: white !important;
}

.bg-dark-select option {
    background-color: #1a1a2e;
    color: white;
}

/* Gradient button */
.btn-gradient {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
    border: none;
    color: white;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-gradient:hover { opacity: 0.9; color: white; transform: translateY(-1px); }
.btn-gradient:active { transform: translateY(0); }
.btn-gradient:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Progress bar */
.progress-bar {
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
    background-size: 200% 100%;
    animation: gradientSlide 2s linear infinite, progress-bar-stripes 1s linear infinite;
}

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

/* Step cards */
.step-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
}

.step-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(131,58,180,0.3), rgba(253,29,29,0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin: 0 auto;
}

/* Story badge */
.story-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(131,58,180,0.25), rgba(253,29,29,0.25));
    color: #f0a0c0;
    border: 1px solid rgba(253, 29, 29, 0.3);
    animation: fadeIn 0.3s ease;
}

/* Story support row in hero */
.story-support-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.story-support-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
}

.platform-badge.sm {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    opacity: 0.7;
}

/* TikTok watermark toggle */
.tiktok-toggle {
    background: rgba(255, 0, 80, 0.08);
    border: 1px solid rgba(255, 0, 80, 0.2);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
}

.tiktok-toggle .form-check-label {
    color: #ff4d7d;
}

.tiktok-toggle .form-check-input:checked {
    background-color: #ff0050;
    border-color: #ff0050;
}

/* Footer */
footer {
    border-top: 1px solid var(--surface-border);
    background: rgba(13, 13, 15, 0.8);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }

/* Ensure muted text is readable on dark backgrounds */
.text-muted {
    color: #c0c4cc !important;
}

/* Alert */
.alert-danger {
    background: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.3);
    color: #ff6b7a;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

/* Auth card */
.auth-card {
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    backdrop-filter: blur(8px);
    transition: border-color 0.25s, background 0.25s;
}

.auth-card.auth-active {
    background: rgba(34, 197, 94, 0.07);
    border-color: rgba(34, 197, 94, 0.3);
}

.auth-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fbbf24;
    flex-shrink: 0;
    transition: background 0.25s, color 0.25s;
}

.auth-card.auth-active .auth-icon-wrap {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.auth-active-badge,
.auth-checking-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}

.auth-active-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.auth-checking-badge {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

/* Login modal textarea */
#cookieInput {
    font-size: 0.78rem;
    resize: vertical;
}

kbd {
    font-size: 0.75rem;
}

/* ── Light mode ──────────────────────────────────────────────────────────── */

[data-theme="light"] {
    --bg: #f2f3f7;
    --surface: rgba(255, 255, 255, 0.85);
    --surface-border: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] body {
    background: var(--bg);
    color: #1a1a2e;
}

[data-theme="light"] .navbar {
    background: rgba(242, 243, 247, 0.95) !important;
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .navbar-brand { color: #1a1a2e !important; }

[data-theme="light"] .glass-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .hero-section {
    background: radial-gradient(ellipse at 50% 0%, rgba(131, 58, 180, 0.07) 0%, transparent 60%);
}

[data-theme="light"] .text-white  { color: #1a1a2e !important; }
[data-theme="light"] .text-muted  { color: #555 !important; }

[data-theme="light"] #urlInput {
    color: #1a1a2e !important;
}
[data-theme="light"] #urlInput::placeholder { color: rgba(26, 26, 46, 0.35); }

[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    color: #1a1a2e !important;
    border-color: rgba(0, 0, 0, 0.18) !important;
    background-color: rgba(255, 255, 255, 0.8) !important;
}
[data-theme="light"] .form-control::placeholder { color: rgba(26, 26, 46, 0.35) !important; }

[data-theme="light"] .bg-dark-select {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #1a1a2e !important;
}
[data-theme="light"] .bg-dark-select option,
[data-theme="light"] .form-select option {
    background-color: #fff;
    color: #1a1a2e;
}

[data-theme="light"] .alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.3);
    color: #b91c1c;
}
[data-theme="light"] .alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #15803d;
}

[data-theme="light"] footer {
    background: rgba(242, 243, 247, 0.9);
    border-top-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] footer a { color: #555 !important; }

[data-theme="light"] .step-card { background: rgba(255,255,255,0.8); border-color: rgba(0,0,0,0.1); }
[data-theme="light"] .auth-card { background: rgba(251,191,36,0.08); border-color: rgba(251,191,36,0.25); }
[data-theme="light"] .tiktok-toggle { background: rgba(255,0,80,0.06); }

/* Twitter/X and Threads badges are white-on-white in light mode — give them dark text.
   Use !important because the base rules set near-invisible white colors. */
[data-theme="light"] .platform-badge.twitter {
    background: rgba(0, 0, 0, 0.07) !important;
    color: #1a1a2e !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
}
[data-theme="light"] .platform-badge.threads {
    background: rgba(0, 0, 0, 0.07) !important;
    color: #1a1a2e !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    opacity: 1 !important;   /* base rule sets opacity:0.5 which makes it ghostly on light bg */
}

/* ── Light mode: all button outlines ─────────────────────────────────────── */
/* btn-outline-light becomes invisible on a light background — remap to dark */
[data-theme="light"] .btn-outline-light {
    color: #1a1a2e !important;
    border-color: rgba(0, 0, 0, 0.28) !important;
    background-color: transparent !important;
}
[data-theme="light"] .btn-outline-light:hover,
[data-theme="light"] .btn-outline-light:focus {
    background-color: rgba(0, 0, 0, 0.06) !important;
    color: #000 !important;
    border-color: rgba(0, 0, 0, 0.45) !important;
}
[data-theme="light"] .btn-outline-light:active {
    background-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .btn-outline-secondary {
    color: #444 !important;
    border-color: rgba(0, 0, 0, 0.22) !important;
    background-color: transparent !important;
}
[data-theme="light"] .btn-outline-secondary:hover,
[data-theme="light"] .btn-outline-secondary:focus {
    background-color: rgba(0, 0, 0, 0.06) !important;
    color: #111 !important;
    border-color: rgba(0, 0, 0, 0.38) !important;
}

[data-theme="light"] .btn-outline-danger {
    color: #c0392b !important;
    border-color: #c0392b !important;
}
[data-theme="light"] .btn-outline-danger:hover {
    background-color: rgba(192, 57, 43, 0.08) !important;
}

[data-theme="light"] .btn-outline-warning {
    color: #92400e !important;
    border-color: #92400e !important;
}
[data-theme="light"] .btn-outline-warning:hover {
    background-color: rgba(146, 64, 14, 0.08) !important;
}

/* Disabled buttons */
[data-theme="light"] .btn:disabled,
[data-theme="light"] .btn.disabled {
    opacity: 0.45 !important;
}

/* ── Light mode: form check (checkbox / radio) ───────────────────────────── */
[data-theme="light"] .form-check-input {
    border-color: rgba(0, 0, 0, 0.3) !important;
    background-color: #fff !important;
}
[data-theme="light"] .form-check-label { color: #333 !important; }

/* ── Light mode: links ───────────────────────────────────────────────────── */
[data-theme="light"] a.text-white { color: #1a1a2e !important; }
[data-theme="light"] a.text-white:hover { color: #833ab4 !important; }

/* ── Light mode: dark input fix (bg-transparent + text-white combos) ─────── */
/* On light background, transparent inputs must use dark text regardless */
[data-theme="light"] .form-control.bg-transparent,
[data-theme="light"] .form-control.text-white {
    color: #1a1a2e !important;
    background-color: rgba(255,255,255,0.75) !important;
    border-color: rgba(0, 0, 0, 0.18) !important;
}
[data-theme="light"] .form-control.bg-transparent::placeholder,
[data-theme="light"] .form-control.text-white::placeholder {
    color: rgba(26, 26, 46, 0.38) !important;
}

/* ── Dark mode: ensure form controls use dark background ─────────────────── */
/* Bootstrap 5 default form-control is white bg / dark text — override for dark theme */
:root:not([data-theme="light"]) .form-control,
:root:not([data-theme="light"]) .form-select {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: #e5e5e5 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}
:root:not([data-theme="light"]) .form-control::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}
:root:not([data-theme="light"]) .form-check-input {
    background-color: rgba(255,255,255,0.06) !important;
    border-color: rgba(255,255,255,0.3) !important;
}

/* ── Mobile responsiveness ───────────────────────────────────────────────── */

@media (max-width: 576px) {
    .hero-section { padding: 1.5rem 0 1.5rem; }

    .platform-badges { gap: 0.3rem; }
    .platform-badge  { font-size: 0.7rem; padding: 0.2rem 0.5rem; }

    .glass-card { padding: 1rem; border-radius: 12px; }

    /* History cards: stack thumbnail above info on very small screens */
    .history-card-inner { flex-direction: column !important; }
    .history-thumb { width: 100% !important; height: 140px !important; }

    /* Stat cards: smaller font */
    .glass-card .fw-bold.fs-5 { font-size: 1rem !important; }

    /* Fetch / Clear buttons: icon-only on mobile so the URL input gets more room */
    .btn-action .btn-label { display: none; }
    .btn-action { padding-left: 0.7rem; padding-right: 0.7rem; }

    /* Slightly smaller URL input font so long URLs don't get truncated as harshly */
    .input-group-lg > .form-control,
    .input-group-lg > .input-group-text { font-size: 0.95rem; }
}

/* Desktop / tablet: action buttons keep their text + comfortable padding */
.btn-action { padding-left: 1.25rem; padding-right: 1.25rem; }

@media (max-width: 768px) {
    /* Navbar: shrink brand text */
    .navbar-brand { font-size: 1rem; }

    /* History action buttons: tighter */
    .history-actions { gap: 0.25rem !important; }
}
