/* ========================================
   Trainer Sync - Professional CSS v2.0
   Modern UI/UX with Dark Mode Support
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* --- Color Palette (Modern Indigo/Violet) --- */
    --primary-hue: 245;
    --primary-sat: 80%;
    --primary-lig: 60%;
    
    --primary: hsl(var(--primary-hue), var(--primary-sat), var(--primary-lig));
    --primary-dark: hsl(var(--primary-hue), var(--primary-sat), 45%);
    --primary-light: hsl(var(--primary-hue), var(--primary-sat), 96%);
    --primary-subtle: hsl(var(--primary-hue), var(--primary-sat), 90%);
    
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    
    /* --- Surfaces & Backgrounds --- */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-surface: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-input: #ffffff;
    
    /* --- Borders & Dividers --- */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    /* --- Typography --- */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-on-primary: #ffffff;
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', var(--font-sans);
    
    /* --- Shadows (Smooth & Layered) --- */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-primary: 0 10px 25px -5px hsla(var(--primary-hue), var(--primary-sat), var(--primary-lig), 0.4);
    
    /* --- Radius --- */
    --radius-sm: 0.5rem;
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* --- Transitions --- */
    --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
    --primary-hue: 245;
    --primary-sat: 70%;
    --primary-lig: 65%;
    
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-surface: #1e293b;
    --bg-hover: #334155;
    --bg-input: #1e293b;
    
    --border-color: #334155;
    --border-hover: #475569;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* ========== RESET & BASE ========== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-base);
}

a:hover {
    color: var(--primary-dark);
}

/* ========== UTILITIES ========== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .bg-glass {
    background: rgba(15, 23, 42, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.shadow-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========== NAVBAR ========== */
.navbar {
    padding: 0.4rem 0;
    transition: var(--transition-smooth);
}

.glass-nav {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .glass-nav {
    background: rgba(30, 41, 59, 0.85) !important;
    border-bottom: 1px solid var(--border-color);
}

.navbar-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary) !important;
    letter-spacing: -0.03em;
}
[data-theme="dark"] .navbar-brand {
    color: var(--primary) !important;
}

/* Mobile brand/toggler wrapper */
.nav-mobile-wrap { display:flex; align-items:center; }

/* Notification icon outside collapse (mobile) */
.nav-notification-mobile {
    display: flex;
    align-items: center;
    padding: 0.25rem;
    position: relative;
}

.nav-notification-mobile .nav-link {
    padding: 0.35rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Center notification dropdown on mobile */
@media (max-width: 991.98px) {
    #notificationDropdownMobile + .dropdown-menu {
        position: fixed !important;
        top: 70px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        width: 90vw !important;
        max-width: 380px !important;
    }
}

@media (max-width: 991.98px) {
    .nav-mobile-wrap {
        background: transparent;
        border: none;
        border-radius: var(--radius-lg);
        padding: .35rem .2rem .35rem .2rem;
        box-shadow: none;
        position: relative;
    }
    [data-theme="dark"] .nav-mobile-wrap {
        background: transparent;
    }
    .nav-mobile-wrap .navbar-toggler {
        margin-left: .25rem;
        margin-right: .25rem;
    }
    .nav-mobile-wrap .navbar-brand {
        font-size: 1.1rem;
        padding: 0 .25rem;
        display: flex;
        align-items: center;
        margin-bottom: 0;
    }
    
    /* Ensure notification icon aligns properly */
    .nav-notification-mobile {
        margin-left: 0.5rem;
    }
}

/* Explicit hamburger visibility for mobile (override glass effects) */
.navbar-toggler {
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.15);
}

.navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255,255,255,0.9)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}

/* Mejor visibilidad de líneas en wrapper claro (light mode) */
.nav-mobile-wrap .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}
.nav-mobile-wrap .navbar-toggler:focus .navbar-toggler-icon,
.nav-mobile-wrap .navbar-toggler:hover .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

[data-theme="dark"] .navbar-toggler {
    background: rgba(30,41,59,0.4);
    border-color: var(--border-color);
}
[data-theme="dark"] .navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255,255,255,0.85)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}
[data-theme="dark"] .nav-mobile-wrap .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255,255,255,0.85)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* Mobile avatar toggle styling */
.mobile-avatar-toggle {
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition-base);
}
.mobile-avatar-toggle:hover,
.mobile-avatar-toggle:focus {
    background: rgba(255,255,255,0.1);
    transform: scale(1.05);
}
.mobile-avatar-toggle .avatar-circle {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary) !important;
    padding: 0.35rem 0.75rem !important;
    border-radius: var(--radius);
    transition: var(--transition-base);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary) !important;
    background: var(--primary-light);
}

[data-theme="dark"] .nav-link:hover, 
[data-theme="dark"] .nav-link.active {
    background: rgba(255, 255, 255, 0.05);
}

/* ========== HERO SECTION ========== */
.hero-section {
    position: relative;
    padding: 6rem 0 4rem;
    overflow: hidden;
}

.hero-ornaments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
}

.blob-1 {
    top: -10%;
    right: -5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary-subtle), transparent);
}

.blob-2 {
    bottom: -10%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #e0e7ff, transparent);
}

[data-theme="dark"] .blob-1 {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent);
}

[data-theme="dark"] .blob-2 {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent);
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-subtle);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.card-body {
    padding: 1.25rem;
}

.card-spotlight {
    position: relative;
    overflow: hidden;
    --x: 0px;
    --y: 0px;
}

.card-spotlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(600px circle at var(--x) var(--y), rgba(99, 102, 241, 0.1), transparent 40%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 1;
}

.card-spotlight:hover::before {
    opacity: 1;
}

/* ========== AUTH PAGES ========== */
.bg-auth {
    background-image: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 20%),
                      radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 20%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .bg-auth {
    background-image: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 20%),
                      radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 20%);
}

/* ========== BOOTSTRAP DARK MODE OVERRIDES ========== */
[data-theme="dark"] .bg-light {
    background-color: var(--bg-body) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .bg-white {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .border-top, 
[data-theme="dark"] .border-bottom, 
[data-theme="dark"] .border-start, 
[data-theme="dark"] .border-end {
    border-color: var(--border-color) !important;
}

/* Fix for tables */
[data-theme="dark"] .table {
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .table-light {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dark"] .table-light th,
[data-theme="dark"] .table-light td {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .table-hover tbody tr:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

/* ========== DROPDOWN MENU IMPROVEMENTS ========== */
.dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    padding: 0.5rem;
    min-width: 220px;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    transition: var(--transition-base);
    font-size: 0.9375rem;
    font-weight: 500;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--bg-hover);
}

.dropdown-item i {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    vertical-align: middle;
}

.dropdown-divider {
    margin: 0.5rem 0;
    opacity: 1;
    border-color: var(--border-color);
}

/* Mobile-specific dropdown improvements */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        margin-top: 1rem;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
    }
    
    .navbar-collapse .navbar-nav {
        gap: 0.5rem;
    }
    
    .navbar-collapse .nav-item {
        width: 100%;
    }
    
    .navbar-collapse .dropdown-menu {
        border: none;
        box-shadow: none;
        background: transparent;
        padding: 0.5rem 0;
        margin-top: 0.25rem;
        margin-bottom: 0.5rem;
        position: static !important;
        transform: none !important;
        display: block !important;
    }
    
    .navbar-collapse .dropdown-item {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        background: var(--bg-hover);
        margin-bottom: 0.25rem;
        border-radius: var(--radius-sm);
    }
    
    .navbar-collapse .dropdown-item:hover {
        background: var(--bg-input);
    }
    
    .navbar-collapse .dropdown-toggle {
        pointer-events: none;
    }
    
    .navbar-collapse .dropdown-toggle::after {
        display: none;
    }
    
    .navbar-collapse .nav-link {
        padding: 0.75rem 1rem !important;
        border-radius: var(--radius-sm);
    }
}

/* Dark mode adjustments */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-divider {
    border-color: var(--border-color);
}

[data-theme="dark"] .navbar-collapse {
    background: var(--bg-card);
    border-color: var(--border-color);
}

/* Hover effect for links */
.hover-primary:hover {
    color: var(--primary) !important;
    text-decoration: underline !important;
}

/* Fix for modals */
[data-theme="dark"] .modal-content {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Fix for list groups */
[data-theme="dark"] .list-group-item {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Fix for accordions */
[data-theme="dark"] .accordion-item {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .accordion-button {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: var(--bg-hover);
    color: var(--primary);
    box-shadow: inset 0 -1px 0 var(--border-color);
}

[data-theme="dark"] .accordion-button::after {
    filter: invert(1);
}

/* ========== BUTTONS ========== */
.btn {
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: var(--transition-base);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-gradient {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-gradient:hover {
    background: linear-gradient(135deg, var(--primary-dark), #6d28d9);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}

/* ========== FORMS ========== */
.form-control, .form-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius);
    padding: 0.6rem 0.875rem;
    transition: var(--transition-base);
    font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
    outline: none;
}

[data-theme="dark"] .form-control:focus, 
[data-theme="dark"] .form-select:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-label {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ========== SIDEBAR ========== */
.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    padding-top: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

.sidebar-profile {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

[data-theme="dark"] .sidebar-profile {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, var(--bg-card) 100%);
}

.sidebar-profile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========== AVATARS ========== */
.avatar-circle {
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-subtle) 100%);
    color: var(--primary);
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    border: 2px solid var(--bg-card);
    transition: var(--transition-smooth);
}

[data-theme="dark"] .avatar-circle {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0.1) 100%);
    border-color: var(--bg-surface);
}

.avatar-circle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-lg { width: 56px; height: 56px; font-size: 1.5rem; }
.avatar-md { width: 36px; height: 36px; font-size: 0.95rem; }
.avatar-sm { width: 26px; height: 26px; font-size: 0.7rem; }

.status-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 10px;
    height: 10px;
    background: var(--success);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.sidebar .nav-link {
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: var(--transition-smooth);
    font-weight: 500;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.sidebar .nav-link i {
    font-size: 1rem;
    transition: var(--transition-smooth);
}

.sidebar .nav-link:hover {
    background: var(--bg-hover);
    color: var(--primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.sidebar .nav-link:hover i {
    transform: scale(1.1);
}

.sidebar .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

[data-theme="dark"] .sidebar .nav-link.active {
    background: rgba(99, 102, 241, 0.15);
}

.sidebar-heading {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 0.75rem 0 0.35rem;
}

.sidebar-footer {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.75rem;
}

.sidebar-footer .btn {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.4rem 0.6rem;
    transition: var(--transition-smooth);
}

.sidebar-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ========== TABLES ========== */
.table {
    color: var(--text-primary);
    border-color: var(--border-color);
}

.table > :not(caption) > * > * {
    background-color: transparent;
    border-bottom-color: var(--border-color);
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
}

.table thead th {
    background-color: var(--bg-hover);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

/* ========== BADGES ========== */
.badge {
    padding: 0.3em 0.6em;
    font-weight: 600;
    border-radius: 0.375rem;
    font-size: 0.75rem;
}

.bg-primary-subtle {
    background-color: var(--primary-light) !important;
    color: var(--primary) !important;
}

[data-theme="dark"] .bg-primary-subtle {
    background-color: rgba(99, 102, 241, 0.15) !important;
    color: #818cf8 !important;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1045;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

/* ========== EXERCISE CARDS ========== */
.exercise-card {
    transition: var(--transition-smooth);
    background: var(--bg-card);
}

.exercise-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.exercise-card.border-success {
    border-width: 2px !important;
    border-color: var(--success) !important;
    background-color: rgba(16, 185, 129, 0.05) !important;
}

.btn-status {
    min-width: 38px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition-base);
}

@media (max-width: 768px) {
    .exercise-card { margin-bottom: 1rem !important; }
    .exercise-card .row { position: relative; }
    /* Stack columns and move actions below details on mobile */
    .exercise-card .col-3, .exercise-card .col-7 { width: 100%; max-width: 100%; flex: 0 0 100%; }
    .exercise-card .col-3 { margin-bottom: 0.75rem; }
    .exercise-card .col-7 { padding-right: 0; }
    .exercise-card .col-2 { position: static; width: 100%; padding-right: 0; margin-top: 0.5rem; }
    .exercise-card .col-2.text-end { text-align: right !important; }
    /* Render vertical group horizontally on mobile */
    .exercise-card .btn-group-vertical { display: inline-flex; flex-direction: row; gap: 0.4rem; }
    .exercise-card .btn-group-vertical .btn { width: 42px; height: 42px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
    .btn-group-vertical { gap: 0.25rem; }
    .btn-status { min-width: 42px; min-height: 42px; font-size: 1rem; }
    .exercise-card h6 { font-size: 0.95rem; }
    .exercise-card .small { font-size: 0.8rem; }
    .accordion-button { font-size: 0.95rem; padding: 0.75rem 1rem; }
    .modal-lg { max-width: 95%; margin: 0.5rem auto; }
}

@media (max-width: 576px) {
    .btn-status { min-width: 40px; min-height: 40px; }
    .exercise-card img { max-height: 80px !important; }
}

/* ========== LOGO THEME SWITCHING ========== */
.logo-light-mode, .logo-dark-mode {
    transition: opacity 0.3s ease;
}

[data-theme="light"] .logo-dark-mode,
[data-bs-theme="light"] .logo-dark-mode {
    display: none !important;
}

[data-theme="dark"] .logo-light-mode,
[data-bs-theme="dark"] .logo-light-mode {
    display: none !important;
}

/* Default to light mode behavior if attribute is missing */
:root:not([data-theme]):not([data-bs-theme]) .logo-dark-mode {
    display: none !important;
}
