/**
 * APCCG Manager - Core Design System & Stylesheet
 * 
 * Sections:
 * 1. Design Tokens & CSS Variables
 * 2. Base & Reset
 * 3. Layout & Container
 * 4. Navigation & Header
 * 5. Cards & Surfaces
 * 6. Buttons
 * 7. Forms, Selects & Inputs
 * 8. Modals
 * 9. Tables & Data Display
 * 10. Schedule & Calendar Components
 * 11. Alerts & Badges
 * 12. Contrast & Accessibility Protections
 * 13. Animations & Live Updates
 */

/* ==========================================================================
   1. DESIGN TOKENS & CSS VARIABLES
   ========================================================================== */
:root {
    /* Surfaces & Layout Hierarchy */
    --color-bg-app: #0a0e27;
    --color-bg-primary: #0a0e27;
    --color-bg-secondary: #2d2420;
    --color-bg-tertiary: #3d3028;
    --color-surface-card: rgba(255, 220, 190, 0.12);
    --color-surface-hover: rgba(255, 180, 120, 0.15);
    --color-surface-modal: #1a1f3c;
    --color-surface-drawer: #111633;
    --color-surface-light: #ffffff;
    --color-surface-light-alt: #f8fafc;
    --color-surface-light-border: #dee2e6;

    /* Legacy surface aliases */
    --bg-primary: var(--color-bg-primary);
    --bg-secondary: var(--color-bg-secondary);
    --bg-tertiary: var(--color-bg-tertiary);
    --bg-card: var(--color-surface-card);
    --bg-hover: var(--color-surface-hover);

    /* Accent Palette - Soft Warm Orange */
    --color-accent-primary: #ff8c42;
    --color-accent-secondary: #ff6b35;
    --color-accent-hover: #ffa266;
    --color-accent-gradient: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);

    /* Legacy accent aliases */
    --accent-primary: var(--color-accent-primary);
    --accent-secondary: var(--color-accent-secondary);
    --accent-gradient: var(--color-accent-gradient);

    /* Typography Colors (Dark surfaces) */
    --color-text-main: #f8fafc;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #94a3b8;

    /* Typography Colors (Light surfaces) */
    --color-text-inverse: #0f172a;
    --color-text-inverse-muted: #64748b;

    /* Legacy typography aliases */
    --text-primary: var(--color-text-main);
    --text-secondary: var(--color-text-secondary);
    --text-muted: var(--color-text-muted);

    /* Event Status Tokens */
    --color-status-confirmed-bg: #c3e6cb;
    --color-status-confirmed-text: #155724;
    --color-status-confirmed-border: #28a745;

    --color-status-pending-bg: #ffd899;
    --color-status-pending-text: #78350f;
    --color-status-pending-border: #d97706;

    --color-status-cancelled-bg: #f8d7da;
    --color-status-cancelled-text: #721c24;
    --color-status-cancelled-border: #dc3545;

    /* Reservation Type Badges */
    --color-type-programming: #0d6efd;
    --color-type-commercial: #d63384;
    --color-type-standard: #ffc107;

    /* Borders & Elevated Shadows */
    --color-border-subtle: rgba(255, 180, 120, 0.25);
    --border-color: var(--color-border-subtle);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-drawer: -12px 0 40px rgba(0, 0, 0, 0.65);
    --shadow-glow: 0 0 20px rgba(255, 140, 66, 0.3);
}

/* ==========================================================================
   2. BASE & RESET
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(255, 180, 120, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255, 140, 100, 0.12) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    padding-top: 100px;
    min-height: 100vh;
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
}

strong,
b {
    color: inherit;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 5px;
}

/* ==========================================================================
   3. LAYOUT & CONTAINER
   ========================================================================== */
.container {
    max-width: 98%;
    padding: 0 15px;
}

/* ==========================================================================
   4. NAVIGATION & HEADER
   ========================================================================== */
.navbar {
    background: #111633 !important;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5);
    padding: 0.45rem 0.9rem;
    margin-bottom: 2rem;
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 20px);
    max-width: 98%;
    z-index: 1000;
}

.navbar:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 0.75rem;
}

.navbar-brand-group {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1;
    margin-right: 0.75rem;
}

.navbar-brand-group .navbar-brand {
    font-size: 1.15rem;
    line-height: 1.05;
    margin-right: 0;
    padding: 0;
}

.navbar-brand-group .navbar-brand-author {
    font-size: 0.65rem;
    line-height: 1;
    margin-top: 1px;
    padding-left: 1.55rem;
    color: rgba(226, 232, 240, 0.7);
    letter-spacing: 0.2px;
}

.navbar-brand-group .brand-gm-link {
    color: var(--accent-primary, #ff8c42);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.navbar-brand-group .brand-gm-link:hover {
    color: #ffaa66;
    text-decoration: underline;
    text-shadow: 0 0 6px rgba(255, 140, 66, 0.5);
}

.navbar-brand-group .brand-sub-sep {
    margin: 0 0.32rem;
    color: rgba(148, 163, 184, 0.45);
    font-style: normal;
    font-weight: 400;
    display: inline-block;
}

.navbar-brand-group .brand-about-link {
    color: rgba(148, 163, 184, 0.65);
    font-size: 0.62rem;
    text-decoration: none;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.navbar-brand-group .brand-about-link:hover {
    color: #f1f5f9;
    text-decoration: underline;
}

.navbar-toggler {
    border: 1px solid var(--accent-primary);
    background: rgba(255, 140, 66, 0.1);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(226, 232, 240, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem !important;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--text-primary) !important;
    background: var(--bg-hover);
}

.nav-link i {
    margin-right: 0.4rem;
}

/* Caselles d'accés del menú principal (Modular Navigation Box Items) */
.navbar .nav-boxes-menu {
    gap: 0.25rem 0.35rem;
}

.navbar .nav-boxes-menu .nav-item {
    display: inline-flex;
    align-items: center;
}

.navbar .nav-link-box {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.62rem !important;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.25px;
    color: #cbd5e1 !important;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    text-decoration: none;
    line-height: 1.25;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.navbar .nav-link-box i {
    font-size: 0.82rem;
    color: var(--accent-primary);
    opacity: 0.88;
    margin-right: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.navbar .nav-link-box:hover {
    color: #ffffff !important;
    background: rgba(255, 140, 66, 0.14) !important;
    border-color: rgba(255, 140, 66, 0.45) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), 0 0 6px rgba(255, 140, 66, 0.2);
}

.navbar .nav-link-box:hover i {
    transform: scale(1.1);
    opacity: 1;
}

.navbar .nav-link-box.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, rgba(255, 140, 66, 0.25), rgba(255, 107, 0, 0.16)) !important;
    border-color: rgba(255, 140, 66, 0.6) !important;
    box-shadow: 0 0 8px rgba(255, 140, 66, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.navbar .nav-link-box.active i {
    color: #ffa266;
    opacity: 1;
}

/* Separadors discrets entre grups funcionals */
.navbar .nav-divider-item {
    display: inline-flex;
    align-items: center;
    padding: 0 0.25rem;
    pointer-events: none;
}

.navbar .nav-group-divider {
    display: block;
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 1px;
}

/* Responsivitat a pantalles petites */
@media (max-width: 991.98px) {
    .navbar .nav-boxes-menu {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.35rem;
        margin-top: 0.75rem;
        width: 100%;
    }
    .navbar .nav-boxes-menu .nav-item {
        width: 100%;
    }
    .navbar .nav-link-box {
        width: 100%;
        justify-content: flex-start;
        padding: 0.45rem 0.75rem !important;
        font-size: 0.82rem;
    }
    .navbar .nav-divider-item {
        width: 100%;
        padding: 0.2rem 0;
    }
    .navbar .nav-group-divider {
        width: 100%;
        height: 1px;
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ==========================================================================
   Navigation Tabs & Active Tab High-Contrast System
   ========================================================================== */
.nav-tabs {
    border-bottom: 2px solid rgba(255, 255, 255, 0.12) !important;
    gap: 4px;
}

.nav-tabs .nav-link {
    color: var(--color-text-secondary, #cbd5e1) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-bottom: none !important;
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    margin-bottom: -1px;
    padding: 0.55rem 0.95rem !important;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.22) transparent !important;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: #ffffff !important;
    background: #1e293b !important;
    border-color: rgba(255, 140, 66, 0.55) rgba(255, 255, 255, 0.2) transparent !important;
    border-top: 3px solid var(--accent-primary, #ff8c42) !important;
    font-weight: 700 !important;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.4);
}

.nav-tabs .nav-link.active i {
    filter: drop-shadow(0 0 4px rgba(255, 140, 66, 0.45));
}

/* Fallback for tabs inside explicitly white/light surfaces */
.bg-white .nav-tabs .nav-link.active,
.bg-light .nav-tabs .nav-link.active {
    color: #0f172a !important;
    background: #ffffff !important;
    border-color: #dee2e6 #dee2e6 #ffffff !important;
    border-top: 3px solid #0d6efd !important;
}

.bg-white .nav-tabs .nav-link:not(.active),
.bg-light .nav-tabs .nav-link:not(.active) {
    color: #475569 !important;
}

.dropdown-menu {
    background: #1e293b !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    color: #e2e8f0 !important;
}

.dropdown-header {
    color: #ff8c42 !important;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-item {
    color: #e2e8f0 !important;
    border-radius: 8px;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--bg-hover) !important;
    color: #ffffff !important;
}

.dropdown-divider {
    border-color: var(--border-color) !important;
}

/* ==========================================================================
   5. CARDS & SURFACES
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: rgba(255, 180, 120, 0.15);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
}

.card-body {
    color: var(--text-primary);
}

/* ==========================================================================
   6. BUTTONS
   ========================================================================== */
.btn {
    font-weight: 600;
    border-radius: 10px;
    padding: 0.6rem 1.5rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-outline-dark {
    color: white !important;
    border-color: var(--border-color);
    background: var(--bg-tertiary);
}

.btn-outline-dark:hover {
    background: var(--bg-hover);
    color: white !important;
}

.btn-outline-primary {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline-info {
    color: #93c5fd;
    border-color: #3b82f6;
}

.btn-outline-success {
    color: #86efac;
    border-color: #10b981;
}

.btn-outline-warning {
    color: #fcd34d;
    border-color: #f59e0b;
}

.btn-outline-danger {
    color: #fca5a5;
    border-color: #ef4444;
}

/* ==========================================================================
   7. FORMS, SELECTS & INPUTS
   ========================================================================== */
.form-control,
.form-select {
    background-color: #1e293b !important;
    border: 1px solid var(--border-color) !important;
    color: #ffffff !important;
    border-radius: 10px;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    color-scheme: dark;
}

/* Ensure native date, time, and calendar picker icons are bright, prominent and accessible */
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
.form-control[type="date"],
.form-control[type="time"],
.form-control[type="datetime-local"] {
    color-scheme: dark !important;
    min-width: 140px;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
    cursor: pointer !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 4px 6px !important;
    margin-right: -2px !important;
    border-radius: 6px;
    background-color: rgba(255, 140, 66, 0.2) !important;
    filter: invert(65%) sepia(90%) saturate(1500%) hue-rotate(345deg) brightness(115%) contrast(105%) !important;
    transition: transform 0.15s ease, background-color 0.15s ease, filter 0.15s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="week"]::-webkit-calendar-picker-indicator:hover {
    transform: scale(1.18);
    background-color: rgba(255, 140, 66, 0.4) !important;
    filter: invert(75%) sepia(95%) saturate(1800%) hue-rotate(345deg) brightness(130%) contrast(110%) !important;
}

.form-control:not(.bg-light):not(.bg-white):focus,
.form-select:not(.bg-light):not(.bg-white):focus {
    background-color: #0f172a !important;
    border-color: var(--accent-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 140, 66, 0.25) !important;
}

.form-control.bg-light:focus,
.form-control.bg-white:focus {
    background-color: #ffffff !important;
    border-color: var(--accent-primary) !important;
    color: #0f172a !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 140, 66, 0.25) !important;
}

/* Browser autofill styling: prevent light autofill on dark fields */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #1e293b inset !important;
    -webkit-text-fill-color: #ffffff !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Options dropdowns high contrast across all browsers */
select option,
.form-select option {
    background-color: #1e293b !important;
    color: #ffffff !important;
    padding: 8px 12px;
}

select option:hover,
select option:checked,
.form-select option:hover,
.form-select option:checked {
    background-color: var(--accent-primary) !important;
    color: #ffffff !important;
}

/* High-contrast placeholders on dark form controls */
::placeholder,
.form-control::placeholder,
.form-select::placeholder,
input::placeholder,
textarea::placeholder {
    color: #94a3b8 !important;
    opacity: 0.85 !important;
}

.form-label {
    color: #cbd5e1 !important;
    font-weight: 500;
}

/* ==========================================================================
   8. MODALS (High Contrast Dark Theme)
   ========================================================================== */
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) {
    background: #1e293b !important;
    border: 1px solid var(--border-color) !important;
    color: #f8fafc !important;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
}

.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-header {
    background: rgba(255, 180, 120, 0.08) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: #f8fafc !important;
}

.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-header .modal-title,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-title {
    color: #f8fafc !important;
    font-weight: 700;
}

.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body {
    background: transparent !important;
    color: #e2e8f0 !important;
}

.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body p,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body span,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body label,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body div:not(.alert):not(.btn):not(.badge),
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body small,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body strong,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body h1,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body h2,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body h3,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body h4,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body h5,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body h6 {
    color: #e2e8f0 !important;
}

.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body .text-muted,
.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-body small.text-muted {
    color: #94a3b8 !important;
}

.modal-content:not(#modalSelectReservationType):not(.bg-white):not(.modal-light) .modal-footer {
    background: rgba(255, 180, 120, 0.04) !important;
    border-top: 1px solid var(--border-color) !important;
    color: #e2e8f0 !important;
}

/* ==========================================================================
   9. TABLES & DATA DISPLAY
   ========================================================================== */
.table:not(.table-security):not(.table-dark) {
    color: #000000 !important;
    background: transparent;
}

.table:not(.table-security):not(.table-dark) thead th {
    background: rgba(200, 200, 255, 0.9) !important;
    border-color: var(--border-color);
    color: #000000 !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table:not(.table-security):not(.table-dark) tbody tr {
    border-color: var(--border-color);
    color: #000000 !important;
    background: rgba(220, 220, 255, 0.85) !important;
}

.table:not(.table-security):not(.table-dark) tbody tr:hover {
    background: rgba(180, 180, 255, 0.9) !important;
}

.table:not(.table-security):not(.table-dark) tbody td {
    color: #000000 !important;
    padding: 12px !important;
}

.table:not(.table-security):not(.table-dark) tbody td strong {
    color: #000000 !important;
    font-weight: 700;
}

.table-light th,
.table-light td {
    background: rgba(200, 200, 255, 0.85) !important;
    color: #000000 !important;
}

.table-hover:not(.table-dark) tbody tr:hover {
    background: rgba(180, 180, 255, 0.9) !important;
}

/* High-contrast links on light table rows */
.table tbody td a:not(.btn):not(.badge) {
    color: #0284c7 !important;
    font-weight: 600;
}

.table tbody td a:not(.btn):not(.badge):hover {
    color: #0369a1 !important;
    text-decoration: underline !important;
}

/* ==========================================================================
   10. SCHEDULE & CALENDAR COMPONENTS
   ========================================================================== */
/* Filter Containers & Panels */
.staff-filters-box,
.filter-container,
.filters-section {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    color: #0f172a !important;
    box-shadow: var(--shadow-sm);
}

.staff-filters-box label,
.filter-container label,
.filters-section label {
    color: #0f172a !important;
    font-weight: 600;
}

.filter-group-title {
    font-weight: 700;
    color: #0f172a !important;
    margin-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Summary Statistics Cards */
.summary-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.stat-card {
    background: #ffffff !important;
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    flex: 1;
    min-width: 200px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--color-accent-primary, #ff8c42);
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    color: #64748b !important;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Schedule Grid & Tables */
.schedule-grid,
.schedule-table-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    border: 1px solid #e2e8f0;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    background: #ffffff !important;
}

.schedule-table th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    padding: 14px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #cbd5e1;
}

.schedule-table td {
    background: #ffffff !important;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    font-size: 0.95rem;
    vertical-align: middle;
}

.schedule-table tbody tr:hover td {
    background: #f8fafc !important;
}

.staff-name {
    font-weight: 600;
    color: #0f172a !important;
}

.specialty-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #e0f2fe !important;
    color: #0369a1 !important;
    border: 1px solid #bae6fd;
}

.hours-total {
    font-weight: 700;
    color: #15803d !important;
    font-size: 1rem;
}

.break-time {
    color: #64748b !important;
    font-weight: 500;
    text-align: center;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #64748b !important;
    font-size: 1rem;
}

/* Quadrant Table (Torns) */
.quadrant-view-container {
    border-radius: 12px;
    background: #ffffff;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    overflow-x: auto;
}

.quadrant-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
    background: #ffffff;
}

.quadrant-table th,
.quadrant-table td {
    border: 1px solid #cbd5e1;
    padding: 8px;
    text-align: center;
    vertical-align: top;
    color: #0f172a;
}

.quadrant-table th {
    background: #f1f5f9;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-accent-primary, #ff8c42);
}

.quadrant-table .sticky-col {
    position: sticky;
    left: 0;
    background: #ffffff;
    z-index: 20;
    border-right: 3px solid var(--color-accent-primary, #ff8c42);
    min-width: 180px;
    text-align: left;
    font-weight: 700;
    color: #000000 !important;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.04);
}

.quadrant-table th.sticky-col {
    z-index: 30;
    background: #f1f5f9;
    color: #000000 !important;
    font-weight: 700;
}

.quadrant-table .category-cell,
.quadrant-table .category-name,
.quadrant-table td.sticky-col * {
    color: #000000 !important;
    font-weight: 700;
}

.quadrant-table .weekend,
.quadrant-table .day-cell.weekend {
    background-color: #fffbeb !important;
}

.quadrant-table .day-cell {
    min-width: 120px;
    max-width: 160px;
    background: #ffffff;
}

/* Shift Cards */
.shift-card {
    background: #f0f9ff;
    border-left: 4px solid #0284c7;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 6px;
    font-size: 0.82rem;
    text-align: left;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shift-card:hover {
    transform: translateX(2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.shift-time {
    font-weight: 700;
    color: #0369a1;
    margin-bottom: 2px;
    font-size: 0.82rem;
}

.shift-event {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0f172a;
    font-weight: 600;
}

/* Calendar Reservation Cards */
.reservation-card {
    padding: 6px 8px;
    margin-bottom: 5px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    border-left-width: 4px;
    border-left-style: solid;
    background: #ffffff;
    color: #0f172a;
}

.reservation-card:hover {
    transform: scale(1.02);
    z-index: 5;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.card-time {
    font-weight: 700;
    color: #475569;
    font-size: 0.75rem;
    margin-bottom: 2px;
    display: block;
}

.card-event {
    font-weight: 600;
    color: #0284c7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 2px;
}

/* ==========================================================================
   11. ALERTS & BADGES
   ========================================================================== */
.alert {
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.alert-success {
    background: rgba(34, 197, 94, 0.18) !important;
    border-color: rgba(34, 197, 94, 0.6) !important;
    color: #86efac !important;
}
.alert-success strong,
.alert-success span:not(.badge),
.alert-success p,
.alert-success li,
.alert-success div:not(.badge) {
    color: #dcfce7 !important;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.18) !important;
    border-color: rgba(239, 68, 68, 0.6) !important;
    color: #fca5a5 !important;
}
.alert-danger strong,
.alert-danger span:not(.badge),
.alert-danger p,
.alert-danger li,
.alert-danger div:not(.badge) {
    color: #fee2e2 !important;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: rgba(245, 158, 11, 0.7) !important;
    color: #fde047 !important;
}
.alert-warning strong,
.alert-warning span:not(.badge),
.alert-warning p,
.alert-warning li,
.alert-warning div:not(.badge) {
    color: #fef08a !important;
}

.alert-info {
    background: rgba(59, 130, 246, 0.18) !important;
    border-color: rgba(59, 130, 246, 0.6) !important;
    color: #93c5fd !important;
}
.alert-info strong,
.alert-info span:not(.badge),
.alert-info p,
.alert-info li,
.alert-info div:not(.badge) {
    color: #dbeafe !important;
}

.badge {
    background: rgba(255, 180, 120, 0.2);
    color: var(--text-primary);
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* Dark badges must always have white text */
.badge.bg-dark,
.badge.bg-secondary,
.badge.bg-danger,
.badge.bg-primary,
.badge.bg-success,
.badge.text-white,
.badge[style*="background-color: #6f42c1"],
.badge[style*="background-color:#6f42c1"],
.table tbody td .badge.bg-dark,
.table tbody td .badge.bg-secondary,
.table tbody td .badge.bg-danger,
.table tbody td .badge.bg-primary,
.table tbody td .badge.bg-success,
.table tbody td .badge[style*="background-color: #6f42c1"],
.table tbody td .badge[style*="background-color:#6f42c1"],
.table tbody td .badge.text-white {
    color: #ffffff !important;
}

/* Light badges must always have dark slate text */
.badge.bg-warning,
.badge.bg-info,
.badge.bg-light,
.table tbody td .badge.bg-warning,
.table tbody td .badge.bg-info,
.table tbody td .badge.bg-light {
    color: #0f172a !important;
}

/* ==========================================================================
   12. CONTRAST & ACCESSIBILITY PROTECTIONS
   ========================================================================== */
.text-muted {
    color: var(--text-secondary);
}

.text-dark,
.text-black {
    color: #000000 !important;
}

/* Protection: elements with class text-dark that sit inside dark surfaces */
.modal-content:not(#modalSelectReservationType):not(.bg-white) .text-dark:not(.badge):not(.btn),
.dropdown-menu .text-dark:not(.badge):not(.btn),
.card:not(.bg-white):not(.bg-light) .text-dark:not(.badge):not(.btn):not(.card-header.bg-light *):not(.card-header.bg-white *),
#detailPanel .text-dark:not(.badge):not(.btn),
.card-body:not(.bg-white):not(.bg-light) h1.text-dark,
.card-body:not(.bg-white):not(.bg-light) h2.text-dark,
.card-body:not(.bg-white):not(.bg-light) h3.text-dark,
.card-body:not(.bg-white):not(.bg-light) h4.text-dark,
.card-body:not(.bg-white):not(.bg-light) h5.text-dark,
.card-body:not(.bg-white):not(.bg-light) h6.text-dark,
.card-body:not(.bg-white):not(.bg-light) strong.text-dark,
.card-body:not(.bg-white):not(.bg-light) span.text-dark:not(.badge),
.card-body:not(.bg-white):not(.bg-light) p.text-dark {
    color: #f1f5f9 !important;
}

/* Tables on light surfaces must keep crisp black text for text-dark and strong elements, excluding badges */
.table:not(.table-dark) .text-dark,
.table:not(.table-dark) strong.text-dark,
.table:not(.table-dark) tbody td strong:not(.badge *):not(.text-info):not(.text-warning):not(.text-danger):not(.text-primary):not(.text-success):not([style*="color"]),
.table:not(.table-dark) tbody td .text-dark,
.quadrant-table .text-dark,
.quadrant-table td.sticky-col,
.quadrant-table .category-cell,
.staff-quadrant-table .text-dark,
.staff-quadrant-table td.sticky-col,
.staff-quadrant-table .category-name {
    color: #000000 !important;
}

/* Protections for strong elements inside badges and dark tables */
.badge strong.text-info,
.badge.bg-dark strong.text-info,
.table tbody td .badge strong.text-info {
    color: #38bdf8 !important;
}

.table-dark tbody td strong,
.table-dark thead th strong {
    color: #f8fafc !important;
}

/* Badges de tipus de reserva (Comercial / Programació): sempre amb font blanca d'alt contrast */
.badge-commercial,
.badge-programming,
.staff-type-badge,
.staff-quadrant-table .badge-commercial,
.staff-quadrant-table .badge-programming,
.staff-quadrant-table .badge.bg-primary,
.quadrant-table .badge-commercial,
.quadrant-table .badge-programming,
.quadrant-table .badge.bg-primary {
    color: #ffffff !important;
    font-weight: 700 !important;
}
.badge-commercial *,
.badge-programming *,
.staff-type-badge * {
    color: #ffffff !important;
}

/* Elements on light or white backgrounds must have crisp black text across ALL pages */
.bg-white:not(.modal-content):not(.dropdown-menu),
.bg-white *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option):not(input):not(textarea),
.bg-light:not(.modal-content):not(.dropdown-menu),
.bg-light *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option):not(input):not(textarea),
.table:not(.modal table):not(.table-dark),
.table:not(.table-dark) *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option):not(input):not(textarea),
.table-light,
.table-light *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option):not(input):not(textarea),
.table:not(.table-dark) tbody tr,
.table:not(.table-dark) tbody tr td,
.table:not(.table-dark) tbody tr th,
.table:not(.table-dark) tbody td *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option):not(input):not(textarea),
.table:not(.table-dark) tbody th *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option):not(input):not(textarea),
.card.bg-white *,
.card.bg-light *,
.card-footer.bg-light *,
.card-body.bg-white *,
.card-body.bg-light *,
.modal-content.bg-white *,
.modal-content.bg-light *,
[style*="background: white"] *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option),
[style*="background-color: white"] *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option),
[style*="background: #fff"] *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option),
[style*="background-color: #fff"] *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option),
[style*="background:#fff"] *:not(.badge):not(.badge *):not(.btn):not(.btn *):not(.modal):not(.modal *):not(.dropdown-menu):not(.dropdown-menu *):not(select):not(option) {
    color: #000000 !important;
}

/* Specifically override muted, secondary, light and white text classes on light/white containers */
.bg-white .text-muted,
.bg-white .text-secondary,
.bg-white .text-light,
.bg-white .text-white:not(.badge):not(.badge *):not(.btn):not(.btn *),
.bg-white .text-body-secondary,
.bg-white .text-black-50,
.bg-white small:not(.badge *),
.bg-white p,
.bg-white span:not(.badge):not(.badge *):not(.btn):not(.btn *),
.bg-white div:not(.badge *),
.bg-light .text-muted,
.bg-light .text-secondary,
.bg-light .text-light,
.bg-light .text-white:not(.badge):not(.badge *):not(.btn):not(.btn *),
.bg-light .text-body-secondary,
.bg-light .text-black-50,
.bg-light small:not(.badge *),
.bg-light p,
.bg-light span:not(.badge):not(.badge *):not(.btn):not(.btn *),
.bg-light div:not(.badge *),
.table:not(.table-dark):not(.rental-table) .text-muted,
.table:not(.table-dark):not(.rental-table) .text-secondary,
.table:not(.table-dark):not(.rental-table) .text-light,
.table:not(.table-dark):not(.rental-table) .text-white:not(.badge):not(.badge *):not(.btn):not(.btn *),
.table:not(.table-dark):not(.rental-table) .text-body-secondary,
.table:not(.table-dark):not(.rental-table) .text-black-50,
.table:not(.table-dark):not(.rental-table) small:not(.badge *),
.table:not(.table-dark):not(.rental-table) span:not(.badge):not(.badge *),
.table:not(.table-dark):not(.rental-table) p,
.table:not(.table-dark):not(.rental-table) div:not(.badge *),
.table:not(.table-dark):not(.rental-table) tbody td .text-muted,
.table:not(.table-dark):not(.rental-table) tbody td .text-secondary,
.table:not(.table-dark):not(.rental-table) tbody td .text-light,
.table:not(.table-dark):not(.rental-table) tbody td .text-white:not(.badge):not(.badge *):not(.btn):not(.btn *),
.table:not(.table-dark):not(.rental-table) tbody td .text-body-secondary,
.table:not(.table-dark):not(.rental-table) tbody td .text-black-50,
.table:not(.table-dark):not(.rental-table) tbody td small:not(.badge *),
.table:not(.table-dark):not(.rental-table) tbody td span:not(.badge):not(.badge *),
.table:not(.table-dark):not(.rental-table) tbody td div:not(.badge *),
.table:not(.table-dark):not(.rental-table) tbody th .text-muted,
.table:not(.table-dark):not(.rental-table) tbody th .text-secondary,
.table:not(.table-dark):not(.rental-table) tbody th .text-light,
.table:not(.table-dark):not(.rental-table) tbody th .text-white:not(.badge):not(.badge *):not(.btn):not(.btn *),
.table-light .text-muted,
.table-light .text-secondary,
.table-light .text-light,
.table-light .text-white:not(.badge):not(.badge *):not(.btn):not(.btn *),
.card.bg-white .text-muted,
.card.bg-white .text-secondary,
.card.bg-light .text-muted,
.card.bg-light .text-secondary,
.card-footer.bg-light .text-muted,
.card-footer.bg-light .text-secondary {
    color: #000000 !important;
}

/* Explicit light/white container colors */
.bg-light {
    background: #f8fafc !important;
    color: #0f172a !important;
}

.bg-white {
    background: #ffffff !important;
    color: #0f172a !important;
}

/* Badges de tipus de reserva (Comercial / Programació) i badges amb fons foscos: SEMPRE blanc pur */
.badge-commercial,
.badge-programming,
.staff-type-badge,
.badge.badge-commercial,
.badge.badge-programming,
.badge.bg-primary,
.badge.bg-secondary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-dark,
.badge-area-so,
.badge-area-llums,
.badge-area-mobiliari,
.badge-area-video,
.badge-area-informatica,
.badge-area-altres,
.rental-item-qty,
.staff-quadrant-table .badge-commercial,
.staff-quadrant-table .badge-programming,
.staff-quadrant-table .badge.bg-primary,
.staff-quadrant-table .badge.staff-type-badge,
.staff-quadrant-table .shift-card .badge,
.staff-calendar-table .badge-commercial,
.staff-calendar-table .badge-programming,
.staff-calendar-table .badge.bg-primary,
.staff-calendar-table .badge.staff-type-badge,
.staff-list-table .badge-commercial,
.staff-list-table .badge-programming,
.staff-list-table .badge.bg-primary,
.staff-list-table .badge.staff-type-badge,
.quadrant-table .badge-commercial,
.quadrant-table .badge-programming,
.quadrant-table .badge.bg-primary {
    color: #ffffff !important;
    font-weight: 700 !important;
}

.badge-commercial *,
.badge-programming *,
.staff-type-badge *,
.staff-quadrant-table .badge-commercial *,
.staff-quadrant-table .badge-programming *,
.staff-quadrant-table .badge.bg-primary *,
.staff-quadrant-table .shift-card .badge * {
    color: #ffffff !important;
}

/* ==========================================================================
   13. ANIMATIONS & LIVE UPDATES
   ========================================================================== */
@keyframes pulseDanger {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.animate-pulse {
    animation: pulseDanger 2s infinite;
}

.live-dot {
    display: inline-block;
    animation: livePulse 2s infinite ease-in-out;
}

@keyframes livePulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.badge-pulse {
    animation: badgePulse 0.4s ease-in-out 3;
}
