/* Stream-AI Workout Assistant - Light Mode Override & Theme Toggle */

/* ============================================
   LIGHT THEME VARIABLE OVERRIDES
   Since dark is the default in styles.css,
   this file provides light mode as the toggle.
   ============================================ */
[data-theme="light"] {
    /* Brand Colors - darkened for contrast on white.
       The user's accent hue/saturation carry over unchanged; only lightness
       changes, to the light-theme value graded in theme.py. A flat cap here
       wasn't enough: at a fixed 35% an intrinsically-bright hue like yellow
       lands at 2.29:1 on white, worse than the cyan that ships today. */
    --accent-l: var(--accent-l-light);

    --primary-color: hsl(var(--accent-hsl));
    --primary-dark: hsl(calc(var(--accent-h) + 3), var(--accent-s), calc(var(--accent-l) - 7%));
    --secondary-color: hsl(var(--secondary-hsl));
    --accent-color: hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) + 8%));
    --accent-warm: #EA580C;
    --success-color: #059669;
    --danger-color: #DC2626;
    --warning-color: #D97706;

    /* Gradients */
    --primary-gradient: linear-gradient(135deg, hsl(var(--accent-hsl)) 0%, hsl(var(--secondary-hsl)) 100%);
    --accent-gradient: linear-gradient(135deg, hsl(var(--accent-hsl)) 0%, hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) + 8%)) 50%, hsl(var(--secondary-hsl)) 100%);
    --dark-gradient: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    --card-gradient: linear-gradient(135deg, hsla(var(--accent-hsl), 0.03) 0%, hsla(var(--secondary-hsl), 0.03) 100%);

    /* Backgrounds */
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F5F9;
    --bg-glass: rgba(255, 255, 255, 0.85);

    /* Text */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-accent: var(--primary-color);
    /* Same token, this theme's ink. theme.py grades the light accent down to
       ~3:1 against the near-white page, so which label wins genuinely depends
       on the hue: the shipped cyan takes dark ink (5.4:1 vs 3.6:1), a navy or
       violet pick takes white (12.8:1 vs 1.5:1). The fallback is the dark ink
       the default cyan wants. */
    --on-accent: var(--on-accent-light, #0A0E17);

    /* Borders */
    --border-color: rgba(0, 0, 0, 0.08);
    --border-glow: hsla(var(--accent-hsl), 0.3);

    /* Surfaces */
    --card-bg: #FFFFFF;
    --input-bg: #FFFFFF;
    --navbar-bg: rgba(255, 255, 255, 0.92);

    /* Shadows - lighter for light mode */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);
    --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 0 rgba(0, 0, 0, 0);
    --shadow-glow-strong: 0 0 0 rgba(0, 0, 0, 0);

    /* Glass-morphism */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-blur: blur(20px);
}

/* ============================================
   LIGHT MODE BODY & GENERAL
   ============================================ */
[data-theme="light"] body {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ============================================
   LIGHT MODE NAVIGATION
   ============================================ */
[data-theme="light"] .navbar {
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .navbar-brand {
    color: var(--text-primary) !important;
}

[data-theme="light"] .navbar-brand img {
    filter: none;
}

[data-theme="light"] .nav-link {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .nav-link:hover {
    color: var(--text-primary) !important;
}

[data-theme="light"] .nav-link.active {
    color: var(--primary-color) !important;
}

/* …but not when the pill is FILLED with that same accent. This file loads after
   styles.css, so without this the rule above re-broke the active tab on light
   (measured 1.0:1 — literally invisible). Kept next to its sibling so the two
   are read together. */
[data-theme="light"] .nav-pills .nav-link.active,
[data-theme="light"] .profile-tabs .nav-link.active {
    color: var(--on-accent) !important;
}

[data-theme="light"] .navbar .btn {
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .navbar .btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="light"] .navbar-toggler {
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .navbar-toggler-icon {
    filter: none;
}

/* ============================================
   LIGHT MODE HERO SECTION
   ============================================ */
[data-theme="light"] #home-section {
    background:
        radial-gradient(ellipse at 20% 50%, hsla(var(--accent-hsl), 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, hsla(var(--secondary-hsl), 0.04) 0%, transparent 50%),
        var(--bg-primary);
}

/* ============================================
   LIGHT MODE CARDS
   ============================================ */
[data-theme="light"] .card {
    box-shadow: var(--shadow-md);
}

[data-theme="light"] .card:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* ============================================
   LIGHT MODE BUTTONS
   ============================================ */
[data-theme="light"] .btn-primary {
    color: var(--on-accent);
}

[data-theme="light"] .btn-primary:hover {
    color: var(--on-accent);
}

[data-theme="light"] .btn-outline-primary:hover {
    color: var(--on-accent);
}

/* --success-color / --warning-color are graded to sit on the DARK page; used as
   ink on a white card they measure 3.8:1 and 3.2:1. One step deeper each, same
   hue, back over AA. (--danger-color already clears it at 4.5.) */
[data-theme="light"] .btn-outline-success {
    color: #047857;
}

[data-theme="light"] .btn-outline-warning {
    color: #B45309;
}

/* Bootstrap's info cyan (#0dcaf0) is ~1.7:1 on a white card — fine on the dark
   default, unreadable the moment someone flips to light. Darken it to the same
   family at ~5:1. */
[data-theme="light"] .btn-outline-info {
    color: #05708A;
}

[data-theme="light"] .btn-outline-info:hover,
[data-theme="light"] .btn-outline-info:focus-visible {
    background: #05708A;
    border-color: #05708A;
    color: #FFFFFF;
}

[data-theme="light"] .btn-outline-light {
    border-color: rgba(0, 0, 0, 0.15);
    color: var(--text-primary);
}

[data-theme="light"] .btn-outline-light:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

/* ============================================
   LIGHT MODE INPUTS
   ============================================ */
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .form-control::placeholder {
    color: #94A3B8;
}

/* ============================================
   LIGHT MODE MODAL
   ============================================ */
[data-theme="light"] .btn-close {
    filter: none;
}

/* ============================================
   LIGHT MODE SCROLLBAR
   ============================================ */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

/* ============================================
   LIGHT MODE BADGES
   ============================================ */
[data-theme="light"] .badge.bg-primary {
    color: var(--on-accent);
}

/* White on amber measures 3.2:1 — the same washed-out label as the accent
   badge. Amber is light in both themes, so dark ink is the readable side. */
[data-theme="light"] .badge.bg-warning {
    color: #0A0E17;
}

/* ============================================
   LIGHT MODE FOOTER
   ============================================ */
[data-theme="light"] footer {
    background: #0F172A;
    color: #F1F5F9;
}

[data-theme="light"] footer h5 {
    color: #F1F5F9;
}

[data-theme="light"] footer a {
    color: #94A3B8;
}

[data-theme="light"] footer a:hover {
    color: var(--accent-color);
}

[data-theme="light"] footer .text-muted {
    color: #94A3B8 !important;
}

/* ============================================
   LIGHT MODE MISC
   ============================================ */
[data-theme="light"] .text-primary {
    color: var(--primary-color) !important;
}

[data-theme="light"] .text-dark {
    color: var(--text-primary) !important;
}

[data-theme="light"] .bg-light {
    background-color: var(--bg-tertiary) !important;
}

[data-theme="light"] .bg-white {
    background-color: #FFFFFF !important;
}

[data-theme="light"] .bg-dark {
    background-color: #0F172A !important;
}

[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] h5,
[data-theme="light"] h6 {
    color: var(--text-primary);
}

[data-theme="light"] p {
    color: var(--text-secondary);
}

[data-theme="light"] a {
    color: var(--primary-color);
}

[data-theme="light"] a:hover {
    color: var(--primary-dark);
}

[data-theme="light"] hr {
    border-color: rgba(0, 0, 0, 0.1);
}

/* ============================================
   THEME TOGGLE SWITCH
   ============================================ */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.theme-switch-label {
    font-size: 0.85rem;
    margin: 0 8px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}

.light-label {
    display: inline;
}

.dark-label {
    display: inline;
}

/* In dark mode (default), light label is dim */
.light-label {
    opacity: 0.5;
}

.dark-label {
    opacity: 1;
}

[data-theme="light"] .light-label {
    opacity: 1;
}

[data-theme="light"] .dark-label {
    opacity: 0.5;
}

.theme-switch {
    display: inline-block;
    height: 28px;
    position: relative;
    width: 52px;
}

.theme-switch input {
    display: none;
}

.slider {
    background: var(--primary-gradient);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: 0.4s;
    border-radius: 34px;
    box-shadow: var(--shadow-sm);
}

.slider:before {
    background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
    bottom: 4px;
    content: "";
    height: 20px;
    left: 4px;
    position: absolute;
    transition: 0.4s;
    width: 20px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* When checkbox is checked = light mode */
input:checked + .slider {
    background: rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider:before {
    transform: translateX(24px);
    background: linear-gradient(135deg, #ffffff 0%, #e5e7eb 100%);
}

.slider-icons {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.slider-icons.moon {
    left: 8px;
    color: #fbbf24;
    opacity: 1;
}

.slider-icons.sun {
    right: 8px;
    color: #fbbf24;
    opacity: 0;
}

input:checked + .slider .moon {
    opacity: 0;
}

input:checked + .slider .sun {
    opacity: 1;
}

/* ============================================
   SMOOTH TRANSITIONS FOR THEME SWITCH
   ============================================ */
body,
.card,
.btn,
.navbar,
.form-control,
.modal-content,
.dropdown-menu,
.list-group-item,
footer {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
