/* =============================================
   Renault Trainer — Design System
   ============================================= */

:root {
    /* Pylon Cosmo Theme — Primary #2780e3 */
    --primary:        #2780e3;
    --primary-hover:  #1a6cc7;
    --primary-light:  #ddeeff;
    --primary-muted:  rgba(39, 128, 227, 0.12);

    --white:     #ffffff;
    --gray-50:   #f0f0f0;
    --gray-100:  #f1f5f9;
    --gray-200:  #e2e8f0;
    --gray-300:  #cbd5e1;
    --gray-400:  #94a3b8;
    --gray-500:  #64748b;
    --gray-600:  #475569;
    --gray-700:  #334155;
    --gray-800:  #1e293b;
    --gray-900:  #0f172a;

    --success:       #3fb618;
    --success-light: #d4f7c0;
    --warning:       #ff7518;
    --warning-light: #ffe8d0;
    --danger:        #ff0039;
    --danger-light:  #ffd0db;
    --info:          #9954bb;
    --info-light:    #eedff7;

    --sidebar-width:  240px;
    --header-height:  60px;
    --radius:         10px;
    --radius-sm:      6px;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:     0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: #f0f0f0;
    color: var(--gray-800);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--gray-900);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.25s ease;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.sidebar-logo-icon {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.875rem 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav ul {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav li a,
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    border-radius: var(--radius-sm);
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

.sidebar-nav li a i,
.sidebar-footer a i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: color 0.15s;
}

.sidebar-nav li a:hover,
.sidebar-footer a:hover {
    background: rgba(255,255,255,0.07);
    color: var(--white);
}

.sidebar-nav li a.active {
    background: var(--primary-muted);
    color: #a5b4fc;
}

.sidebar-nav li a.active i {
    color: #818cf8;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-600);
    padding: 0.75rem 0.875rem 0.25rem;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

/* =============================================
   MAIN WRAPPER
   ============================================= */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

/* =============================================
   TOP HEADER
   ============================================= */
.top-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 1.05rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: none;
    line-height: 1;
}

.sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.8rem;
}

/* =============================================
   PAGE CONTENT
   ============================================= */
.page-content {
    flex: 1;
    padding: 1.75rem 2rem 3rem;
}

.page-header {
    margin-bottom: 1.75rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.2rem;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin: 0;
}

/* =============================================
   STAT CARDS
   ============================================= */
.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: var(--primary);
    color: inherit;
    text-decoration: none;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.blue   { background: var(--info-light);    color: var(--info); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.amber  { background: var(--warning-light); color: var(--warning); }
.stat-icon.indigo { background: var(--primary-light); color: var(--primary); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger); }

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.1rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.1;
}

/* =============================================
   CARDS
   ============================================= */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gray-100);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.5;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(79,70,229,0.25);
}

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

/* =============================================
   TABLES
   ============================================= */
.table {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.table thead th {
    background: var(--gray-50);
    color: var(--gray-500);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: var(--gray-50);
    cursor: pointer;
}

/* =============================================
   FORMS
   ============================================= */
.form-control, .form-select {
    border-color: var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-muted);
}

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

/* =============================================
   MODALS
   ============================================= */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--gray-100);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 700;
    color: var(--gray-900);
    font-size: 1rem;
}

.modal-body { padding: 1.5rem; }

.modal-footer {
    border-top: 1px solid var(--gray-100);
    padding: 1rem 1.5rem;
}

/* =============================================
   CALENDAR (legacy — kept for compatibility)
   ============================================= */
.calendar-day {
    min-height: 110px;
    border: 1px solid var(--gray-200);
    padding: 0.5rem;
    background: var(--white);
    transition: background 0.1s;
}
.calendar-day:hover { background: var(--gray-50); }
.calendar-day-header {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-bottom: 0.4rem;
}
.calendar-event {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    margin-bottom: 0.2rem;
    border-radius: 4px;
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.empty-day { background: var(--gray-50); opacity: 0.55; }

/* =============================================
   DUAL-VIEW CALENDAR
   ============================================= */

/* Section dividers */
.dual-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
}

/* ── Weekday header ── */
.cal-weekday-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-400);
    padding: 0.5rem 0 0.3rem;
    border-bottom: 1px solid var(--gray-100);
    text-align: center;
}
.cal-weekday-header .cal-weekend-hdr { color: var(--gray-300); }

/* ── Day detail popover ── */
.cal-day-detail {
    position: fixed;
    z-index: 9999;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.875rem 1rem;
    min-width: 200px;
    max-width: 280px;
    font-size: 0.82rem;
}

/* =============================================
   GANTT VIEW
   ============================================= */
.gantt-header-row {
    display: flex;
    margin-bottom: 3px;
}
.gantt-row {
    display: flex;
    margin-bottom: 3px;
}
.gantt-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-700);
    padding: 3px 8px 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.gantt-day-hdr {
    font-size: 0.58rem;
    color: var(--gray-400);
    line-height: 1;
    padding: 1px 0;
    pointer-events: none;
}
.gantt-we      { color: var(--gray-300); }
.gantt-today-hdr { color: var(--primary); font-weight: 700; }
.gantt-track {
    flex: 1;
    position: relative;
    min-height: 28px;
    background: var(--gray-50);
    border-radius: 4px;
    overflow: visible;
}
.gantt-day-bg {
    position: absolute;
    top: 0; bottom: 0;
    pointer-events: none;
    border-right: 1px solid rgba(0,0,0,0.03);
}
.gantt-bg-we    { background: rgba(0,0,0,0.025); }
.gantt-bg-today { background: rgba(39,128,227,0.07); border-right-color: rgba(39,128,227,0.25); }
.gantt-bar {
    position: absolute;
    height: 20px;
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0 6px;
    min-width: 4px;
    transition: filter 0.15s;
}
.gantt-bar:hover { filter: brightness(0.88); }
.gantt-bar span {
    font-size: 0.67rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* =============================================
   WIKI
   ============================================= */
.wiki-info-icon {
    cursor: pointer;
    color: var(--info);
    margin-left: 5px;
    font-size: 0.85em;
    transition: color 0.15s;
}
.wiki-info-icon:hover { color: #1d4ed8; }

.wiki-content-box {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--info-light);
    border-left: 3px solid var(--info);
    border-radius: var(--radius-sm);
    font-size: 0.82em;
    color: var(--gray-700);
}

/* =============================================
   BADGES
   ============================================= */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    border-radius: 4px;
}

/* =============================================
   FILTER BAR
   ============================================= */
.filter-bar {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.875rem 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

/* =============================================
   PAGE-SPECIFIC HELPERS
   ============================================= */
.section-heading {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--gray-100);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* =============================================
   TRAINER NAME BADGE (colored dot + name)
   ============================================= */
.trainer-name-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

/* =============================================
   DASHBOARD
   ============================================= */
.dash-upcoming-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
}
.dash-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
    flex-shrink: 0;
}
.dash-upcoming-main { flex: 1; min-width: 0; }
.dash-upcoming-trainer { font-weight: 600; font-size: 0.82rem; color: var(--gray-800); }
.dash-upcoming-seminar { font-size: 0.78rem; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-upcoming-hotel   { font-size: 0.72rem; color: var(--gray-400); margin-top: 1px; }
.dash-upcoming-dates   { text-align: right; flex-shrink: 0; }
.dash-date-row { display: flex; align-items: center; gap: 5px; font-size: 0.78rem; justify-content: flex-end; }
.dash-chip { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 0.68rem; font-weight: 600; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .page-content {
        padding: 1.25rem 1rem 2rem;
    }
}
