/* ---------- App theme tokens ---------- */
:root {
    --navbar-light-bg-color: #2196f3;  /* light mode navbar */
    --navbar-dark-bg-color: #212529;   /* dark mode navbar */
    --navbar-text-color: #ffffff;
    --video-table-max-height: 70vh;

    --dark-button-bg-color: #424242;
    --dark-button-text-color: #fafafa;

    --tag-badge-light-bg-color: #e0e0e0;
    --tag-badge-light-text-color: #212121;
    --tag-badge-dark-bg-color: var(--border_color);
    --tag-badge-dark-text-color: var(--menu_color);

    /* Kill Bootswatch gradients globally */
    --bs-gradient: none !important;
}

/* ---------- Navbar (flat, no gradient) ---------- */
.navbar {
    padding-top: .25rem;
    padding-bottom: .25rem;
    background-image: none !important;    /* belt & suspenders */
    box-shadow: none !important;
}
body[data-bs-theme='light'] .navbar {
    background-color: var(--navbar-light-bg-color) !important;
    color: var(--navbar-text-color);
}
body[data-bs-theme='dark'] .navbar {
    background-color: var(--navbar-dark-bg-color) !important;
    color: var(--navbar-text-color);
}

/* Ensure links are readable on both themes */
.navbar .navbar-brand,
.navbar .nav-link,
#theme-toggle {
    color: var(--navbar-text-color) !important;
}

/* ---------- Buttons (flat, no gradient) ---------- */
.btn {
    background-image: none !important;
    box-shadow: none !important;
}
body[data-bs-theme='dark'] .btn-light,
body[data-bs-theme='dark'] .btn-secondary {
    background-color: var(--dark-button-bg-color) !important;
    border-color: var(--dark-button-bg-color) !important;
    color: var(--dark-button-text-color) !important;
}

/* Theme toggle specific affordances */
#theme-toggle.btn {
    border-color: rgba(255,255,255,.6) !important;
}
#theme-toggle.btn:hover {
    border-color: rgba(255,255,255,.85) !important;
}

/* ---------- Misc content tweaks ---------- */
h1, h2, h3 { margin-top: .5rem; }

/* Gracefully hide broken avatar images (avoids inline onerror handler) */
.user-avatar {
    object-fit: cover;
}
.user-avatar::before {
    content: '';
    display: block;
}
.user-avatar:not([src]),
.user-avatar[src=''],
.user-avatar[src*='data:'] {
    /* Fallback when no avatar is available */
    display: none;
}

/* ---------- Spreadsheet change indicators ---------- */
.row-changed {
    background-color: rgba(255, 193, 7, 0.15) !important;
    border-left: 3px solid #ffc107 !important;
}

body[data-bs-theme='dark'] .row-changed {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

/* ---------- Changes Panel ---------- */
#changes-panel .card {
    border-color: #ffc107;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#changes-panel .card-header {
    background-color: #fff3cd;
    border-bottom-color: #ffc107;
}

body[data-bs-theme='dark'] #changes-panel .card-header {
    background-color: rgba(255, 193, 7, 0.2);
}

#changes-panel .table-responsive {
    max-height: 400px;
    overflow-y: auto;
}

#changes-panel code {
    font-size: 0.875rem;
}

#changes-panel .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ---------- Table container (ST-02: horizontal scroll) ---------- */
.table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
    margin: 1rem 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    max-height: var(--video-table-max-height);
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

body[data-bs-theme='dark'] .table-container {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Ensure table doesn't cause page overflow */
.table-container > div {
    min-width: 100%;
}

.table-container #video-table {
    flex: 1 1 auto;
    min-height: 0;
}

.table-container #video-table > div {
    height: 100%;
}

/* Keep table badges readable (videos.css uses these vars) */

/* ---------- MPR Footer Component (Reusable) ---------- */
.mpr-footer {
    margin-top: 3rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background-color: transparent;
}

body[data-bs-theme='dark'] .mpr-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.mpr-footer-link {
    color: inherit !important;
    opacity: 0.7;
    font-size: 0.875rem;
}

.mpr-footer-link:hover {
    opacity: 1;
    text-decoration: underline !important;
}

.mpr-footer .dropdown-menu {
    min-width: 250px;
}

.mpr-footer .dropdown-item {
    font-size: 0.875rem;
}

/* ---------- Landing page ---------- */

[x-cloak] {
    display: none !important;
}

.changes-panel table code {
    font-size: 0.85rem;
}

.landing-body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(180deg, rgba(18, 18, 18, 0.9) 0%, rgba(18, 18, 18, 0.85) 30%, #f8f9fa 70%);
    min-height: 100vh;
    color: #212529;
}

.landing-header {
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.landing-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #212529;
    text-decoration: none;
}

.landing-brand-icon {
    font-size: 1.5rem;
}

.landing-hero {
    color: #ffffff;
}

.landing-hero .container {
    position: relative;
    z-index: 2;
}

.landing-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(33, 150, 243, 0.35), transparent 55%),
                radial-gradient(circle at bottom right, rgba(3, 169, 244, 0.35), transparent 60%);
    z-index: 1;
}

.landing-hero-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    position: relative;
    overflow: hidden;
}

.landing-hero-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.landing-hero-card .card-body {
    position: relative;
    z-index: 1;
    color: #212529;
    background-color: rgba(255, 255, 255, 0.92);
}

.landing-hero-benefits {
    margin-bottom: 0;
}

.landing-hero-benefits li {
    align-items: flex-start;
}

.landing-check-icon {
    color: #28a745;
    font-weight: 600;
}

.landing-section {
    position: relative;
}

.landing-feature-card {
    border: none;
    border-radius: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.landing-feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 35px rgba(33, 37, 41, 0.1);
}

.landing-steps {
    counter-reset: landing-step-counter;
}

.landing-step-item {
    counter-increment: landing-step-counter;
    gap: 1rem;
}

.landing-step-index {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.125rem;
}

.landing-screen {
    border-radius: 1rem;
    background-color: #0f172a;
    color: #e2e8f0;
    padding: 1.5rem;
}

.landing-screen-header {
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.landing-screen-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.landing-screen-row {
    font-size: 0.95rem;
}

.landing-screen-actions .btn {
    border-radius: 999px;
}

.landing-footer {
    background-color: rgba(248, 249, 250, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.landing-footer-links a {
    font-size: 0.9rem;
}

@media (max-width: 767.98px) {
    .landing-hero {
        text-align: center;
    }
    .landing-body {
        background: linear-gradient(180deg, rgba(18, 18, 18, 0.92) 0%, rgba(18, 18, 18, 0.9) 45%, #f8f9fa 85%);
    }
    .landing-screen {
        margin-top: 2rem;
    }
}
