﻿*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --navy: #1a2744;
    --slate: #2d3f6b;
    --teal: #00b4a0;
    --teal-lt: #e6f9f7;
    --white: #ffffff;
    --bg: #f0f2f8;
    --surface: #ffffff;
    --border: #dde3f0;
    --text: #1e2433;
    --muted: #6b7494;
    --red: #e53e3e;
    --red-lt: #fff5f5;
    --green: #38a169;
    --green-lt: #f0fff4;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(26,39,68,.10);
    --shadow-lg: 0 8px 32px rgba(26,39,68,.16);
}

html {
    font-size: 15px;
}

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── NAVBAR ── */
.navbar {
    background: linear-gradient(135deg, var(--navy) 0%, var(--slate) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(0,0,0,.25);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
}

.brand-icon {
    font-size: 1.4rem;
}

.brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: .02em;
}

.nav-links {
    display: flex;
    gap: .5rem;
}

.nav-link {
    color: rgba(255,255,255,.75);
    text-decoration: none;
    padding: .4rem .9rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: .9rem;
    transition: all .2s;
}

    .nav-link:hover, .nav-link.active {
        color: #fff;
        background: rgba(0,180,160,.25);
    }

.nav-user {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.user-badge {
    color: var(--teal);
    font-weight: 700;
    font-size: .85rem;
    background: rgba(0,180,160,.12);
    padding: .25rem .7rem;
    border-radius: 20px;
    border: 1px solid rgba(0,180,160,.3);
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,.3);
    color: rgba(255,255,255,.8);
    padding: .3rem .8rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: .85rem;
    transition: all .2s;
}

    .btn-logout:hover {
        background: rgba(229,62,62,.2);
        border-color: var(--red);
        color: #fff;
    }

/* ── MAIN CONTENT ── */
.main-content {
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── PAGE HEADER ── */
.page-header {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    border-right: 4px solid var(--teal);
}

.page-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--navy);
}

.header-actions {
    display: flex;
    gap: .5rem;
}

/* ── BUTTONS ── */
.btn-primary {
    background: var(--teal);
    color: #fff;
    border: none;
    padding: .5rem 1.1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    transition: all .2s;
}

    .btn-primary:hover {
        background: #009b8a;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0,180,160,.3);
    }

.btn-secondary {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: .5rem 1.1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all .2s;
}

    .btn-secondary:hover {
        border-color: var(--teal);
        color: var(--teal);
    }

.btn-danger {
    background: var(--red);
    color: #fff;
    border: none;
    padding: .5rem 1.1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    transition: all .2s;
}

    .btn-danger:hover {
        background: #c53030;
    }

.btn-danger-sm {
    background: var(--red-lt);
    color: var(--red);
    border: 1px solid #fca5a5;
    padding: .25rem .65rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    transition: all .2s;
}

    .btn-danger-sm:hover {
        background: var(--red);
        color: #fff;
    }

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-lg {
    padding: .65rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: .2rem .3rem;
    border-radius: 4px;
    transition: all .15s;
    text-decoration: none;
}

    .btn-icon:hover {
        transform: scale(1.2);
    }

/* ── ALERTS ── */
.alert {
    padding: .85rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.alert-error {
    background: var(--red-lt);
    color: var(--red);
    border: 1px solid #fca5a5;
}

.alert-success {
    background: var(--green-lt);
    color: var(--green);
    border: 1px solid #9ae6b4;
}

/* ── SEARCH BAR ── */
.search-bar {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-form {
    flex: 1;
}

.search-inputs {
    display: flex;
    gap: .6rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    min-width: 260px;
}

.record-count {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--bg);
    padding: .35rem .75rem;
    border-radius: 20px;
}

/* ── TABLE ── */
.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

    .data-table thead tr {
        background: var(--navy);
        color: #fff;
    }

    .data-table th {
        padding: .85rem 1rem;
        text-align: right;
        font-weight: 600;
        font-size: .82rem;
        white-space: nowrap;
        letter-spacing: .01em;
    }

    .data-table td {
        padding: .7rem 1rem;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
    }

    .data-table tbody tr:last-child td {
        border-bottom: none;
    }

    .data-table tbody tr:hover {
        background: #f6f8ff;
    }

.id-cell {
    color: var(--teal);
    font-weight: 700;
    font-family: monospace;
    font-size: .95rem;
}

.name-cell {
    font-weight: 600;
    color: var(--navy);
}

.actions-cell {
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 3rem !important;
    font-size: .95rem;
}

/* ── BADGES ── */
.badge {
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 700;
    display: inline-block;
}

.badge-blue {
    background: #ebf4ff;
    color: #2b6cb0;
}

.badge-pink {
    background: #fff0f6;
    color: #b83280;
}

.badge-gray {
    background: #edf2f7;
    color: #4a5568;
}

.badge-purple {
    background: #faf5ff;
    color: #6b46c1;
}

.badge-green {
    background: var(--green-lt);
    color: var(--green);
}

/* ── FORM ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.form-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--navy);
}

    .form-label.required::after {
        content: " *";
        color: var(--red);
    }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: .55rem .85rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
    font-size: .9rem;
    color: var(--text);
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

    .form-input:focus, .form-select:focus, .form-textarea:focus {
        border-color: var(--teal);
        box-shadow: 0 0 0 3px rgba(0,180,160,.12);
    }

    .form-input.bg-gray {
        background: #f7f8fc;
        color: var(--muted);
        cursor: not-allowed;
    }

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.ltr-input {
    direction: ltr;
    text-align: left;
}

/* ── FORM GRID ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.form-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: end;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-3 {
    grid-column: span 3;
}

.form-btn-group {
    padding-top: .5rem;
}

/* ── FORM SECTIONS ── */
.student-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-section {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    border-right: 3px solid var(--teal);
}

.section-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.form-actions {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
}

.meta-info {
    color: var(--muted);
    font-size: .8rem;
    padding: .5rem 0;
}

/* ── CARD ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
}

.card-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.25rem;
}

/* ── DETAILS CARD ── */
.details-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.details-header {
    background: linear-gradient(135deg, var(--navy), var(--slate));
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.student-avatar {
    width: 64px;
    height: 64px;
    background: var(--teal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.student-info-header h2 {
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
}

.student-info-header p {
    color: rgba(255,255,255,.7);
    font-size: .9rem;
    margin-top: .25rem;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    padding: 1px;
}

.detail-section {
    background: var(--white);
    padding: 1.25rem 1.5rem;
}

    .detail-section.col-span-2 {
        grid-column: span 2;
    }

    .detail-section h4 {
        font-size: .85rem;
        font-weight: 700;
        color: var(--teal);
        text-transform: uppercase;
        letter-spacing: .05em;
        margin-bottom: .75rem;
        padding-bottom: .5rem;
        border-bottom: 1px solid var(--border);
    }

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .4rem 0;
    border-bottom: 1px solid #f0f2f8;
    font-size: .875rem;
}

    .detail-row:last-child {
        border-bottom: none;
    }

    .detail-row span {
        color: var(--muted);
    }

    .detail-row strong {
        color: var(--text);
        font-weight: 600;
    }

/* ── MODAL ── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .modal.hidden {
        display: none;
    }

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px);
}

.modal-box {
    position: relative;
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: popIn .2s ease;
}

@keyframes popIn {
    from {
        transform: scale(.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: .75rem;
}

.modal-msg {
    color: var(--muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: .75rem;
    flex-direction: row-reverse;
}

/* ── LOGIN ── */
.login-body {
    background: linear-gradient(135deg, var(--navy) 0%, #0f1a38 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    padding: 1rem;
    display: flex;
    justify-content: center;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 64px rgba(0,0,0,.4);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 2.5rem;
    margin-bottom: .5rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--navy);
}

.login-subtitle {
    color: var(--muted);
    font-size: .9rem;
    margin-top: .25rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

/* ── INLINE FORM ── */
.inline-form .form-grid-4 {
    align-items: end;
}

/* ── TOAST ── */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--navy);
    color: #fff;
    padding: .75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: slideUp .3s ease;
}

    .toast.hidden {
        display: none;
    }

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    .main-content {
        padding: 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .col-span-2, .col-span-3 {
        grid-column: span 2;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .detail-section.col-span-2 {
        grid-column: span 1;
    }

    .form-grid-4 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .navbar {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .col-span-2, .col-span-3 {
        grid-column: span 1;
    }

    .search-inputs {
        flex-direction: column;
    }

    .form-grid-4 {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: .78rem;
    }

        .data-table th, .data-table td {
            padding: .5rem .6rem;
        }
}

/* ── LOOKUP PAGES (Classes / Subjects / Teachers) ── */
.lookup-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.25rem;
    align-items: start;
}

.lookup-form-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border-top: 3px solid var(--teal);
    position: sticky;
    top: 76px;
}

.lookup-table-card {
    min-width: 0;
}

.lookup-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.muted-cell {
    color: var(--muted);
    font-size: .82rem;
}

@media (max-width: 768px) {
    .lookup-layout {
        grid-template-columns: 1fr;
    }

    .lookup-form-card {
        position: static;
    }
}

/* ── BOOKING PAGE ── */
.booking-step-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.step-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--border);
}

    .step-header h3 {
        font-size: 1rem;
        font-weight: 700;
        color: var(--navy);
    }

.step-number {
    width: 32px;
    height: 32px;
    background: var(--teal);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.search-form-inline {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input-lg {
    flex: 1;
    min-width: 280px;
}

/* نتائج البحث */
.search-results-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border-right: 3px solid var(--teal);
}

.results-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.student-results-grid {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.student-result-item {
    display: grid;
    grid-template-columns: 70px 1fr 120px 130px;
    align-items: center;
    gap: 1rem;
    padding: .7rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: all .15s;
}

    .student-result-item:hover {
        background: var(--teal-lt);
        border-color: var(--teal);
        transform: translateX(-2px);
    }

.result-code {
    color: var(--teal);
    font-weight: 700;
    font-family: monospace;
}

.result-name {
    font-weight: 600;
    color: var(--navy);
}

.result-class {
    color: var(--muted);
    font-size: .85rem;
}

.result-phone {
    color: var(--muted);
    font-size: .85rem;
    direction: ltr;
}

.empty-search-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    color: var(--muted);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

/* بطاقة الطالب المختار */
.selected-student-card {
    background: linear-gradient(135deg, var(--navy), var(--slate));
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-lg);
}

.selected-student-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.student-avatar-sm {
    width: 48px;
    height: 48px;
    background: var(--teal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.selected-name {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}

.selected-meta {
    color: rgba(255,255,255,.7);
    font-size: .83rem;
    margin-top: .2rem;
}

.btn-sm {
    padding: .35rem .8rem;
    font-size: .85rem;
}

/* صفوف الحجز المتعددة */
.booking-rows-wrapper {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.booking-rows-header {
    display: flex;
    gap: .5rem;
    padding: 0 .5rem;
    align-items: center;
}

.col-hdr {
    font-size: .78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.booking-row {
    display: flex;
    gap: .5rem;
    align-items: center;
    background: #f8faff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .6rem .75rem;
    animation: fadeIn .2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.booking-row .form-select {
    flex: 2;
}

.booking-row .form-input {
    flex: 1;
}

    .booking-row .form-input:nth-child(4) {
        flex: .8;
    }
    /* price */
    .booking-row .form-input:nth-child(5) {
        flex: 1;
    }
    /* day   */
    .booking-row .form-input:nth-child(6) {
        flex: .8;
    }
    /* time  */
    .booking-row .form-input:nth-child(7) {
        flex: 1.2;
    }
/* date  */

.btn-remove-row {
    background: var(--red-lt);
    color: var(--red);
    border: 1px solid #fca5a5;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .15s;
}

    .btn-remove-row:hover {
        background: var(--red);
        color: #fff;
    }

.btn-add-row {
    background: transparent;
    border: 2px dashed var(--teal);
    color: var(--teal);
    padding: .6rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    transition: all .2s;
    margin-top: .25rem;
}

    .btn-add-row:hover {
        background: var(--teal-lt);
    }

.price-badge {
    background: #f0fff4;
    color: var(--green);
    border: 1px solid #9ae6b4;
    padding: .15rem .55rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 700;
}

@media (max-width: 900px) {
    .booking-rows-header {
        display: none;
    }

    .booking-row {
        flex-wrap: wrap;
    }

        .booking-row .form-select,
        .booking-row .form-input {
            flex: 1 1 calc(50% - .5rem);
        }

    .student-result-item {
        grid-template-columns: 60px 1fr;
    }

    .result-class, .result-phone {
        display: none;
    }
}

/* ── Booking row column widths ── */
.bh-subject {
    flex: 2 !important;
}

.bh-teacher {
    flex: 2 !important;
}

.bh-type {
    flex: 1.2 !important;
}

.bh-price {
    flex: .8 !important;
}

.bh-day {
    flex: 1 !important;
}

.bh-time {
    flex: .8 !important;
}

.bh-date {
    flex: 1.2 !important;
}

/* disabled select styling */
select:disabled {
    background: #f0f2f8;
    color: var(--muted);
    cursor: not-allowed;
}

/* filter divider in MainInfo form */
.filter-divider {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 1.25rem 0 1rem;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
}

    .filter-divider::before,
    .filter-divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border);
    }

/* ── ATTENDANCE PAGE ── */
.att-session-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    align-items: end;
}

.mode-toggle {
    display: flex;
    gap: .5rem;
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem .6rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    transition: all .2s;
}

    .mode-btn input[type=radio] {
        display: none;
    }

    .mode-btn.active, .mode-btn:has(input:checked) {
        border-color: var(--teal);
        background: var(--teal-lt);
        color: var(--teal);
    }

/* بطاقة ملخص الحصة */
.lesson-summary {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 2rem;
    margin-top: 1rem;
    padding: .85rem 1.25rem;
    background: #f0f8ff;
    border-radius: 6px;
    border: 1px solid #bee3f8;
}

.lesson-summary-item {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

    .lesson-summary-item span {
        font-size: .75rem;
        color: var(--muted);
        font-weight: 600;
        text-transform: uppercase;
    }

    .lesson-summary-item strong {
        font-size: .95rem;
        color: var(--navy);
    }

/* جدول الحضور */
.attendance-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}

.attendance-table th, .attendance-table td {
    padding: .5rem .65rem;
}

.attendance-table .att-check-cell {
    text-align: center;
}

.attendance-table .att-input {
    padding: .35rem .5rem;
    font-size: .82rem;
}

.attendance-table .att-select {
    padding: .35rem .4rem;
    font-size: .82rem;
}

.att-check {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--teal);
}

/* الغائب — صف شفاف */
tr.att-absent {
    opacity: .45;
}

    tr.att-absent td {
        background: #fafafa;
    }

.att-summary {
    font-size: .9rem;
    color: var(--muted);
    font-weight: 600;
}

    .att-summary strong {
        color: var(--teal);
        font-size: 1.1rem;
    }

@media (max-width: 900px) {
    .session-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .session-grid {
        grid-template-columns: 1fr;
    }

    .mode-toggle {
        flex-direction: column;
    }
}

/* ── PAGINATION ── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem 1rem;
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: .5rem;
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.page-num {
    font-size: .85rem;
    color: var(--muted);
    font-weight: 600;
}

.pagination-bar + .table-container {
    border-radius: 0 0 var(--radius) var(--radius);
}

.form-hint {
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: .75rem;
}

@media (max-width: 1100px) {
    .att-session-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .att-session-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Attendance Search ── */
.att-search-bar {
    display: flex;
    align-items: flex-end;
    gap: 1.25rem;
    padding: 1rem 0 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.att-search-group {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
}

.att-search-input-wrap {
    display: flex;
    gap: .5rem;
}

.att-search-divider {
    color: var(--muted);
    font-weight: 700;
    font-size: .9rem;
    padding-bottom: .5rem;
    align-self: flex-end;
}

.name-results {
    position: absolute;
    z-index: 200;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    min-width: 420px;
    margin-top: .25rem;
}

    .name-results.hidden {
        display: none;
    }

.name-result-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}

    .name-result-item:hover {
        background: var(--teal-lt);
    }

    .name-result-item:last-child {
        border-bottom: none;
    }

.name-result-empty {
    padding: 1rem;
    text-align: center;
    color: var(--muted);
}

/* toast error variant */
.toast-error {
    background: var(--red) !important;
}

/* ══ QUICK ATTENDANCE ══════════════════════════════════ */
.qa-wrapper {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.25rem;
    align-items: start;
}

/* بطاقة الإدخال */
.qa-input-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem 1.75rem;
    border-top: 4px solid var(--teal);
    position: sticky;
    top: 76px;
    text-align: center;
}

.qa-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    margin-bottom: .35rem;
}

    .qa-title h1 {
        font-size: 1.3rem;
        font-weight: 900;
        color: var(--navy);
    }

.qa-icon {
    font-size: 1.6rem;
}

.qa-subtitle {
    color: var(--muted);
    font-size: .88rem;
    margin-bottom: 1.5rem;
}

.qa-input-wrap {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.25rem;
}

.qa-input {
    flex: 1;
    padding: .75rem 1rem;
    border: 2.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Cairo', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: .08em;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    direction: ltr;
}

    .qa-input:focus,
    .qa-input-idle:focus {
        border-color: var(--teal);
        box-shadow: 0 0 0 3px rgba(0,180,160,.15);
    }

.qa-input-loading {
    border-color: #f6ad55;
    animation: pulse .6s infinite;
}

.qa-input-success {
    border-color: var(--green);
    background: var(--green-lt);
}

.qa-input-error {
    border-color: var(--red);
    background: var(--red-lt);
}

@keyframes pulse {
    0%,100% {
        opacity: 1;
    }

    50% {
        opacity: .6;
    }
}

.qa-btn {
    background: var(--teal);
    color: #fff;
    border: none;
    padding: .75rem 1.25rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: .95rem;
    font-weight: 700;
    transition: background .2s;
    white-space: nowrap;
}

    .qa-btn:hover {
        background: #009b8a;
    }

/* بطاقة التأكيد */
.qa-confirm {
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: right;
    animation: slideDown .25s ease;
}

    .qa-confirm.hidden {
        display: none;
    }

.qa-confirm-success {
    background: var(--green-lt);
    border: 1.5px solid #9ae6b4;
}

.qa-confirm-error {
    background: var(--red-lt);
    border: 1.5px solid #fca5a5;
}

@keyframes slideDown {
    from {
        transform: translateY(-8px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.qa-confirm-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.qa-confirm-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--navy);
}

.qa-confirm-meta {
    font-size: .82rem;
    color: var(--muted);
    margin-top: .2rem;
}

.qa-confirm-time {
    font-size: .82rem;
    color: var(--teal);
    font-weight: 700;
    margin-top: .15rem;
    direction: ltr;
    text-align: left;
}

/* قائمة الحاضرين */
.qa-list-card {
    min-width: 0;
}

.qa-list-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
}

    .qa-list-header h2 {
        font-size: 1rem;
        font-weight: 700;
        color: var(--navy);
    }

/* صف جديد — animation */
.qa-new-row {
    animation: highlightRow .8s ease;
}

@keyframes highlightRow {
    0% {
        background: rgba(0,180,160,.18);
    }

    100% {
        background: transparent;
    }
}

@media (max-width: 900px) {
    .qa-wrapper {
        grid-template-columns: 1fr;
    }

    .qa-input-card {
        position: static;
    }
}

/* ══ REPORTS ════════════════════════════════════════════ */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.report-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text);
    border-right: 4px solid var(--teal);
    transition: all .2s;
}

    .report-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
        border-right-color: var(--navy);
    }

.report-card-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.report-card-body {
    flex: 1;
}

    .report-card-body h3 {
        font-size: .95rem;
        font-weight: 700;
        color: var(--navy);
    }

    .report-card-body p {
        font-size: .82rem;
        color: var(--muted);
        margin-top: .2rem;
    }

.report-card-arrow {
    color: var(--muted);
    font-size: 1.1rem;
}

/* فلتر التقرير */
.report-filter-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

    .report-filter-form .form-group {
        flex: 1;
        min-width: 160px;
    }

/* بطاقة الإجمالي */
.report-total-card {
    background: linear-gradient(135deg, var(--navy), var(--slate));
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.report-total-icon {
    font-size: 2.5rem;
}

.report-total-label {
    color: rgba(255,255,255,.7);
    font-size: .85rem;
    font-weight: 600;
}

.report-total-num {
    color: #fff;
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1.1;
}

.report-total-period {
    color: var(--teal);
    font-size: .85rem;
    margin-top: .2rem;
}

/* progress bar */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.progress-bar {
    height: 8px;
    background: var(--teal);
    border-radius: 4px;
    min-width: 4px;
    transition: width .4s ease;
}

.progress-label {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}

.report-count {
    font-size: 1rem;
    color: var(--navy);
}

.report-total-row td {
    padding: .85rem 1rem !important;
    background: #f0f8ff;
}



/* أضف هذا في نهاية site.css */

/* ── Phone validation ── */
.input-ok {
    border-color: #38a169 !important;
}

.input-warn {
    border-color: #e53e3e !important;
    background: #fff5f5 !important;
}

.phone-hint {
    font-size: .75rem;
    color: #e53e3e;
    margin-top: .2rem;
    display: block;
}

    .phone-hint.hidden {
        display: none;
    }
.codes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

@media(max-width:640px) {
    .codes-grid {
        grid-template-columns: 1fr;
    }
}

.code-box {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
}

.code-box-title {
    font-weight: 800;
    font-size: .82rem;
    color: var(--navy);
    text-transform: uppercase;
}

.code-box svg {
    max-width: 100%;
    height: auto;
    display: block;
}

.barcode-wrapper {
    width: 100%;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    padding: 2px 0;
}

.qr-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

    .qr-wrapper svg {
        width: min(220px, 100%);
        height: auto;
    }

.id-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: linear-gradient(135deg, var(--navy), var(--slate));
    color: #fff;
    border-radius: 50px;
    padding: .45rem 1.8rem;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.4rem;
}

.success-banner {
    background: var(--teal-lt);
    border: 2px solid var(--teal);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.5rem;
}

.success-icon {
    font-size: 3.5rem;
    color: var(--teal);
    display: block;
    margin-bottom: .6rem;
}

/* ══════════════════════════════════════════════════════
   إصلاح الـ Navbar والتنقل على الموبايل
   ══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .navbar {
        height: auto;
        padding: 0.6rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .nav-links {
        display: flex;
        overflow-x: auto; /* السماح بالتمرير الأفقي بسلاسة للأصابع */
        width: 100%;
        max-width: 100%;
        padding-bottom: 0.4rem;
        gap: 0.3rem;
        -webkit-overflow-scrolling: touch;
    }

        .nav-links::-webkit-scrollbar {
            height: 3px;
        }

        .nav-links::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.3);
            border-radius: 3px;
        }

    .nav-link {
        white-space: nowrap; /* منع انقسام النص في الزرار الواحد */
        font-size: 0.82rem;
        padding: 0.3rem 0.6rem;
    }

    .nav-user {
        width: 100%;
        justify-content: space-between;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        padding-top: 0.4rem;
    }

    .main-content {
        padding: 0.75rem; /* توسيع مساحة المحتوى على الشاشات الصغيره */
    }
}