/* Base Variables & Settings */
:root {
    --brand-primary: #3B82F6;
    /* Modern Blue */
    --brand-secondary: #0ea5e9;
    --brand-success: #10b981;
    --brand-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.2);
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--brand-dark);
    background-color: #f8fafc;
    /* Cool gray background */
}

/* Glassmorphism Utilities */
.glassmorphism {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border) !important;
}

.glass-navbar {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Auth Page specific */
.auth-body {
    background: linear-gradient(135deg, #e0f2fe 0%, #f0fdf4 100%);
}

.brand-logo {
    max-height: 180px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.05);
}

.brand-title {
    color: var(--brand-dark);
    letter-spacing: -0.5px;
}

.btn-brand {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border: none;
    transition: all 0.3s ease;
}

.btn-brand:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

.bg-rose {
    background-color: #F43F5E !important;
}

.text-indigo {
    color: #6366F1 !important;
}

/* --- Visual Metaphors --- */

/* Salt Shaker */
.salt-shaker-container {
    height: 80px;
    width: 60px;
    background: #e5e7eb;
    border: 2px solid #374151;
    border-radius: 8px 8px 12px 12px;
    position: relative;
    overflow: hidden;
    margin: 10px auto;
}

.salt-shaker-cap {
    height: 12px;
    background: #4b5563;
    border-bottom: 2px solid #374151;
    position: relative;
}

.salt-shaker-cap::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 10%;
    width: 80%;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px rgba(255, 255, 255, 0.2);
}

.salt-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom, #fff, #f3f4f6);
    transition: height 1s ease-out;
}

.salt-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    opacity: 0.6;
}

/* Balance Scale */
.scale-container {
    width: 120px;
    height: 60px;
    position: relative;
    margin: 10px auto;
}

.scale-beam {
    width: 100%;
    height: 4px;
    background: #4b5563;
    border-radius: 2px;
    position: absolute;
    top: 20px;
    transform-origin: center center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-pivot {
    width: 12px;
    height: 12px;
    background: #1f2937;
    border-radius: 50%;
    position: absolute;
    top: 16px;
    left: 54px;
    z-index: 2;
}

.scale-pan {
    width: 30px;
    height: 4px;
    background: #4b5563;
    position: absolute;
    bottom: -15px;
}

.scale-pan-left {
    left: 0;
}

.scale-pan-right {
    right: 0;
}

.scale-cord {
    width: 1px;
    height: 15px;
    background: #9ca3af;
    position: absolute;
    top: 4px;
}

.scale-cord-left {
    left: 15px;
}

.scale-cord-right {
    right: 15px;
}

/* Gluten Shield */
.shield-container {
    font-size: 3rem;
    position: relative;
    display: inline-block;
}

.shield-fracture {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ef4444;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.5s;
}

.shield-cracked .shield-fracture {
    opacity: 1;
}

.shield-cracked i.bi-shield-fill {
    color: #fca5a5 !important;
}

/* Radar Scan */
.radar-container {
    width: 80px;
    height: 80px;
    border: 2px solid #10b981;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: rgba(16, 185, 129, 0.05);
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: conic-gradient(from 0deg, transparent 0%, rgba(16, 185, 129, 0.4) 100%);
    transform-origin: 0 0;
    animation: radar-spin 2s linear infinite;
}

@keyframes radar-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.radar-blip {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

/* Vitality Nexus (Growth Rings) */
.ring-container {
    width: 80px;
    height: 80px;
    position: relative;
}

.nexus-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid;
    border-radius: 50%;
}

.ring-inner {
    width: 30px;
    height: 30px;
    border-color: #fb7185;
}

.ring-mid {
    width: 55px;
    height: 55px;
    border-color: #f43f5e;
    opacity: 0.6;
}

.ring-outer {
    width: 80px;
    height: 80px;
    border-color: #be123c;
    opacity: 0.3;
}

/* Lipid Labyrinth */
.labyrinth-container {
    width: 100px;
    height: 80px;
    position: relative;
    padding: 5px;
}

.labyrinth-path {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 10px, transparent 10px, transparent 20px);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.labyrinth-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(239, 68, 68, 0.4), rgba(245, 158, 11, 0.2));
    transition: height 1s ease-in-out;
}

/* Warning Beacon */
.beacon-container {
    width: 60px;
    height: 80px;
    position: relative;
    margin: 5px auto;
}

.beacon-tower {
    width: 30px;
    height: 60px;
    background: #4b5563;
    margin: 0 auto;
    border-radius: 4px 4px 0 0;
    position: relative;
}

.beacon-light {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 12px;
    background: #10b981;
    border-radius: 2px;
    box-shadow: 0 0 15px #10b981;
}

.beacon-alert .beacon-light {
    background: #ef4444;
    box-shadow: 0 0 20px #ef4444;
    animation: beacon-blink 1s infinite;
}

@keyframes beacon-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Nutritional Compass */
.compass-container {
    width: 80px;
    height: 80px;
    border: 3px solid #6366f1;
    border-radius: 50%;
    position: relative;
    margin: 10px auto;
    background: white;
}

.compass-needle {
    position: absolute;
    top: 10px;
    left: 38px;
    width: 4px;
    height: 30px;
    background: #6366f1;
    transform-origin: bottom center;
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.compass-needle::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -3px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #6366f1;
}

.compass-mark {
    position: absolute;
    font-size: 0.5rem;
    font-weight: bold;
    color: #94a3b8;
}

.mark-n {
    top: 2px;
    left: 36px;
}

.mark-e {
    top: 35px;
    right: 2px;
}

.mark-s {
    bottom: 2px;
    left: 36px;
}

.mark-w {
    top: 35px;
    left: 2px;
}

/* Form inputs styling */
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

.form-floating label {
    color: #64748b;
}

/* Dashboard specific */
.brand-text {
    background: -webkit-linear-gradient(45deg, var(--brand-primary), var(--brand-success));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.25rem;
}

/* Alert text wrapping */
.alert {
    word-break: break-all;
}

/* Custom Table Design */
.custom-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.custom-table td {
    padding-top: 1rem;
    padding-bottom: 1rem;
    vertical-align: middle;
    color: #475569;
}

.custom-table tbody tr {
    transition: all 0.2s ease;
}

.custom-table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Action Buttons in Table */
.btn-action {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-action:hover {
    transform: scale(1.1);
}

.badge-role {
    font-weight: 600;
    padding: 0.4em 0.8em;
    border-radius: 6px;
}

.badge-Admin {
    background-color: #fee2e2;
    color: #ef4444;
}

.badge-Pro {
    background-color: #dbeafe;
    color: #3b82f6;
}

.badge-Basic {
    background-color: #e0e7ff;
    color: #6366f1;
}

.badge-Yearly {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-Family {
    background-color: #fce7f3;
    color: #db2777;
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] body {
    color: #f8fafc;
    background-color: #0f172a !important;
}

[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-white {
    background-color: #0f172a !important;
}

[data-bs-theme="dark"] .auth-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

[data-bs-theme="dark"] .glassmorphism,
[data-bs-theme="dark"] .glass-navbar {
    background: rgba(30, 41, 59, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .text-dark,
[data-bs-theme="dark"] .navbar-brand .brand-title {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .navbar-brand img {
    filter: invert(1) hue-rotate(180deg) brightness(1.2);
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .modal-content {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .custom-table th {
    border-bottom-color: #334155;
    background-color: #0f172a !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .custom-table td {
    color: #cbd5e1;
    border-bottom-color: #334155;
}

[data-bs-theme="dark"] .custom-table tbody tr {
    background-color: #1e293b;
}

[data-bs-theme="dark"] .custom-table tbody tr:hover {
    background-color: #334155;
}

[data-bs-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .form-floating label,
[data-bs-theme="dark"] .form-label {
    color: #94a3b8;
}

/* Ensure inputs use Bootstrap's dark theme variables properly or override */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #0f172a;
    color: #f8fafc;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #334155;
    color: #f8fafc;
}

/* Theme Dropdown Styles */
.theme-dropdown {
    position: relative;
}

.theme-dropdown-btn {
    background: transparent;
    border: none;
    color: #64748b; /* --gray equivalent in styles.css */
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.theme-dropdown-btn:hover {
    color: var(--brand-dark);
}

[data-bs-theme="dark"] .theme-dropdown-btn {
    color: #94a3b8;
}

[data-bs-theme="dark"] .theme-dropdown-btn:hover {
    color: #f8fafc;
}

.theme-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 140px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 8px 0;
    margin-top: 8px;
    list-style: none;
    display: none;
    z-index: 1050; /* Above navbar */
    border: 1px solid #e2e8f0; /* --border equivalent */
}

.theme-dropdown .dropdown-menu.show {
    display: block;
}

.theme-dropdown .dropdown-item {
    width: 100%;
    text-align: left;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--brand-dark);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s, color 0.2s;
}

.theme-dropdown .dropdown-item svg {
    margin-right: 12px;
}

.theme-dropdown .dropdown-item:hover,
.theme-dropdown .dropdown-item.active {
    background: #f1f5f9; /* --light-bg equivalent */
    color: var(--brand-primary);
}

[data-bs-theme="dark"] .theme-dropdown .dropdown-item {
    color: #f8fafc;
}

[data-bs-theme="dark"] .theme-dropdown .dropdown-item:hover,
[data-bs-theme="dark"] .theme-dropdown .dropdown-item.active {
    background: #334155;
    color: #f8fafc;
}

/* ── Weekly Evaluation: Colored Card Headers ─────────────────────────── */
.wr-card-header {
    padding: 0.55rem 1rem;
    border-radius: 0;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(0, 0, 0, 0.10);
    flex-shrink: 0;
}

/* Safety Score — Blue */
.wr-header-blue {
    background-color: #dbeafe;
    color: #1d4ed8;
}

/* Search Activity — Indigo */
.wr-header-indigo {
    background-color: #e0e7ff;
    color: #4338ca;
}

/* Dynamic: Danger variants (diabetes, heart, kidney, weight, allergen) — Red */
.wr-header-red {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Dynamic: Warning variants (gluten, pregnancy) — Amber */
.wr-header-amber {
    background-color: #fef3c7;
    color: #b45309;
}

/* Top Categories — Teal */
.wr-header-teal {
    background-color: #ccfbf1;
    color: #0f766e;
}

/* Avg. Nutrition — Green */
.wr-header-green {
    background-color: #dcfce7;
    color: #15803d;
}

/* Recent Avoids — Rose */
.wr-header-rose {
    background-color: #ffe4e6;
    color: #be123c;
}

/* Meal Prep (Athlete) — Orange */
.wr-header-orange {
    background-color: #ffedd5;
    color: #c2410c;
}

/* Dark-mode overrides */
[data-bs-theme="dark"] .wr-header-blue {
    background-color: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .wr-header-indigo {
    background-color: rgba(99, 102, 241, 0.18);
    color: #a5b4fc;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .wr-header-red {
    background-color: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .wr-header-amber {
    background-color: rgba(217, 119, 6, 0.18);
    color: #fcd34d;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .wr-header-teal {
    background-color: rgba(20, 184, 166, 0.18);
    color: #5eead4;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .wr-header-green {
    background-color: rgba(34, 197, 94, 0.18);
    color: #86efac;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .wr-header-rose {
    background-color: rgba(244, 63, 94, 0.18);
    color: #fda4af;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .wr-header-orange {
    background-color: rgba(249, 115, 22, 0.18);
    color: #fdba74;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* ── Weekly Evaluation: Matching Card Borders ────────────────────────── */
.wr-card-blue {
    border-color: #93c5fd !important;
}

.wr-card-indigo {
    border-color: #e0e7ff !important;
}

.wr-card-red {
    border-color: #fca5a5 !important;
}

.wr-card-amber {
    border-color: #fcd34d !important;
}

.wr-card-teal {
    border-color: #5eead4 !important;
}

.wr-card-green {
    border-color: #86efac !important;
}

.wr-card-rose {
    border-color: #fda4af !important;
}

.wr-card-orange {
    border-color: #fdba74 !important;
}

/* Dark mode — slightly more opaque so borders remain visible */
[data-bs-theme="dark"] .wr-card-blue {
    border-color: rgba(59, 130, 246, 0.45) !important;
}

[data-bs-theme="dark"] .wr-card-indigo {
    border-color: rgba(99, 102, 241, 0.18) !important;
}

[data-bs-theme="dark"] .wr-card-red {
    border-color: rgba(239, 68, 68, 0.45) !important;
}

[data-bs-theme="dark"] .wr-card-amber {
    border-color: rgba(217, 119, 6, 0.45) !important;
}

[data-bs-theme="dark"] .wr-card-teal {
    border-color: rgba(20, 184, 166, 0.45) !important;
}

[data-bs-theme="dark"] .wr-card-green {
    border-color: rgba(34, 197, 94, 0.45) !important;
}

[data-bs-theme="dark"] .wr-card-rose {
    border-color: rgba(244, 63, 94, 0.45) !important;
}

[data-bs-theme="dark"] .wr-card-orange {
    border-color: rgba(249, 115, 22, 0.45) !important;
}

/* ── Weekly Evaluation: Avg. Nutrition Tiles ────────────────────────── */
.wr-nutri-tiles {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.letter-spacing-lg {
    letter-spacing: 0.12em;
}

[data-bs-theme="dark"] .progress {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.wr-left-column-grid {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
    height: 100%;
}

.wr-nutri-tile {
    flex: 1;
    border-radius: 0.75rem;
    padding: 0.75rem 0.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.wr-nutri-tile .nt-icon {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.wr-nutri-tile .nt-label {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.wr-nutri-tile .nt-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--brand-dark);
}

.wr-nutri-tile .nt-unit {
    font-size: 0.6rem;
    color: #64748b;
    margin-top: 0.15rem;
}

/* Tile colour palettes */
.nt-red {
    background-color: #fee2e2;
}

.nt-red .nt-label,
.nt-red .nt-icon {
    color: #ef4444;
}

.nt-yellow {
    background-color: #fef9c3;
}

.nt-yellow .nt-label,
.nt-yellow .nt-icon {
    color: #ca8a04;
}

.nt-blue {
    background-color: #dbeafe;
}

.nt-blue .nt-label,
.nt-blue .nt-icon {
    color: #3b82f6;
}

.nt-green {
    background-color: #dcfce7;
}

.nt-green .nt-label,
.nt-green .nt-icon {
    color: #22c55e;
}

.nt-purple {
    background-color: #ede9fe;
}

.nt-purple .nt-label,
.nt-purple .nt-icon {
    color: #7c3aed;
}

.nt-orange {
    background-color: #ffedd5;
}

.nt-orange .nt-label,
.nt-orange .nt-icon {
    color: #f97316;
}

.nt-teal {
    background-color: #ccfbf1;
}

.nt-teal .nt-label,
.nt-teal .nt-icon {
    color: #0d9488;
}

/* Dark mode tile overrides for a premium, high-contrast look */
[data-bs-theme="dark"] .wr-nutri-tile {
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .nt-red {
    border-top: 3px solid #ef4444 !important;
}

[data-bs-theme="dark"] .nt-red .nt-value {
    color: #f87171;
}

[data-bs-theme="dark"] .nt-red .nt-icon {
    color: #f87171;
}

[data-bs-theme="dark"] .nt-yellow {
    border-top: 3px solid #f59e0b !important;
}

[data-bs-theme="dark"] .nt-yellow .nt-value {
    color: #fbbf24;
}

[data-bs-theme="dark"] .nt-yellow .nt-icon {
    color: #fbbf24;
}

[data-bs-theme="dark"] .nt-blue {
    border-top: 3px solid #3b82f6 !important;
}

[data-bs-theme="dark"] .nt-blue .nt-value {
    color: #60a5fa;
}

[data-bs-theme="dark"] .nt-blue .nt-icon {
    color: #60a5fa;
}

[data-bs-theme="dark"] .nt-green {
    border-top: 3px solid #10b981 !important;
}

[data-bs-theme="dark"] .nt-green .nt-value {
    color: #34d399;
}

[data-bs-theme="dark"] .nt-green .nt-icon {
    color: #34d399;
}

[data-bs-theme="dark"] .nt-purple {
    border-top: 3px solid #8b5cf6 !important;
}

[data-bs-theme="dark"] .nt-purple .nt-value {
    color: #a78bfa;
}

[data-bs-theme="dark"] .nt-purple .nt-icon {
    color: #a78bfa;
}

[data-bs-theme="dark"] .nt-orange {
    border-top: 3px solid #f97316 !important;
}

[data-bs-theme="dark"] .nt-orange .nt-value {
    color: #fb923c;
}

[data-bs-theme="dark"] .nt-orange .nt-icon {
    color: #fb923c;
}

[data-bs-theme="dark"] .nt-teal {
    border-top: 3px solid #14b8a6 !important;
}

[data-bs-theme="dark"] .nt-teal .nt-value {
    color: #2dd4bf;
}

[data-bs-theme="dark"] .nt-teal .nt-icon {
    color: #2dd4bf;
}

[data-bs-theme="dark"] .wr-nutri-tile .nt-label {
    opacity: 0.85;
}

[data-bs-theme="dark"] .wr-nutri-tile .nt-unit {
    color: #94a3b8;
}

[data-bs-theme="dark"] .nt-teal .nt-value {
    color: #5eead4;
}

[data-bs-theme="dark"] .text-secondary {
    color: #cbd5e1 !important;
}

/* ── Print Styles ──────────────────────────────────────────────────────── */
@media print {

    /* Reset height and overflow for printing */
    html,
    body {
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Hide everything except the Weekly Evaluation Modal */
    body>*:not(#weeklyReportModal) {
        display: none !important;
    }

    /* Hide redundant elements within the modal */
    .modal-backdrop,
    .modal-header .btn,
    .modal-header .btn-close,
    .modal-footer,
    script,
    nav {
        display: none !important;
    }

    /* Target the Weekly Report Modal exclusively */
    #weeklyReportModal,
    #weeklyReportModal * {
        visibility: visible !important;
    }

    /* Positioning and sizing */
    #weeklyReportModal {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 1 !important;
    }

    .modal-dialog {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .modal-content {
        border: none !important;
        box-shadow: none !important;
        width: 100% !important;
        background: white !important;
        color: black !important;
    }

    /* Ensure backgrounds and colors print correctly */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .wr-card-header,
    .wr-nutri-tile,
    .progress-bar,
    .badge {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Layout tweaks for paper */
    .row {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .col-md-6,
    .col-lg-6 {
        width: 50% !important;
        flex: 0 0 50% !important;
    }

    .col-md-4,
    .col-lg-4 {
        width: 33.33% !important;
        flex: 0 0 33.33% !important;
    }

    .col-md-8,
    .col-lg-8 {
        width: 66.66% !important;
        flex: 0 0 66.66% !important;
    }

    .col-sm-4 {
        width: 33.33% !important;
        flex: 0 0 33.33% !important;
    }

    .card {
        page-break-inside: avoid !important;
        margin-bottom: 20px !important;
        border: 1px solid #ddd !important;
    }

    /* Force Light Mode Aesthetics for printing */
    [data-bs-theme="dark"] .modal-content {
        background-color: #ffffff !important;
        color: #0f172a !important;
    }

    [data-bs-theme="dark"] .text-muted {
        color: #64748b !important;
    }
}

/* ── Mobile Responsiveness ─────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .glass-navbar .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .brand-text {
        font-size: 1.16rem;
    }

    .navbar-brand img {
        width: 120px !important;
    }

    .card-body {
        padding: 1.25rem !important;
    }

    h2, .fs-2 { font-size: 1.5rem !important; }
    h4, .fs-4 { font-size: 1.25rem !important; }

    /* Fix for oversized navbar toggler */
    .navbar-toggler {
        padding: 0.5rem 0.6rem !important;
        font-size: 1rem !important;
        border-radius: 12px !important;
        background-color: var(--light-bg) !important;
        border: 2px solid var(--border) !important;
        box-shadow: none !important;
    }

    [data-bs-theme="dark"] .navbar-toggler {
        background-color: #1e293b !important;
        border-color: #334155 !important;
    }

    /* Fix for cramped search tabs */
    .nav-pills {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
    }

    .nav-pills .nav-link {
        white-space: nowrap;
        padding: 0.6rem 1.25rem !important;
        font-size: 0.88rem !important;
    }

    /* Fix for cut-off input placeholders */
    #barcodeSearchForm .position-relative,
    #nameSearchForm .position-relative {
        margin-bottom: 0.5rem;
    }

    .form-control-lg.rounded-pill.ps-5 {
        padding-left: 2.75rem !important;
        padding-right: 1.25rem !important;
        font-size: 0.95rem !important;
    }

    /* Adjust barcode/search icon position on mobile */
    .bi-upc-scan.position-absolute,
    .bi-search.position-absolute {
        left: 0.75rem !important;
        width: 18px !important;
        height: 18px !important;
    }

    /* Stacking search form buttons on small screens */
    #barcodeSearchForm, #nameSearchForm {
        flex-direction: column !important;
    }

    #barcodeSearchForm button, #nameSearchForm button {
        width: 100%;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        font-size: 1rem !important;
    }

    /* Fix for profile card icon overflow */
    .profile-item {
        flex-wrap: wrap !important;
        gap: 1rem !important;
        padding: 1.25rem !important;
    }

    .profile-info-wrapper {
        width: 100% !important;
        flex-grow: 1;
    }

    .profile-actions-wrapper {
        width: 100% !important;
        justify-content: flex-end !important;
        padding-top: 0.75rem;
        border-top: 1px dashed rgba(0,0,0,0.05);
    }

    [data-bs-theme="dark"] .profile-actions-wrapper {
        border-top-color: rgba(255,255,255,0.05);
    }

    /* Admin Search Bar stacking */
    .admin-filter-row > div {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 767.98px) {
    .nav-pills .nav-link {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        font-size: 0.85rem;
    }
}

/* ── Dashboard Mobile Navbar Fixes ────────────────────────────────── */
@media (max-width: 991.98px) {
    .navbar-collapse {
        max-height: 85vh;
        overflow-y: auto;
        padding-bottom: 1rem;
    }

    .navbar-nav .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin-top: 0.5rem;
        background-color: rgba(0, 0, 0, 0.03) !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        box-shadow: none !important;
        padding-left: 0.5rem;
        transform: none !important;
    }

    [data-bs-theme="dark"] .navbar-nav .dropdown-menu {
        background-color: rgba(255, 255, 255, 0.05) !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }

    .navbar-nav .dropdown-item {
        padding: 0.75rem 1rem;
    }
}
/* Auth Card Top Actions */
.auth-card {
    position: relative;
    overflow: visible !important;
}

.auth-actions-top {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

.auth-icon-link {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.auth-icon-link i {
    font-size: 1.1rem;
}

.auth-icon-link:hover {
    transform: translateY(-3px);
    background: var(--brand-primary);
    color: white;
    box-shadow: 0 8px 15px rgba(59, 130, 246, 0.2);
}

[data-bs-theme="dark"] .auth-icon-link {
    background: rgba(30, 41, 59, 0.5);
    color: #3ab0ec;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .auth-icon-link:hover {
    background: #3ab0ec;
    color: #1e293b;
}

/* ── Collapsible Icon & Label Rotation ────────────────────────── */
[data-bs-toggle="collapse"] .collapse-icon {
    transition: transform 0.3s ease;
}

[data-bs-toggle="collapse"].collapsed .collapse-icon {
    transform: rotate(-180deg);
}

[data-bs-toggle="collapse"] .show-label {
    display: none;
}

[data-bs-toggle="collapse"].collapsed .show-label {
    display: inline;
}

[data-bs-toggle="collapse"] .hide-label {
    display: inline;
}

[data-bs-toggle="collapse"].collapsed .hide-label {
    display: none;
}
/* ── Product Detail Scroll Containers ────────────────────────── */
.product-detail-scroll-container {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    position: relative;
}

/* Custom Scrollbar for a premium look */
.product-detail-scroll-container::-webkit-scrollbar {
    width: 5px;
}

.product-detail-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.product-detail-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.product-detail-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

[data-bs-theme="dark"] .product-detail-scroll-container::-webkit-scrollbar-thumb {
    background: #334155;
}

[data-bs-theme="dark"] .product-detail-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ── Nutrition Facts Table ────────────────────────── */
.nutrition-facts-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9rem;
}

.nutrition-facts-table tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s;
}

.nutrition-facts-table tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.nutrition-facts-table td {
    padding: 10px 12px;
}

.nutrition-facts-table td:last-child {
    text-align: right;
    font-weight: 700;
}

.nutrition-facts-label {
    color: #475569;
    font-weight: 500;
}

.nutrition-facts-sublabel {
    padding-left: 20px;
    font-size: 0.85rem;
    color: #64748b;
}

body.dark-theme .nutrition-facts-table tr {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .nutrition-facts-table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

body.dark-theme .nutrition-facts-label {
    color: #cbd5e1;
}

body.dark-theme .nutrition-facts-sublabel {
    color: #94a3b8;
}

.nutrition-facts-footer {
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
    padding: 10px;
    font-style: italic;
}
