/* ==========================================================
   BaytiCare Transport — Design System
   Inspiré Stripe / Linear / Notion / Monday
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500&display=swap');

:root {
    /* Brand */
    --brand-50:  #eef4ff;
    --brand-100: #d9e6ff;
    --brand-200: #b5cdff;
    --brand-300: #84acff;
    --brand-400: #5687ff;
    --brand-500: #2f63f6;
    --brand-600: #1f47d4;
    --brand-700: #1a3aab;
    --brand-800: #15307e;
    --brand-900: #0b3d91;
    --brand-950: #061a4a;

    --sky-400: #38a3ff;
    --sky-500: #1e8de8;

    /* Neutrals */
    --gray-50:  #f7f9fc;
    --gray-100: #eef2f7;
    --gray-200: #e2e8f2;
    --gray-300: #cbd5e3;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic */
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger:  #ef4444;
    --danger-bg: #fee2e2;
    --info:    #0ea5e9;
    --info-bg: #e0f2fe;

    /* Layout */
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-sm: 6px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
    --shadow:    0 4px 12px rgba(15,23,42,.08);
    --shadow-lg: 0 12px 32px rgba(15,23,42,.12);
    --shadow-brand: 0 8px 20px rgba(31,71,212,.25);

    /* Typo */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-600); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-800); }
h1,h2,h3,h4,h5,h6 { font-weight: 700; letter-spacing: -.02em; color: var(--gray-900); margin: 0 0 .6em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }

/* ===== Layout shell ===== */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    background: linear-gradient(180deg, #0a2570 0%, #0b3d91 60%, #1f47d4 130%);
    color: #fff;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 30;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 4px; }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 22px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    margin-bottom: 18px;
}
.brand-logo {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #38a3ff 0%, #fff 100%);
    display: flex; align-items: center; justify-content: center;
    color: var(--brand-900);
    font-weight: 800;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(56,163,255,.3);
}
.brand-text { line-height: 1.15; }
.brand-name { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; }
.brand-sub  { font-size: 10px; text-transform: uppercase; letter-spacing: 2px; opacity: .65; }

.nav-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,.45);
    padding: 16px 12px 6px;
    font-weight: 600;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.78);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
    transition: all .18s ease;
    position: relative;
}
.nav-link:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}
.nav-link.active {
    background: rgba(255,255,255,.13);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--sky-400);
}
.nav-icon {
    width: 18px; height: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ===== Topbar ===== */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-title { font-weight: 700; font-size: 1.05rem; color: var(--gray-900); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    background: var(--gray-100);
    font-weight: 600;
    font-size: 13.5px;
}
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-500), var(--sky-400));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 13px;
}
.user-role {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gray-500);
    font-weight: 600;
}
.btn-logout {
    background: transparent;
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    padding: 7px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: all .15s;
}
.btn-logout:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

/* ===== Main ===== */
.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 28px; flex: 1; }
.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.page-head h1 { margin: 0 0 4px; }
.page-head .subtitle { color: var(--gray-500); font-size: 13.5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--brand-900);
    color: #fff;
    box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background: var(--brand-800); color: #fff; box-shadow: 0 10px 24px rgba(31,71,212,.35); }
.btn-secondary {
    background: #fff;
    color: var(--gray-700);
    border-color: var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-900); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color:#fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color:#fff; }
.btn-ghost   { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ===== Cards ===== */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
    overflow: hidden;
}
.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 20px; }

/* Stat cards */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.stat::before {
    content: ''; position: absolute; top: 0; right: 0;
    width: 80px; height: 80px;
    background: radial-gradient(circle, var(--brand-100), transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
    pointer-events: none;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--gray-500);
    font-weight: 600;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -.02em;
    line-height: 1.1;
}
.stat-icon {
    position: absolute; top: 18px; right: 18px;
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--brand-50);
    color: var(--brand-700);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    z-index: 1;
}
.stat-foot { margin-top: 10px; font-size: 12px; color: var(--gray-500); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    background: #fff;
}
.table thead th {
    background: var(--gray-50);
    text-align: left;
    padding: 11px 16px;
    font-weight: 600;
    font-size: 11.5px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Forms ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--gray-700);
    letter-spacing: .2px;
}
.form-field .hint { font-size: 11.5px; color: var(--gray-500); }
.input, .select, .textarea {
    font-family: inherit;
    font-size: 14px;
    padding: 10px 13px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
    color: var(--gray-900);
    transition: all .15s;
    width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px rgba(47,99,246,.12);
}
.textarea { min-height: 80px; resize: vertical; font-family: inherit; }
.form-row {
    display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
    margin-bottom: 18px;
}
.form-row .form-field { flex: 1; min-width: 180px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--gray-100); flex-wrap: wrap; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 4px solid;
    display: flex; align-items: center; gap: 10px;
}
.alert-success { background: var(--success-bg); color: #065f46; border-color: var(--success); }
.alert-error,
.alert-danger  { background: var(--danger-bg); color: #991b1b; border-color: var(--danger); }
.alert-info    { background: var(--info-bg); color: #075985; border-color: var(--info); }
.alert-warning { background: var(--warning-bg); color: #92400e; border-color: var(--warning); }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .3px;
}
.badge-success { background: var(--success-bg); color: #065f46; }
.badge-danger  { background: var(--danger-bg);  color: #991b1b; }
.badge-info    { background: var(--info-bg);    color: #075985; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-neutral { background: var(--gray-100);   color: var(--gray-700); }
.badge-brand   { background: var(--brand-50);   color: var(--brand-800); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ===== Login ===== */
.login-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--gray-50);
}
.login-side {
    background:
        radial-gradient(at 20% 10%, rgba(56,163,255,.5) 0, transparent 50%),
        radial-gradient(at 80% 80%, rgba(31,71,212,.55) 0, transparent 50%),
        linear-gradient(135deg, #061a4a 0%, #0b3d91 100%);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.login-side::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}
.login-side-content { position: relative; z-index: 1; }
.login-side .brand-name { font-size: 1.4rem; }
.login-side h1 { color: #fff; font-size: 2.6rem; line-height: 1.15; max-width: 480px; margin-top: 60px; }
.login-side p { color: rgba(255,255,255,.75); max-width: 480px; font-size: 15px; }
.login-features { display: flex; flex-direction: column; gap: 14px; margin-top: 32px; position: relative; z-index:1; }
.login-feature {
    display: flex; align-items: center; gap: 12px;
    color: rgba(255,255,255,.88);
    font-size: 14.5px;
}
.login-feature-dot {
    width: 24px; height: 24px; border-radius: 50%;
    background: rgba(56,163,255,.25);
    color: var(--sky-400);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 800;
}
.login-foot { position: relative; z-index: 1; font-size: 12.5px; color: rgba(255,255,255,.5); }

.login-main {
    display: flex; align-items: center; justify-content: center;
    padding: 48px;
}
.login-card {
    width: 100%;
    max-width: 420px;
}
.login-card h2 { font-size: 1.8rem; margin-bottom: 6px; }
.login-card .sub { color: var(--gray-500); margin-bottom: 32px; font-size: 14.5px; }

.field-pass-wrap { position: relative; }
.field-pass-wrap .toggle {
    position: absolute; right: 12px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--gray-500);
    font-size: 12px; font-weight: 600;
}
.field-pass-wrap .toggle:hover { color: var(--brand-700); }
.check-row {
    display: flex; align-items: center; justify-content: space-between;
    margin: 14px 0 18px;
    font-size: 13px;
}
.check-row label { display: flex; align-items: center; gap: 7px; color: var(--gray-600); cursor: pointer; }

/* ===== Presence module ===== */
.presence-toolbar {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.presence-toolbar .chip-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    border: 1px solid transparent;
    user-select: none;
}
.chip:hover { background: var(--brand-50); color: var(--brand-800); }
.chip-brand { background: var(--brand-900); color: #fff; }
.chip-brand:hover { background: var(--brand-800); color: #fff; }

.presence-grid {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.presence-row {
    display: grid;
    grid-template-columns: 2.5fr repeat(4, 1fr) 1.5fr;
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
    transition: background .12s;
}
.presence-row:hover { background: var(--gray-50); }
.presence-row:last-child { border-bottom: none; }
.presence-head {
    background: var(--gray-50);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--gray-500);
}
.presence-row > div { padding: 12px 14px; }
.presence-student { font-weight: 600; color: var(--gray-900); }
.presence-cell { text-align: center; }
.presence-row select { font-size: 12.5px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--gray-200); }

.checkbox-big {
    appearance: none;
    width: 22px; height: 22px;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all .15s;
}
.checkbox-big:checked {
    background: var(--brand-900);
    border-color: var(--brand-900);
}
.checkbox-big:checked::after {
    content: ''; position: absolute;
    left: 6px; top: 2px;
    width: 6px; height: 11px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

/* ===== Planning ===== */
.planning-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-top: 14px;
}
.day-col {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 200px;
}
.day-col-head {
    padding: 10px 12px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
}
.day-col-head .date { display: block; font-size: 16px; color: var(--gray-900); font-weight: 800; margin-top: 2px; }
.day-col-head.today { background: var(--brand-900); color: #fff; }
.day-col-head.today .date { color: #fff; }
.day-col-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.plan-card {
    background: var(--brand-50);
    border-left: 3px solid var(--brand-500);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
}
.plan-card .pc-time { font-weight: 700; color: var(--brand-800); font-size: 11.5px; }
.plan-card .pc-school { color: var(--gray-800); font-weight: 600; margin-top: 2px; }
.plan-card .pc-meta { color: var(--gray-500); font-size: 11px; margin-top: 3px; }

/* ===== Mobile ===== */
.menu-toggle {
    display: none;
    background: transparent; border: none;
    font-size: 22px; cursor: pointer;
    color: var(--gray-700);
}

@media (max-width: 1024px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-side { display: none; }
}
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        width: 280px;
        transform: translateX(-110%);
        transition: transform .25s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: inline-flex; }
    .planning-week { grid-template-columns: repeat(2, 1fr); }
    .presence-row { grid-template-columns: 2fr repeat(4,1fr); }
    .presence-row .presence-action { display: none; }
    .content { padding: 18px; }
    .stat-value { font-size: 1.55rem; }
}
@media (max-width: 540px) {
    .planning-week { grid-template-columns: 1fr; }
    .presence-row { grid-template-columns: 1.5fr repeat(4,1fr); font-size: 12.5px; }
    .topbar { padding: 0 14px; }
    .user-chip span:not(.user-avatar) { display: none; }
}

/* ===== Backdrop sidebar mobile ===== */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 25;
}
.sidebar-backdrop.show { display: block; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px; }
.pagination a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-700);
    font-weight: 600;
    font-size: 13px;
}
.pagination a:hover { background: var(--gray-50); }
.pagination a.current { background: var(--brand-900); color: #fff; border-color: var(--brand-900); }

/* ===== Empty state ===== */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--gray-500);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { color: var(--gray-700); margin-bottom: 4px; }

/* ===== Utilities ===== */
.text-muted { color: var(--gray-500); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 18px; }
.mt-3 { margin-top: 12px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 14px; }
.font-mono { font-family: var(--font-mono); }

/* ===== Print ===== */
@media print {
    .sidebar, .topbar, .page-actions, .menu-toggle, .btn { display: none !important; }
    .app { grid-template-columns: 1fr; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ===== Page load animation ===== */
.content > * { animation: rise .35s ease both; }
.content > *:nth-child(2) { animation-delay: .05s; }
.content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(4) { animation-delay: .15s; }
@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
