/* ============================================================
   MY ATTENDANCE PAGE STYLES
   Page-specific CSS for the my attendance section.
   Use tokens from tokens.css and classes from components.css.
   ============================================================ */

    /* ── Month navigator ── */
    .ma-month-nav {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 20px;
    }

    .ma-month-label {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-primary, #1a1a2e);
        min-width: 160px;
        text-align: center;
    }

    .ma-nav-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border: 1px solid var(--border-color, #e2e8f0);
        border-radius: 8px;
        background: #fff;
        color: var(--text-primary, #1a1a2e);
        cursor: pointer;
        transition: background 0.15s, border-color 0.15s;
    }

    .ma-nav-btn:hover:not(:disabled) {
        background: #f1f5f9;
        border-color: #cbd5e1;
    }

    .ma-nav-btn:disabled {
        opacity: 0.38;
        cursor: not-allowed;
    }

    /* ── Stat cards colour variants ── */
    .dash-stat-icon-blue {
        background: #eff6ff;
        color: #2563eb;
    }

    .dash-stat-icon-purple {
        background: #f5f3ff;
        color: #7c3aed;
    }

    /* ── Flags (mirrors Attendance.razor scoped CSS) ── */
    .at-flag {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 20px;
        height: 20px;
        padding: 0 0.3rem;
        border-radius: 4px;
        font-size: 0.72rem;
        font-weight: 700;
    }

    .at-flag--grace    { background: #fef9c3; color: #a16207; }
    .at-flag--late     { background: #fef3c7; color: #92400e; }
    .at-flag--verylate { background: #fee2e2; color: #991b1b; }
    .at-flag--early    { background: #fee2e2; color: #991b1b; }

    /* Flags td - flex so badges sit side by side */
    td.at-flags-cell {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-wrap: wrap;
    }

    /* ── Status badge base ── */
    .at-status-badge {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.78rem;
        font-weight: 600;
    }

    /* ── Pagination ── */
    .at-pagination {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 16px;
        padding: 14px 0;
        border-top: 1px solid var(--border-color, #e2e8f0);
    }

    .at-page-btn {
        padding: 6px 14px;
        border: 1px solid var(--border-color, #e2e8f0);
        border-radius: 6px;
        background: #fff;
        color: var(--text-primary, #1a1a2e);
        font-size: 0.85rem;
        cursor: pointer;
        transition: background 0.15s;
    }

    .at-page-btn:hover:not(:disabled) {
        background: #f1f5f9;
    }

    .at-page-btn:disabled {
        opacity: 0.38;
        cursor: not-allowed;
    }

    .at-page-info {
        font-size: 0.85rem;
        color: var(--text-secondary, #64748b);
    }

    /* ── Status badge colours ── */
    .at-status-badge.at-status-checkedin {
        background: #dcfce7;
        color: #15803d;
    }

    .at-status-badge.at-status-checkedout {
        background: #f1f5f9;
        color: #475569;
    }

    .at-status-badge.at-status-autoclosed {
        background: #fef9c3;
        color: #92400e;
    }

    /* ── Active badge ── */
    .at-active-badge {
        display: inline-block;
        padding: 2px 8px;
        background: #dcfce7;
        color: #15803d;
        border-radius: 4px;
        font-size: 0.78rem;
        font-weight: 600;
    }

    /* ── Empty state ── */
    .at-empty-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 48px 24px;
        color: var(--text-secondary, #64748b);
        font-size: 0.95rem;
    }

    /* ── Dispute button per row ── */
    .ma-dispute-btn {
        padding: 3px 10px;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        background: #fff;
        color: #64748b;
        font-size: 0.78rem;
        font-weight: 600;
        cursor: pointer;
        white-space: nowrap;
        transition: background 0.12s, border-color 0.12s;
    }

    .ma-dispute-btn:hover {
        background: #fef3c7;
        border-color: #f59e0b;
        color: #92400e;
    }

    /* ── My Disputes status badges ── */
    .ma-dispute-status {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.78rem;
        font-weight: 600;
    }

    .ma-dispute-status-pending               { background: #fef3c7; color: #92400e; }
    .ma-dispute-status-approved              { background: #dcfce7; color: #15803d; }
    .ma-dispute-status-rejected              { background: #fee2e2; color: #991b1b; }
    .ma-dispute-status-approvedwithmodification { background: #dbeafe; color: #1d4ed8; }

    /* ── Dispute modal (shares st-modal pattern) ── */
    .st-modal {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .st-modal-dialog {
        background: #fff;
        border-radius: 12px;
        width: 100%;
        max-width: 480px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    }

    .st-modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 18px 24px 14px;
        border-bottom: 1px solid #e2e8f0;
    }

    .st-modal-header h3 {
        font-size: 1rem;
        font-weight: 700;
        color: #1a1a2e;
        margin: 0;
    }

    .st-modal-body {
        padding: 20px 24px;
    }

    .st-modal-footer {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        padding: 14px 24px 18px;
        border-top: 1px solid #e2e8f0;
    }

    /* Shared form field helpers (mirrors Disputes.razor) */
    .dp-field {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .dp-field label {
        font-size: 0.82rem;
        font-weight: 600;
        color: #374151;
    }

    .dp-time-row {
        display: flex;
        gap: 12px;
    }

    .dp-time-input, .dp-textarea {
        width: 100%;
        padding: 7px 10px;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        font-size: 0.875rem;
        background: #fff;
        color: #1a1a2e;
        box-sizing: border-box;
    }

    .dp-time-input:focus, .dp-textarea:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
    }

    .dp-textarea {
        resize: vertical;
        font-family: inherit;
    }

    .dp-error {
        margin-top: 8px;
        padding: 8px 12px;
        background: #fee2e2;
        color: #991b1b;
        border-radius: 6px;
        font-size: 0.85rem;
    }

    .dp-static-value {
        padding: 7px 10px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        font-size: 0.875rem;
        color: #374151;
    }

    /* ── Loading ── */
    .at-loading {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 40px;
        justify-content: center;
        color: var(--text-secondary, #64748b);
    }

    .at-spinner {
        width: 22px;
        height: 22px;
        border: 3px solid #e2e8f0;
        border-top-color: #3b82f6;
        border-radius: 50%;
        animation: spin 0.7s linear infinite;
    }

    @keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .ma-month-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Bottom sheet modal */
    .st-modal {
        align-items: flex-end;
        padding: 0;
    }

    .st-modal-dialog {
        border-radius: 16px 16px 0 0 !important;
        max-height: 85vh;
        width: 100% !important;
        max-width: 100% !important;
        overflow-y: auto;
    }
}

@media (max-width: 640px) {
    .dp-time-row {
        flex-direction: column;
        gap: 12px;
    }

    .dp-time-row .dp-field {
        width: 100%;
    }
}
