/* System font stack - no external font loading needed */

:root {
    --sidebar-width: 260px;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-subtle: #eef2ff;
    --surface: #ffffff;
    --surface-secondary: #f8fafc;
    --bg: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --status-valid: #16a34a;
    --status-expiring-90: #0891b2;
    --status-expiring-60: #ca8a04;
    --status-expiring-30: #ea580c;
    --status-expired: #dc2626;
    --status-none: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
    --radius: .75rem;
    --radius-lg: 1rem;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    font-size: .9375rem;
}

/* ===== SIDEBAR ===== */
.sidebar {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 1040;
    overflow-y: auto;
    background: linear-gradient(180deg, #1e1b4b 0%, #0f172a 100%);
    border-right: 1px solid rgba(255,255,255,.06);
}

@media (min-width: 992px) {
    .sidebar { display: flex !important; flex-direction: column; }
}

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    padding: 1.5rem 1.25rem 1.25rem;
    letter-spacing: -.03em;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.sidebar-brand i {
    font-size: 1.4rem;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar .nav-link {
    color: rgba(255,255,255,.55);
    border-radius: .5rem;
    margin: 0 .75rem 1px;
    padding: .55rem .75rem;
    font-size: .875rem;
    font-weight: 500;
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.sidebar .nav-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }

.sidebar .nav-link:hover {
    color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.07);
}

.sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(99,102,241,.35), rgba(139,92,246,.2));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; padding-bottom: 76px; }

@media (min-width: 992px) {
    .main-content { padding-bottom: 0; margin-left: var(--sidebar-width); }
}

/* ===== MOBILE NAV ===== */
.mobile-topbar {
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1040;
    height: 72px;
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    border-top: 1px solid rgba(255,255,255,.08);
    backdrop-filter: blur(20px);
}

@media (min-width: 992px) { .bottom-nav { display: none !important; } }

.bottom-nav .nav-link {
    font-size: .65rem;
    font-weight: 500;
    padding: .5rem 0;
    min-width: 52px;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.45);
    transition: color .15s;
    gap: 2px;
}

.bottom-nav .nav-link:hover,
.bottom-nav .nav-link.active { color: #fff; }
.bottom-nav .nav-link.active i { color: #a5b4fc; }
.bottom-nav .nav-link i { font-size: 1.25rem; }

/* ===== CARDS ===== */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
    transition: box-shadow .2s, transform .15s;
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: .875rem 1.25rem;
    font-size: .875rem;
}

.card-header h5, .card-header h6 { letter-spacing: -.02em; }

.card-footer {
    background: var(--surface-secondary);
    border-top: 1px solid var(--border-light);
}

/* ===== BUTTONS ===== */
.btn {
    font-weight: 600;
    font-size: .875rem;
    letter-spacing: -.01em;
    border-radius: .5rem;
    transition: all .15s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 1px 2px rgba(99,102,241,.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(99,102,241,.35);
    transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-success {
    background: #16a34a;
    border-color: #16a34a;
    box-shadow: 0 1px 2px rgba(22,163,74,.3);
}

.btn-success:hover {
    background: #15803d;
    border-color: #15803d;
}

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

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

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

.btn-outline-secondary:hover {
    background: var(--surface-secondary);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-outline-danger {
    color: var(--status-expired);
    border-color: var(--border);
}

.btn-outline-danger:hover {
    background: #fef2f2;
    border-color: var(--status-expired);
}

.btn-outline-light {
    border-color: rgba(255,255,255,.2);
    color: rgba(255,255,255,.7);
}

.btn-outline-light:hover {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.3);
    color: #fff;
}

.btn-lg { padding: .625rem 1.25rem; font-size: .9375rem; border-radius: .625rem; }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }

/* ===== FORMS ===== */
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: .5rem;
    font-size: .875rem;
    padding: .5rem .75rem;
    transition: border-color .15s, box-shadow .15s;
    background-color: var(--surface);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.form-control-lg, .form-select-lg {
    padding: .625rem 1rem;
    font-size: .9375rem;
    border-radius: .625rem;
}

.form-label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: .375rem;
}

.form-text { font-size: .75rem; color: var(--text-muted); }

.form-check-input {
    border: 2px solid var(--border);
    border-radius: .25rem;
    width: 1.15em;
    height: 1.15em;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus { box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

/* ===== STATUS BADGES ===== */
.badge-status {
    font-size: .7rem;
    font-weight: 700;
    padding: .3em .6em;
    border-radius: 50rem;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-valid { background: #dcfce7; color: #166534; }
.badge-expiring-90 { background: #cffafe; color: #155e75; }
.badge-expiring-60 { background: #fef9c3; color: #854d0e; }
.badge-expiring-30 { background: #ffedd5; color: #9a3412; }
.badge-expired { background: #fee2e2; color: #991b1b; }
.badge-none { background: var(--border-light); color: var(--text-muted); }

.status-valid { color: var(--status-valid); }
.status-expiring-90 { color: var(--status-expiring-90); }
.status-expiring-60 { color: var(--status-expiring-60); }
.status-expiring-30 { color: var(--status-expiring-30); }
.status-expired { color: var(--status-expired); }
.status-none { color: var(--status-none); }

/* ===== TABLES ===== */
.table { --bs-table-striped-bg: rgba(0,0,0,.015); font-size: .875rem; }

.table th {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    padding: .75rem;
    white-space: nowrap;
}

.table td { vertical-align: middle; padding: .65rem .75rem; color: var(--text); }

.table-hover > tbody > tr:hover { background-color: var(--primary-subtle); }

.table th a { color: var(--text-muted); }
.table th a:hover { color: var(--text); }

/* ===== PROFILE ===== */
.profile-photo {
    width: 96px; height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    box-shadow: var(--shadow);
}

.profile-photo-placeholder {
    width: 96px; height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.25rem;
    font-weight: 800;
    border: 3px solid var(--border);
    box-shadow: var(--shadow);
    letter-spacing: -.05em;
}

/* ===== PAGE ELEMENTS ===== */
.page-header { margin-bottom: 1.5rem; }
.page-header h4 {
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0;
    font-size: 1.35rem;
    letter-spacing: -.03em;
}

.page-header h4 i { font-size: 1.1rem; }

.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .875rem 1rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: .5rem;
    font-size: .8125rem;
}

.breadcrumb a { color: var(--primary); }
.breadcrumb-item.active { color: var(--text-muted); }

/* ===== ALERTS ===== */
.alert {
    border: none;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

/* ===== DRIVER CARD (training selection) ===== */
.driver-card {
    cursor: pointer;
    min-height: 48px;
    transition: all .12s;
    user-select: none;
    -webkit-user-select: none;
    border-radius: .5rem !important;
    border: 1.5px solid var(--border) !important;
}

.driver-card:hover {
    border-color: #a5b4fc !important;
    background: var(--surface-secondary) !important;
}

.driver-card:active,
.driver-card.selected {
    background: var(--primary-subtle) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(99,102,241,.1);
}

/* ===== DRIVER LIST CARDS (mobile) ===== */
.driver-list-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.driver-list-card:hover { color: inherit; }
.driver-list-card .card { transition: transform .1s; }
.driver-list-card:active .card { transform: scale(.985); }

/* ===== STICKY ===== */
.sticky-search { position: sticky; top: 0; z-index: 10; }

.sticky-footer {
    position: fixed;
    bottom: 72px; left: 0; right: 0;
    z-index: 1030;
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,.92);
}

@media (min-width: 992px) {
    .sticky-footer { bottom: 0; left: var(--sidebar-width); }
}

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 1100; }

.toast {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: none;
}

/* ===== LOGIN ===== */
.login-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: none;
    box-shadow: var(--shadow-lg);
}

.login-header {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    padding: 2.5rem 2rem;
    text-align: center;
    color: #fff;
}

.login-header i {
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== PAGINATION ===== */
.pagination .page-link {
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: .8125rem;
    border-radius: .5rem;
    margin: 0 2px;
}

.pagination .page-link:hover { background: var(--primary-subtle); color: var(--primary); }

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

.modal-header { border-bottom: 1px solid var(--border-light); }
.modal-footer { border-top: 1px solid var(--border-light); }

/* ===== MISC ===== */
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }

.badge {
    font-weight: 600;
    font-size: .75rem;
    letter-spacing: .01em;
}

hr { border-color: var(--border-light); opacity: 1; }

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

::selection { background: rgba(99,102,241,.15); }
