/* =========================================================
   EaseSAMS - Ease Software Solutions theme (same as EaseLaundry / EaseParking)
   Navy header/footer, orange accents, red icon tiles,
   switchable light / dark background (data-bs-theme).
   ========================================================= */
:root {
    --ease-navy: #0b1a6b;
    --ease-navy-2: #13238f;
    --ease-orange: #f7941d;
    --ease-gold: #ffb020;
    --ease-red: #d92525;
    --ease-sky: #1ea7e1;
    --ease-cta: linear-gradient(90deg, #0f8f6f 0%, #1d3fb8 55%, #1597f0 100%);

    /* "Primary" color used by buttons, tabs, focus rings */
    --brand: rgb(11, 26, 107);
    --brand-rgb: 11, 26, 107;
    --brand-dark: rgb(8, 19, 80);
    --brand-contrast: #ffffff;

    --bs-link-color-rgb: var(--brand-rgb);
    --bs-link-hover-color-rgb: var(--brand-rgb);
    --footer-h: 36px;
}

/* Brighter primary on dark backgrounds so buttons stay visible */
html[data-bs-theme="dark"] {
    --brand: rgb(59, 91, 219);
    --brand-rgb: 59, 91, 219;
    --brand-dark: rgb(47, 73, 175);
    --brand-contrast: #ffffff;
    --bs-link-color-rgb: 147, 170, 255;
    --bs-link-hover-color-rgb: 180, 196, 255;
}

html { font-size: 15px; }
body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    padding-bottom: calc(var(--footer-h) + 24px);
    transition: background-color .25s ease, color .25s ease;
}
html[data-bs-theme="light"] body { background: #eef2f7; }
html[data-bs-theme="dark"] body { background: #0f172a; }

/* ---------- Cards and tables in dark mode ---------- */
.card { border-radius: .7rem; }
html[data-bs-theme="dark"] .card { background-color: #1a2438; border-color: #2c3a55; }
html[data-bs-theme="dark"] .bg-white { background-color: #1a2438 !important; }
html[data-bs-theme="dark"] .table { --bs-table-bg: transparent; }
html[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #22304a;
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: #2c3a55;
}
html[data-bs-theme="dark"] .list-group-item { background-color: #1a2438; border-color: #2c3a55; }
html[data-bs-theme="dark"] .list-group-item.bg-light { background-color: #22304a !important; }
.stat-label { font-size: .85rem; }
.table > :not(caption) > * > * { vertical-align: middle; }

/* ---------- Bootstrap "primary" mapped to the Ease navy ---------- */
.bg-primary, .text-bg-primary {
    background-color: var(--brand) !important;
    color: var(--brand-contrast) !important;
}
.text-primary { color: var(--brand) !important; }
.border-primary { border-color: var(--brand) !important; }
.bg-primary-subtle { background-color: rgba(var(--brand-rgb), .10) !important; }

.btn-primary {
    --bs-btn-color: var(--brand-contrast);
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: var(--brand-contrast);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-color: var(--brand-contrast);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-color: var(--brand-contrast);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: var(--brand-contrast);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-color: var(--brand-contrast);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
html[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #93aaff; --bs-btn-border-color: #5b78e6; }
.nav-pills {
    --bs-nav-pills-link-active-bg: var(--brand);
    --bs-nav-pills-link-active-color: var(--brand-contrast);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .25rem rgba(var(--brand-rgb), .25);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.dropdown-item:active { background-color: var(--brand); color: var(--brand-contrast); }

/* ---------- Header (navy bar) ---------- */
.app-header {
    background: var(--ease-navy);
    border-bottom: 1px solid rgba(255, 255, 255, .18);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.app-header .navbar-brand { color: #fff; font-weight: 600; letter-spacing: .02em; }
.app-header .nav-link { color: rgba(255, 255, 255, .82); }
.app-header .nav-link:hover { color: #fff; }
.app-header .nav-link.active { color: var(--ease-gold) !important; font-weight: 600; }
.header-logo { height: 34px; width: auto; max-width: 140px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px 4px; }
.dash-logo { height: 64px; width: auto; max-width: 180px; object-fit: contain; }
.company-line { font-weight: 600; letter-spacing: .03em; opacity: .85; }

/* Public header: home icon | title | lock icon */
.public-header .bar { height: 56px; }
.public-header .hdr-icon { color: #fff; font-size: 1.35rem; text-decoration: none; }
.public-header .hdr-icon:hover { color: var(--ease-gold); }
.public-header .hdr-title { color: #fff; font-size: 1.25rem; font-weight: 500; letter-spacing: .02em; }

/* ---------- Fixed footer ---------- */
.app-footer {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--footer-h);
    background: var(--ease-navy);
    color: #fff;
    font-size: .9rem;
    border-top: 1px solid rgba(255, 255, 255, .18);
    z-index: 1030;
}
.app-footer a { color: var(--ease-gold); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
@media (max-width: 576px) { .app-footer { font-size: .72rem; } }

/* ---------- Light / Dark toggle (red-bordered pill) ---------- */
.btn-theme-toggle {
    background: #0f172a;
    color: #fff;
    border: 2px solid var(--ease-red);
    border-radius: 999px;
    padding: .4rem 1.15rem;
    font-weight: 600;
}
.btn-theme-toggle:hover { background: #1e293b; color: #fff; border-color: var(--ease-red); }
.btn-theme-toggle-sm { padding: .15rem .7rem; font-size: .85rem; }

/* ---------- Gradient call-to-action button ---------- */
.btn-ease {
    background: var(--ease-cta);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: .8rem 2.6rem;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(29, 63, 184, .35);
    transition: filter .15s ease, transform .15s ease;
}
.btn-ease:hover, .btn-ease:focus { color: #fff; filter: brightness(1.1); transform: translateY(-1px); }

/* ---------- Landing hero card ---------- */
.hero-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 3rem 2rem 2rem;
    background: linear-gradient(135deg, #e7fbff 0%, #fffbe9 42%, #fff7ea 70%, #f1f5fb 100%);
    color: #1e293b;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.hero-card::before, .hero-card::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(18px);
    pointer-events: none;
}
.hero-card::before { width: 280px; height: 280px; top: -70px; right: -50px; background: radial-gradient(circle, rgba(232, 80, 80, .35), transparent 70%); }
.hero-card::after { width: 320px; height: 320px; bottom: -120px; left: -90px; background: radial-gradient(circle, rgba(247, 148, 29, .40), transparent 70%); }
.hero-card > * { position: relative; z-index: 1; }
.hero-card .lead-text { color: #475569; max-width: 820px; margin: 0 auto; }
.hero-card .small-note { color: #64748b; font-size: .8rem; }

html[data-bs-theme="dark"] .hero-card {
    background: linear-gradient(135deg, #142247 0%, #1b2552 50%, #221d42 100%);
    color: #e2e8f0;
}
html[data-bs-theme="dark"] .hero-card .lead-text { color: #cbd5e1; }
html[data-bs-theme="dark"] .hero-card .small-note { color: #94a3b8; }

.feature-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.1rem 1.1rem 1.2rem;
    text-align: left;
    height: 100%;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}
.feature-card h6 { font-weight: 600; margin-bottom: .35rem; color: #0f172a; }
.feature-card p { font-size: .88rem; color: #64748b; margin: 0; }
html[data-bs-theme="dark"] .feature-card { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); }
html[data-bs-theme="dark"] .feature-card h6 { color: #f1f5f9; }
html[data-bs-theme="dark"] .feature-card p { color: #a5b4c8; }
.feature-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--ease-red);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: .8rem;
}

/* ---------- Logo + wordmark ---------- */
/* Logos from Settings can be square or wide: limit the height, let the width follow */
.company-logo { height: 130px; width: auto; max-width: 300px; object-fit: contain; }
.company-logo-sm { height: 70px; width: auto; max-width: 200px; object-fit: contain; }
.wordmark {
    font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif;
    font-style: italic;
    font-size: clamp(2.6rem, 6vw, 4.6rem);
    line-height: .95;
    letter-spacing: -1px;
}
.wordmark-sm { font-size: 2.2rem; }
.wordmark .w1 { color: var(--ease-navy); }
.wordmark .w2 { color: var(--ease-orange); }
html[data-bs-theme="dark"] .wordmark .w1 { color: #ffffff; }
.wordmark-tag { font-weight: 700; font-size: .95rem; }

/* ---------- Claim slip / receipt ---------- */
.slip { max-width: 380px; font-family: "Courier New", monospace; }
.slip-items th { border-bottom: 1px dashed currentColor; font-weight: 600; padding-bottom: 2px; }
.slip-logo { max-height: 60px; max-width: 200px; object-fit: contain; }

/* ---------- Report header ---------- */
.report-logo { max-height: 70px; max-width: 180px; object-fit: contain; }

@media print {
    .report-header, .report-header * { color: #000 !important; }
    .card, .table { --bs-table-bg: #fff; --bs-table-color: #000; color: #000 !important; }
    body { background: #fff !important; padding-bottom: 0; }
    .card { border: none !important; box-shadow: none !important; background: #fff !important; }
    .slip, .slip * { color: #000 !important; }
    .slip { max-width: 100%; }
}

/* ---------- Cancelled order stamp ---------- */
.cancel-stamp {
    border: 2px solid var(--ease-red);
    color: var(--ease-red);
    border-radius: 8px;
    padding: .5rem .75rem;
    text-align: center;
    background: rgba(217, 37, 37, .06);
}
@media print { .cancel-stamp, .cancel-stamp * { color: #000 !important; border-color: #000 !important; } }

/* =========================================================
   Student attendance additions (same Ease colors)
   ========================================================= */

/* Second call-to-action on the landing page (parent portal) */
.btn-ease-alt { background: linear-gradient(90deg, #f7941d 0%, #d92525 100%); box-shadow: 0 8px 22px rgba(217, 37, 37, .30); }

/* Student photos */
.student-photo-sm, .student-photo-lg, .student-photo-xl { object-fit: cover; border-radius: 50%; background: #e2e8f0; }
.student-photo-sm { width: 40px; height: 40px; }
.student-photo-lg { width: 96px; height: 96px; }
.student-photo-xl { width: 150px; height: 150px; border: 4px solid var(--ease-orange); }
.student-photo-empty { display: flex; align-items: center; justify-content: center; color: #94a3b8; }
.student-photo-sm.student-photo-empty { font-size: 1.3rem; }
.student-photo-lg.student-photo-empty { font-size: 3rem; }
.student-photo-xl.student-photo-empty { font-size: 5rem; }
html[data-bs-theme="dark"] .student-photo-empty { background: #22304a; color: #64748b; }

/* Roll call */
.rollcall-table td { padding-top: .55rem; padding-bottom: .55rem; }
.btn-tap { min-width: 104px; font-weight: 600; padding: .5rem .8rem; }
.row-present > td { background-color: rgba(25, 135, 84, .07) !important; }
.row-absent > td { background-color: rgba(220, 53, 69, .07) !important; }
.tap-card .modal-body { padding: 2rem 1.5rem; }
.btn-tap-big { width: 150px; height: 110px; font-size: 1.25rem; font-weight: 700; border-radius: 16px; }
.btn-tap-big i { font-size: 2.2rem; }

/* Messages (staff page and parent portal) */
.thread-list { max-height: 65vh; overflow-y: auto; }
.thread-list .active-thread { background: rgba(var(--brand-rgb), .10); border-left: 4px solid var(--ease-orange); }
.chat-box { height: 55vh; min-height: 300px; overflow-y: auto; background: rgba(var(--brand-rgb), .03); }
.chat-row { display: flex; margin-bottom: .75rem; }
.chat-row.mine { justify-content: flex-end; }
.chat-bubble { max-width: 75%; padding: .55rem .8rem; border-radius: 14px; background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); }
.chat-row.mine .chat-bubble { background: var(--brand); color: var(--brand-contrast); border-color: var(--brand); border-bottom-right-radius: 4px; }
.chat-row.theirs .chat-bubble { border-bottom-left-radius: 4px; }
.chat-meta { font-size: .75rem; opacity: .8; margin-bottom: .15rem; }
.chat-text { white-space: pre-wrap; word-wrap: break-word; }

/* Parent portal cards (print 2 per row on A4) */
.portal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.portal-card { border: 2px solid var(--ease-navy); border-radius: 12px; padding: 10px 12px; background: #fff; color: #0f172a; break-inside: avoid; page-break-inside: avoid; }
.portal-card .pc-head { border-bottom: 2px solid var(--ease-orange); padding-bottom: 6px; }
.portal-card .pc-logo { height: 38px; width: auto; max-width: 80px; object-fit: contain; }
.portal-card .pc-qr { width: 110px; height: 110px; image-rendering: pixelated; }
.portal-card .pc-name { font-size: 1.05rem; }
.pc-small { font-size: .75rem; color: #475569; }
.pc-brand { font-family: Impact, "Arial Black", sans-serif; font-style: italic; }
.pc-brand .w1 { color: var(--ease-navy); }
.pc-brand .w2 { color: var(--ease-orange); }
html[data-bs-theme="dark"] .card .pc-brand .w1 { color: #fff; }
@media print {
    .portal-cards { grid-template-columns: 1fr 1fr; gap: 6mm; }
    .portal-card, .portal-card * { color: #000 !important; }
    .portal-card { border-color: #000; }
}

/* Reports (FastReport): loading spinner and PDF viewer */
.loading-spinner {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(11, 26, 107, .55);
    align-items: center; justify-content: center;
}
.report-frame { width: 100%; height: calc(100vh - 190px); min-height: 520px; border: 0; border-radius: .5rem; background: #fff; }

/* ---------- Face check-in ---------- */
.face-stage { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 10; }
.face-stage video, .face-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.face-stage.mirror video, .face-stage.mirror canvas { transform: scaleX(-1); }
.face-stage:fullscreen { border-radius: 0; aspect-ratio: auto; }
.face-idle { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #64748b; gap: .5rem; }
.face-idle i { font-size: 4rem; }
.face-banner { position: absolute; left: 4%; right: 4%; bottom: 5%; display: flex; align-items: center; gap: 1rem; padding: .8rem 1.1rem;
               border-radius: 14px; color: #fff; font-weight: 600; font-size: 1.1rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.face-banner.ok { background: rgba(25, 135, 84, .92); }
.face-banner.bad { background: rgba(217, 37, 37, .9); }
.face-banner.warn { background: rgba(247, 148, 29, .95); color: #111; }
.face-banner.info { background: rgba(11, 26, 107, .9); }
.face-banner .student-photo-lg { border: 3px solid #fff; flex-shrink: 0; }
.face-log { max-height: 55vh; overflow-y: auto; }
