/* ============================================================
   CheckingList – Custom Styles (RTL / Arabic)
   ============================================================ */

:root {
    --primary:    #1a56db;
    --primary-dk: #1346bb;
    --success:    #057a55;
    --danger:     #c81e1e;
    --warn:       #e3a008;
    --light-bg:   #f9fafb;
    --border:     #e5e7eb;
    --text:       #111827;
    --muted:      #6b7280;
}

/* Base */
body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--light-bg);
    color: var(--text);
    direction: rtl;
}

/* Navbar */
.navbar-brand { font-weight: 700; font-size: 1.2rem; }

/* Cards */
.card {
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.card-header {
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
}

/* Login card */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a56db 0%, #0e3799 100%);
}
.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.login-card .card-header {
    background: var(--primary);
    color: #fff;
    text-align: center;
    padding: 1.5rem;
    border-radius: 16px 16px 0 0 !important;
    font-size: 1.1rem;
}
.login-logo { font-size: 3rem; }

/* Stat cards */
.stat-card {
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-card .stat-icon { font-size: 2.4rem; opacity: .85; }
.stat-card .stat-num  { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-lbl  { font-size: .85rem; opacity: .9; }

/* Attendance table */
#attendanceTable thead th {
    background: #f3f4f6;
    font-weight: 600;
    font-size: .88rem;
    white-space: nowrap;
}

@media (min-width: 768px) {
    #tableContainer {
        max-height: calc(100vh - 260px);
        overflow: auto;
    }
    #attendanceTable {
        margin-bottom: 0;
    }
    #attendanceTable thead th {
        position: sticky;
        top: 0;
        z-index: 5;
        box-shadow: inset 0 -1px 0 var(--border), 0 1px 0 rgba(0,0,0,.03);
    }
}

.row-checked { background: #ecfdf5 !important; }
.row-unchecked { background: #fff; }
.row-excused { background: #fef3c7 !important; }

.check-badge {
    display: block;
    font-size: .78rem;
    color: var(--success);
    line-height: 1.4;
}
.check-badge .who  { font-weight: 600; }
.check-badge .when { color: var(--muted); }
.check-badge.uncheck {
    color: #d97706;
}
.check-badge.uncheck .who {
    color: #d97706;
}
.check-badge.excused {
    color: #f59e0b;
}
.check-badge.excused .who {
    color: #f59e0b;
}
.check-badge.unexcused {
    color: #0ea5e9;
}
.check-badge.unexcused .who {
    color: #0ea5e9;
}

/* Buttons */
.btn-check-action {
    min-width: 130px;
    font-size: .88rem;
    font-weight: 600;
    border-radius: 8px;
}

/* Events grid */
.event-card {
    cursor: pointer;
    transition: box-shadow .2s, transform .1s;
}
.event-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    transform: translateY(-2px);
}
.event-card .event-date {
    font-size: .8rem;
    color: var(--muted);
}

/* Search bar */
#searchInput {
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: .8rem 1rem .8rem 2.8rem;
    background: #fff;
}

.search-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.search-toolbar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.search-input-wrap {
    flex: 1 1 420px;
    min-width: 0;
}

.search-input-shell {
    position: relative;
}

.search-input-icon {
    position: absolute;
    inset-inline-start: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 1rem;
    pointer-events: none;
}

.search-controls-wrap {
    flex: 0 0 180px;
}

.search-status-select {
    width: 100%;
    min-height: 50px;
    border-radius: 12px;
    font-weight: 600;
    border-color: var(--border);
    background-color: #fff;
}

.search-advanced-trigger {
    border-radius: 12px;
}

.advanced-filter-panel {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.filter-section {
    background: linear-gradient(180deg, #fbfdff 0%, #f8fafc 100%);
    border: 1px solid #e7edf3;
    border-radius: 16px;
    padding: 0.95rem 1rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.filter-section .form-label {
    font-weight: 700;
    color: #334155;
}

.filter-section .form-text {
    margin-top: 0.5rem;
}

.column-visibility-group .form-check {
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
}

.column-visibility-group .form-check-input {
    margin: 0;
    float: none;
}

.column-visibility-group .form-check-label {
    line-height: 1.2;
}

.phone-link {
    color: inherit;
    text-decoration: none;
    direction: ltr;
    unicode-bidi: isolate;
    font-weight: 600;
}

.phone-link:hover {
    text-decoration: underline;
}

.student-card .phone-link {
    color: var(--primary);
}

/* Spinner overlay */
.spinner-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}

/* Toast */
.toast-container { z-index: 10000; }

/* Sticky header (stats + search) */
#stickyHeader {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--light-bg);
    padding: 1rem 0 0 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

#statsContainer {
    margin-bottom: 0.75rem;
}

#searchContainer {
    padding: 0 0 1rem 0;
}

/* Student cards (mobile) */
.student-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #fff;
    transition: box-shadow .2s;
}
.student-card.is-present {
    background: #ecfdf5;
    border-color: var(--success);
}
.student-card.is-excused {
    background: #fef3c7;
    border-color: var(--warn);
}
.student-card .card-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: var(--text);
    line-height: 1.2;
}
.student-card .card-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.3rem;
    font-size: 0.75rem;
    margin-bottom: 0.6rem;
    color: var(--muted);
    line-height: 1.3;
}
.student-card .card-info span {
    display: flex;
    gap: 0.2rem;
}
.student-card .card-checks {
    font-size: 0.7rem;
    margin-bottom: 0.6rem;
    padding: 0.4rem;
    background: #f3f4f6;
    border-radius: 4px;
    min-height: 16px;
    line-height: 1.3;
}
.student-card .card-action {
    display: flex;
    gap: 0.4rem;
}
.student-card .card-action button {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem !important;
}

/* Responsive table */
@media (max-width: 767px) {
    .search-panel {
        padding: 0.85rem;
        border-radius: 16px;
    }
    .search-toolbar {
        display: block;
    }
    .search-input-wrap {
        width: 100%;
        margin-bottom: 0.6rem;
    }
    .search-controls-wrap {
        display: flex;
        width: 100%;
    }
    .search-status-select {
        min-height: 44px;
    }
    .filter-section {
        padding: 0.85rem 0.9rem;
        border-radius: 14px;
    }
    .stat-card {
        padding: 0.55rem 0.65rem;
        gap: 0.45rem;
        justify-content: center;
        text-align: center;
    }
    .stat-card .stat-num { font-size: 1.05rem; }
    .stat-card .stat-icon { font-size: 1.1rem; }
    .stat-card .stat-lbl {
        font-size: 0.65rem;
        line-height: 1.2;
    }
    #statsContainer {
        padding: 0.5rem 0;
        margin-bottom: 0.5rem;
    }
    .column-visibility-group .form-check {
        min-width: 100%;
        border-radius: 12px;
    }
    #attendanceTable { display: none !important; }
    #cardContainer { display: block !important; }
}
@media (min-width: 768px) {
    .search-panel {
        padding: 1rem 1.1rem;
    }
    #cardContainer { display: none !important; }
}

