/* ===== Global Font Size ===== */
html, body {
    font-size: 12px !important;
}

/* ===== Validation ===== */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

/* ===== Error UI ===== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ===== Stat Cards ===== */
.stat-card {
    border-radius: 16px;
    padding: 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.stat-card::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}
.stat-card-blue   { background: linear-gradient(135deg, #1565C0, #1e88e5); }
.stat-card-cyan   { background: linear-gradient(135deg, #0277BD, #039be5); }
.stat-card-purple { background: linear-gradient(135deg, #7B1FA2, #AB47BC); }
.stat-card-green  { background: linear-gradient(135deg, #2E7D32, #43a047); }
.stat-card-orange { background: linear-gradient(135deg, #E65100, #F57F17); }

/* ===== Attendance Cards ===== */
.attendance-card {
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}
.attendance-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.stat-badge {
    border-radius: 8px;
    padding: 6px 12px;
    text-align: center;
    min-width: 60px;
}

/* ===== Compact Table ===== */
.compact-table .mud-table-cell {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    font-size: 0.8rem;
    line-height: 1.3;
}
.compact-table .mud-table-head .mud-table-cell {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
}
.compact-table td {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    font-size: 0.8rem;
    line-height: 1.3;
}
.compact-table th {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
}

/* Size a date-picker INPUT without constraining its calendar popover
   (a width on the picker root clips the month label & day columns). */
.date-input .mud-input-control { width: 175px; }

/* ===== Filter / toolbar bar ===== */
/* Filters grouped tight on the left, action buttons pushed to the right. */
.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.filter-bar .filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.filter-bar .filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;   /* push action buttons to the right edge */
}
/* keep filter fields snug at their set width, never stretch */
.filter-bar .filter-group .mud-input-control { flex: 0 0 auto; }

/* ===== Page Headers ===== */
.page-header-title {
    font-weight: 700 !important;
    font-size: 1.6rem !important;
}
.page-header-desc {
    color: var(--mud-palette-text-secondary);
    margin-top: 4px;
}

/* ===== Nav Drawer Brand ===== */
.nav-brand {
    padding: 12px 14px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1565C0, #7C4DFF);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.nav-brand-text {
    font-weight: 700;
    font-size: 1rem;
    color: var(--mud-palette-text-primary);
}
.nav-brand-sub {
    font-size: 0.65rem;
    color: var(--mud-palette-text-secondary);
    margin-top: -2px;
}

/* ===== Mini Drawer ===== */
.mud-drawer--closed .mud-drawer-content {
    width: 56px !important;
}
.mud-drawer--closed .mud-nav-link {
    justify-content: center !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
}

/* ===== Compact Nav Links ===== */
.mud-navmenu .mud-nav-link {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    min-height: 34px !important;
    font-size: 13px !important;
}

/* ===== Drawer Scrollbar ===== */
.mud-drawer-content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
.mud-drawer-content::-webkit-scrollbar { width: 4px; }
.mud-drawer-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
}
.mud-navmenu { overflow: visible !important; }
.mud-nav-link {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* ===== Popover z-index fix ===== */
.mud-popover-open { z-index: 1600 !important; }

/* ===== Account Page ===== */
.account-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0d47a1 0%, #1565C0 30%, #1e88e5 60%, #7C4DFF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.account-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 40px;
    width: 100%;
    max-width: 480px;
}
.account-brand {
    text-align: center;
    margin-bottom: 24px;
}
.account-brand h3 {
    color: #1565C0;
    font-weight: 700;
    font-size: 1.8rem;
    margin: 8px 0 4px;
}
.account-brand p {
    color: #6b7280;
    font-size: 0.9rem;
    margin: 0;
}

/* ── Public marketing / legal pages (Home, Privacy, Terms, Contact) ── */
.public-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f7f9fc;
    color: #1f2937;
    font-size: 16px;
}
.public-container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}
.public-header {
    background: linear-gradient(90deg, #0d47a1, #1565C0);
    box-shadow: 0 1px 6px rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
    z-index: 10;
}
.public-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.public-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
}
.public-brand-mark { font-size: 1.3rem; }
.public-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.public-nav a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 0.95rem;
}
.public-nav a:hover { color: #fff; text-decoration: underline; }
.public-nav-cta {
    background: rgba(255,255,255,0.18);
    padding: 6px 14px;
    border-radius: 20px;
}
.public-main { flex: 1; padding: 32px 0 56px; }
.public-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 18px 0;
    font-size: 0.85rem;
}
.public-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.public-footer-nav { display: flex; gap: 16px; }
.public-footer-nav a { color: #cbd5e1; text-decoration: none; }
.public-footer-nav a:hover { color: #fff; text-decoration: underline; }

/* Content blocks */
.public-hero {
    text-align: center;
    padding: 40px 0 24px;
}
.public-hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    margin: 0 0 12px;
    color: #0d47a1;
    line-height: 1.15;
}
.public-hero p { font-size: 1.15rem; color: #475569; max-width: 720px; margin: 0 auto 20px; }
.public-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 28px 0;
}
.public-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.public-card h3 { margin: 0 0 8px; font-size: 1.05rem; color: #0d47a1; }
.public-card p { margin: 0; color: #64748b; font-size: 0.95rem; }
.public-badges { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.public-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #111827;
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
}

/* Legal / article pages */
.public-article {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.public-article h1 { font-size: 1.9rem; color: #0d47a1; margin: 0 0 4px; }
.public-article .public-effective { color: #94a3b8; font-size: 0.85rem; margin-bottom: 20px; }
.public-article h2 { font-size: 1.2rem; color: #1e293b; margin: 26px 0 8px; }
.public-article p, .public-article li { color: #374151; line-height: 1.7; }
.public-article ul { padding-left: 22px; }
.public-contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.public-contact-item { display: flex; align-items: flex-start; gap: 10px; }
.public-contact-item .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; }
.public-contact-item a, .public-contact-item span { color: #1f2937; }

@media (max-width: 600px) {
    .public-hero h1 { font-size: 1.8rem; }
    .public-hero p { font-size: 1rem; }
    .public-article { padding: 20px; }
    .public-nav { gap: 12px; }
    .public-brand span:not(.public-brand-mark) { display: inline; }
}

/* ── Home page colour banner ── */
.home-banner {
    border-radius: 18px;
    margin: 8px 0 28px;
    padding: 56px 28px;
    text-align: center;
    color: #fff;
    background: linear-gradient(120deg, #0d47a1 0%, #1976d2 45%, #7b1fa2 100%);
    box-shadow: 0 12px 30px rgba(13, 71, 161, 0.28);
    position: relative;
    overflow: hidden;
}
.home-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(255,255,255,0.18), transparent 38%),
        radial-gradient(circle at 85% 80%, rgba(255,255,255,0.14), transparent 40%);
    pointer-events: none;
}
.home-banner-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.home-banner-pill {
    display: inline-block;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.35);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 16px;
    backdrop-filter: blur(2px);
}
.home-banner h1 {
    font-size: 2.6rem;
    font-weight: 800;
    margin: 0 0 14px;
    line-height: 1.12;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.home-banner p {
    font-size: 1.15rem;
    color: rgba(255,255,255,0.92);
    max-width: 640px;
    margin: 0 auto 24px;
}
.home-banner-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 28px;
    font-weight: 600;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease;
}
.home-btn:hover { transform: translateY(-2px); }
.home-btn-primary {
    background: #ffca28;
    color: #1a237e;
    box-shadow: 0 6px 16px rgba(255, 202, 40, 0.4);
}
.home-btn-ghost {
    background: rgba(255,255,255,0.14);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.55);
}
.home-btn-ghost:hover { background: rgba(255,255,255,0.24); }

@media (max-width: 600px) {
    .home-banner { padding: 40px 18px; }
    .home-banner h1 { font-size: 1.9rem; }
    .home-banner p { font-size: 1rem; }
}

/* The router auto-focuses the first h1 on navigation; hide the focus ring on the home banner. */
.home-banner h1:focus,
.home-banner h1:focus-visible {
    outline: none;
}

/* ── Responsive filter bar: inline filters on desktop, collapse-behind-icon on mobile ── */
/* Desktop (default): show the inline row, hide the mobile block. */
.responsive-filter-bar .filter-row-desktop {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.responsive-filter-bar .filter-row-mobile { display: none; }

@media (max-width: 768px) {
    /* Mobile: hide the inline desktop row, show the compact mobile block. */
    .responsive-filter-bar .filter-row-desktop { display: none; }
    .responsive-filter-bar .filter-row-mobile { display: block; }
}

/* ── Responsive dialogs: go near-fullscreen on phones so wide content (tables/forms) fits ── */
@media (max-width: 768px) {
    .mud-dialog {
        width: 100% !important;
        max-width: 100% !important;
        margin: 8px !important;
        max-height: calc(100vh - 16px) !important;
    }
    .mud-dialog .mud-dialog-content {
        max-height: calc(100vh - 140px);
        overflow-y: auto;
    }
    /* Let any table inside a dialog scroll horizontally rather than overflow the screen. */
    .mud-dialog .mud-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* Form fields inside dialogs shouldn't keep desktop fixed widths on mobile. */
    .mud-dialog .mud-input-control,
    .mud-dialog .mud-select { max-width: 100% !important; }
}
