/* =============================================================================
   Phase 5 CSS — Attendance System
   Append to wwwroot/css/app.css  OR  add as a separate phase5.css link
   ============================================================================= */

/* ── Attendance page header ──────────────────────────────────────────────── */
.att-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

/* ── Class selector grid ─────────────────────────────────────────────────── */
.att-class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.att-class-card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s, transform .1s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.att-class-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--blue-300, #93C5FD);
    transform: translateY(-2px);
}

.att-class-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.att-class-icon {
    font-size: 22px;
}

.att-class-period {
    font-size: 11px;
    font-weight: 700;
    color: var(--slate-400);
    letter-spacing: .06em;
}

.att-class-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--slate-800);
    margin: 0;
}

.att-class-subject {
    font-size: 13px;
    color: var(--slate-600);
}

.att-class-room {
    font-size: 12.5px;
}

.att-class-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--slate-100);
}

.att-class-grade {
    font-size: 12px;
    font-weight: 600;
    background: var(--blue-50);
    color: var(--blue-700);
    padding: 3px 8px;
    border-radius: 12px;
}

/* ── Open session card (prompt) ──────────────────────────────────────────── */
.att-open-session-card {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.att-open-icon {
    font-size: 48px;
}

.att-open-btn {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 15px;
}

.att-window-hint {
    font-size: 12.5px;
    color: var(--slate-400);
}

/* ── Session bar ─────────────────────────────────────────────────────────── */
.att-session-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.att-back {
    font-size: 13px;
    color: var(--blue-600);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    font-weight: 600;
}

.att-back:hover {
    background: var(--blue-50);
}

.att-session-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.att-session-info strong {
    font-size: 15px;
    color: var(--slate-800);
}

/* ── Summary pills ───────────────────────────────────────────────────────── */
.att-summary-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

.att-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    min-width: 52px;
}

.att-pill-count {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
}

.att-pill-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.att-pill--present {
    background: var(--green-100);
    color: var(--green-700);
}

.att-pill--absent {
    background: var(--red-100);
    color: var(--red-600);
}

.att-pill--tardy {
    background: var(--orange-100);
    color: var(--orange-700);
}

.att-pill--unmarked {
    background: var(--slate-100);
    color: var(--slate-600);
}

/* ── Attendance progress bar ─────────────────────────────────────────────── */
.att-progress-wrap {
    width: 100%;
    height: 6px;
    background: var(--slate-100);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.att-progress-bar {
    height: 100%;
    background: var(--blue-500);
    border-radius: 3px;
    transition: width .3s ease;
}

/* ── Submitted banner ────────────────────────────────────────────────────── */
.att-submitted-banner {
    background: var(--green-100);
    color: var(--green-700);
    border: 1px solid #86EFAC;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.att-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.att-filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 3px;
}

.att-filter-tab {
    padding: 6px 14px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--slate-600);
    cursor: pointer;
    transition: background .1s, color .1s;
    white-space: nowrap;
}

.att-filter-tab.active {
    background: var(--blue-600);
    color: var(--white);
    font-weight: 600;
}

.att-toolbar-actions {
    display: flex;
    gap: 10px;
}

.att-submit-btn {
    background: var(--green-700);
}

.att-submit-btn:hover:not(:disabled) {
    background: #15803D;
}

/* ── Leader exception request card ────────────────────────────────────────── */
.att-exception-card {
    margin-bottom: 12px;
    padding: 14px;
}

.att-exception-header {
    margin-bottom: 8px;
}

.att-exception-header p {
    margin: 4px 0 0;
    font-size: 13px;
}

.att-exception-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.att-request-btn {
    background: var(--red-600);
    color: var(--white);
    border-color: var(--red-600);
}

.att-request-btn:hover:not(:disabled) {
    background: #B91C1C;
}

/* ── Roster container ────────────────────────────────────────────────────── */
.att-roster {
    padding: 0;
    overflow: hidden;
}

.att-roster-header {
    display: grid;
    grid-template-columns: 1fr 160px 120px;
    padding: 10px 16px;
    background: var(--slate-50);
    border-bottom: 1px solid var(--slate-200);
    font-size: 11.5px;
    font-weight: 700;
    color: var(--slate-500);
    letter-spacing: .05em;
    text-transform: uppercase;
}

.att-header-actions {
    text-align: center;
}

.att-header-time {
    text-align: right;
    padding-right: 8px;
}

/* ── Student row ─────────────────────────────────────────────────────────── */
.student-row {
    display: grid;
    grid-template-columns: 4px 1fr 160px 120px;
    align-items: center;
    border-bottom: 1px solid var(--slate-100);
    transition: background .1s;
    min-height: 52px;
}

.student-row:last-child {
    border-bottom: none;
}

.student-row:hover {
    background: var(--slate-50);
}

.student-row--disabled {
    opacity: .6;
}


/* Left colour strip */
.student-status-strip {
    height: 100%;
    min-height: 52px;
    border-radius: 0;
    width: 4px;
}

.strip-present {
    background: var(--green-700);
}

.strip-absent {
    background: var(--red-600);
}

.strip-tardy {
    background: var(--orange-700);
}

.strip-unmarked {
    background: var(--slate-200);
}

/* Student info cell */
.student-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    min-width: 0;
}

.student-code {
    font-size: 11px;
    font-weight: 700;
    color: var(--slate-400);
    flex-shrink: 0;
}

.student-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--slate-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tier badge */
.tier-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

.tier-badge--honors,
.tier-badge--1 {
    background: #FEF9C3;
    color: #854D0E;
}

.tier-badge--2 {
    background: var(--blue-100);
    color: var(--blue-700);
}

.tier-badge--3 {
    background: var(--slate-100);
    color: var(--slate-600);
}

/* Mark buttons cell */
.student-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 8px;
}

.btn-mark {
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all .1s;
    background: var(--slate-100);
    color: var(--slate-500);
    min-width: 38px;
}

.btn-mark:hover:not(:disabled) {
    filter: brightness(.95);
}

.btn-mark:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.btn-mark-present {
    border-color: #86EFAC;
}

.btn-mark-absent {
    border-color: #FCA5A5;
}

.btn-mark-tardy {
    border-color: #FCD34D;
}

.btn-mark-present.btn-mark--active {
    background: var(--green-700);
    color: var(--white);
    border-color: var(--green-700);
}

.btn-mark-absent.btn-mark--active {
    background: var(--red-600);
    color: var(--white);
    border-color: var(--red-600);
}

.btn-mark-tardy.btn-mark--active {
    background: #D97706;
    color: var(--white);
    border-color: #D97706;
}

/* Marked-at cell */
.student-marked-at {
    text-align: right;
    padding-right: 14px;
    font-size: 11.5px;
    color: var(--slate-400);
}

/* ── Countdown Timer component ───────────────────────────────────────────── */
.countdown-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--white);
    border: 2px solid var(--slate-200);
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    min-width: 160px;
    text-align: center;
    transition: border-color .3s;
}

.countdown-block--warning {
    border-color: #FCD34D;
    background: #FFFBEB;
}

.countdown-block--critical {
    border-color: #FCA5A5;
    background: #FEF2F2;
}

.countdown-block--expired {
    border-color: var(--slate-300);
    background: var(--slate-50);
}

.countdown-block--submitted {
    border-color: #86EFAC;
    background: #F0FDF4;
}

.countdown-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--slate-500);
    margin-bottom: 2px;
}

.countdown-time {
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    line-height: 1;
}

.countdown-time--green {
    color: var(--green-700);
}

.countdown-time--amber {
    color: #D97706;
}

.countdown-time--red {
    color: var(--red-600);
}

.countdown-progress-wrap {
    width: 100%;
    height: 4px;
    background: var(--slate-100);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.countdown-progress-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 1s linear, background .3s;
}

.countdown-hint {
    font-size: 10.5px;
    color: var(--slate-400);
    margin-top: 4px;
}

/* ── History page: extra column colours ──────────────────────────────────── */
.text-present {
    color: var(--green-700);
    font-weight: 700;
}

.text-absent {
    color: var(--red-600);
    font-weight: 700;
}

.text-tardy {
    color: #D97706;
    font-weight: 700;
}

.badge-expired {
    background: var(--slate-100);
    color: var(--slate-500);
}

/* ── Alert extras ────────────────────────────────────────────────────────── */
.alert-success {
    background: var(--green-100);
    color: var(--green-700);
    border: 1px solid #86EFAC;
}

.alert-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: auto;
    color: inherit;
    font-size: 14px;
    padding: 0 4px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .att-session-bar {
        flex-wrap: wrap;
    }

    .att-summary-pills {
        margin-left: 0;
    }

    .att-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .att-filter-tabs {
        overflow-x: auto;
    }

    .att-toolbar-actions {
        flex-direction: column;
    }

    .att-exception-actions {
        flex-direction: column;
    }

    .att-roster-header {
        grid-template-columns: 1fr 120px 80px;
    }

    .student-row {
        grid-template-columns: 4px 1fr 120px 80px;
    }

    .student-marked-at {
        font-size: 10px;
    }
}

@media (max-width: 768px) {

    /* Page header stacks vertically */
    .att-page-header {
        flex-direction: column;
        gap: 10px;
    }

    /* Class grid: single column */
    .att-class-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .att-class-card {
        padding: 16px;
    }

    /* Session bar: compact stack */
    .att-session-bar {
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }

    .att-session-info {
        width: 100%;
    }

    /* Summary pills: 2×2 grid */
    .att-summary-pills {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    .att-pill {
        justify-content: center;
    }

    /* Progress bar full width */
    .att-progress-wrap {
        width: 100%;
    }

    /* Toolbar: full width actions */
    .att-toolbar {
        padding: 12px;
        gap: 10px;
    }

    .att-toolbar-actions {
        flex-direction: column;
        width: 100%;
    }

    .att-toolbar-actions .btn-primary,
    .att-toolbar-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    /* Filter tabs: scrollable, tighter */
    .att-filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
    }

    .att-filter-tabs::-webkit-scrollbar {
        display: none;
    }

    .att-filter-tab {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
    }

    /* Exception card compact */
    .att-exception-card {
        padding: 14px;
    }

    .att-exception-actions {
        gap: 8px;
    }

    /* Roster compact */
    .att-roster {
        padding: 0;
    }

    .att-roster-header {
        padding: 10px 12px;
    }

    /* Open session card compact */
    .att-open-session-card {
        padding: 20px;
    }

    .att-open-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .att-roster-header {
        grid-template-columns: 1fr 100px;
    }

    .att-header-time {
        display: none;
    }

    .student-row {
        grid-template-columns: 4px 1fr 100px;
    }

    .student-marked-at {
        display: none;
    }

    .countdown-block {
        min-width: 130px;
        padding: 10px 14px;
    }

    .countdown-time {
        font-size: 22px;
    }

    /* Compact pill buttons */
    .btn-mark {
        min-width: 30px;
        width: 30px;
        height: 30px;
        padding: 0;
        border-radius: 50%;
        font-size: 11px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .student-actions {
        gap: 3px;
        padding: 0 4px;
    }

    /* Student info tighter */
    .student-info {
        gap: 4px;
        padding: 0 6px;
    }

    .student-name {
        font-size: 12.5px;
    }

    .student-code {
        font-size: 10px;
    }

    .tier-badge {
        font-size: 9px;
        padding: 1px 5px;
    }

    /* Summary pills even tighter */
    .att-pill {
        padding: 6px 8px;
    }

    .att-pill-count {
        font-size: 16px;
    }

    .att-pill-label {
        font-size: 10px;
    }
}