/* ════════════════════════════════════════════════════
   Travelhawk Bus Intelligence — Auth / Post-login CSS
   Supplements global.css for authenticated pages
   ════════════════════════════════════════════════════ */

/* ── Form controls ────────────────────────────────── */
.form-control,
.form-select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    padding: 0.55rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-glow);
    background: #fff;
    outline: none;
}

.form-control::placeholder { color: #c7c7cc; }

label, .form-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.3rem;
    display: block;
}

select.form-control { appearance: auto; }

/* ── Alert variants ───────────────────────────────── */
.alert-success-th {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.alert-error-th {
    background: #fff0f3;
    border: 1px solid #ffc0cb;
    color: #a50028;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.alert-info-th {
    background: #f0f4ff;
    border: 1px solid #c7d7ff;
    color: #2a4db7;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
}

.alert-warn-th {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
}

/* ── Auth page card ───────────────────────────────── */
.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem 2.5rem;
}

.auth-card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    margin: 0 0 1.25rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--border);
}

/* ── Section divider ──────────────────────────────── */
.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--border);
    margin: 1.75rem 0 1rem;
}

/* ── Security section (register & profile) ────────── */
.security-section {
    background: rgba(204, 0, 51, 0.03);
    border-left: 3px solid var(--red);
    border-radius: 0 12px 12px 0;
    padding: 1.5rem 1.75rem;
    margin-top: 1.5rem;
}

.security-section h5 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 0.6rem;
}

.security-section .form-check-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

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

/* ── Weekday rows ─────────────────────────────────── */
.weekday-row {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 1rem;
}

/* ── Child cards ──────────────────────────────────── */
.reg-child-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.child-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.child-card-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }

.btn-remove-child {
    font-size: 0.78rem;
    color: var(--red);
    background: rgba(204, 0, 51, 0.06);
    border: 1px solid rgba(204, 0, 51, 0.2);
    padding: 0.28rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-remove-child:hover { background: rgba(204, 0, 51, 0.12); }

/* ── Form buttons ─────────────────────────────────── */
.btn-add-child {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1.5px dashed var(--border);
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    margin-bottom: 1rem;
}

.btn-add-child:hover { border-color: var(--red); color: var(--red); }

.btn-submit {
    width: 100%;
    padding: 0.85rem;
    background: var(--red);
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 2rem;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

.btn-submit:hover {
    background: var(--red-dark);
    box-shadow: 0 4px 16px rgba(204, 0, 51, 0.28);
    transform: translateY(-1px);
}

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

/* ── Schedule propagation ─────────────────────────── */
.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.day-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.day-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.btn-propagate {
    font-size: 0.73rem;
    padding: 0.28rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s, color 0.2s;
}

.btn-propagate:hover { border-color: var(--red); color: var(--red); }

.btn-reset-sched {
    font-size: 0.73rem;
    padding: 0.28rem 0.65rem;
    border-radius: 6px;
    border: 1px solid rgba(204, 0, 51, 0.25);
    background: rgba(204, 0, 51, 0.04);
    color: var(--red);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.btn-reset-sched:hover { background: rgba(204, 0, 51, 0.1); }

/* ── Data table ───────────────────────────────────── */
.th-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.th-table th {
    background: var(--bg);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    padding: 0.7rem 1rem;
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.th-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--sub);
    vertical-align: middle;
}

.th-table tr:last-child td { border-bottom: none; }
.th-table tbody tr:hover td { background: #fafafa; }
.th-table .col-center { text-align: center; }
.th-table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.th-table strong { color: var(--text); font-weight: 600; }

/* ── Table wrapper card ───────────────────────────── */
.table-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.table-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.table-card-header h5 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.1rem;
}

.table-card-header small { font-size: 0.75rem; color: var(--muted); display: block; }
.table-card-body { overflow-x: auto; }

/* ── KPI cards ────────────────────────────────────── */
.kpi-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    text-align: center;
    height: 100%;
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    letter-spacing: -1.5px;
}

.kpi-value.kpi-red { color: var(--red); }
.kpi-sub { font-size: 0.72rem; color: var(--muted); margin-top: 0.4rem; }

/* ── Chart card ───────────────────────────────────── */
.chart-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.chart-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.chart-card-header h5 { font-size: 0.9rem; font-weight: 600; color: var(--text); margin: 0 0 0.1rem; }
.chart-card-header small { font-size: 0.75rem; color: var(--muted); }
.chart-card-body { padding: 1.25rem 1.5rem; }

/* ── Admin warning banner ─────────────────────────── */
.admin-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 3px solid #f59e0b;
    color: #92400e;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* ── Code / JSON editor ───────────────────────────── */
.code-editor {
    font-family: 'Fira Code', 'JetBrains Mono', 'Courier New', monospace !important;
    font-size: 0.82rem !important;
    background: #1e1e2e !important;
    color: #cdd6f4 !important;
    border: 1px solid #313244 !important;
    border-radius: 10px !important;
    padding: 1rem !important;
    resize: vertical;
    line-height: 1.55;
    max-height: 600px;
}

.code-editor:focus {
    border-color: var(--red) !important;
    box-shadow: 0 0 0 3px var(--red-glow) !important;
    outline: none !important;
}

/* ── Badge variants ───────────────────────────────── */
.badge-th {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 100px;
}

.badge-role     { background: rgba(204,0,51,0.08); color: var(--red); }
.badge-active   { background: #dcfce7; color: #166534; }
.badge-inactive { background: var(--bg); color: var(--muted); }

/* ── Consistency score bar ────────────────────────── */
.score-bar-wrap {
    background: var(--bg);
    border-radius: 100px;
    height: 18px;
    overflow: hidden;
    min-width: 80px;
}

.score-bar {
    height: 100%;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 600;
    color: white;
}

.score-bar.good { background: #22c55e; }
.score-bar.fair { background: #f59e0b; }
.score-bar.poor { background: var(--red); }

/* ── Score legend blocks ──────────────────────────── */
.guide-block {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.guide-block .gb-value { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 0.25rem; }
.guide-block .gb-desc  { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.guide-block.gb-good { border-top: 3px solid #22c55e; }
.guide-block.gb-fair { border-top: 3px solid #f59e0b; }
.guide-block.gb-poor { border-top: 3px solid var(--red); }
.guide-block.gb-info { border-top: 3px solid #60a5fa; }

/* ── Auth page responsive ─────────────────────────── */
@media (max-width: 768px) {
    .auth-card { padding: 1.5rem 1.25rem; border-radius: 12px; }
}
