@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
    --primary: #0f3b3a;
    --primary-light: #1a6b5c;
    --primary-surface: #e8f5f0;
    --accent: #d97706;
    --accent-light: #fef3c7;
    --bg: #f3f6fa;
    --surface: #ffffff;
    --sidebar-bg: #0f1a1c;
    --sidebar-hover: #1a2d30;
    --sidebar-active: #1a6b5c;
    --text: #0f172a;
    --text-secondary: #475569;
    --muted: #94a3b8;
    --border: #e2e8f0;
    --success: #059669;
    --success-bg: #ecfdf5;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --morning: #d97706;
    --morning-bg: #fffbeb;
    --evening: #6366f1;
    --evening-bg: #eef2ff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 20px rgba(0,0,0,0.07);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 260px;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo {
    height: auto;
    flex-shrink: 0;
    width: 100%;
    padding: 18px;
    padding-bottom: 5px;
}
.sidebar-user {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: center;
}
.sidebar-user-name {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
}
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 10px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.sidebar-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}
.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logout {
    color: rgba(255,255,255,0.4) !important;
}
.sidebar-logout:hover {
    color: #fca5a5 !important;
    background: rgba(239,68,68,0.1) !important;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}
.g-recaptcha>div{
    margin: auto;
}
.sidebar-overlay.show { display: block; }

/* ===== Main Layout ===== */
.main-wrapper {
    margin-right: 260px;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.hamburger span {
    display: block;
    width: 24px;
    height: 2.5px;
    background: var(--text);
    border-radius: 2px;
    transition: 0.2s;
}
.topbar-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}
.topbar-spacer { flex: 1; }

.app-main {
    flex: 1;
    padding: 28px 32px;
    width: 100%;
}

/* ===== Flash Toasts ===== */
.flash-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5000;
    padding: 14px 28px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.92rem;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.4s ease;
    max-width: 90vw;
    text-align: center;
}
.flash-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #a7f3d0;
}
.flash-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid #fecaca;
}
.flash-toast.hide {
    animation: fadeUp 0.4s ease forwards;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes fadeUp {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to   { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 28px;
}
.page-header h1 {
    margin: 0 0 6px;
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}
.page-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: box-shadow 0.2s;
}
.card:hover {
    box-shadow: var(--shadow-lg);
}
.card-title {
    margin: 0 0 16px;
    font-size: 1.08rem;
    font-weight: 700;
}
.card-subtitle {
    margin: -8px 0 20px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* ===== Stats ===== */
.stats-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.stat-card {
    flex: 1;
    min-width: 130px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--primary-light);
    border-radius: 0 0 4px 4px;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}
.stat-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}
.stat-morning::before { background: var(--morning); }
.stat-morning .stat-number { color: var(--morning); }
.stat-evening::before { background: var(--evening); }
.stat-evening .stat-number { color: var(--evening); }

/* ===== Forms ===== */
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.92rem;
    background: var(--surface);
    transition: all 0.2s;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(26,107,92,0.1);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--surface);
    transition: all 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(26,107,92,0.1);
}
.hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
}
.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding-top: 6px;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-light);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff;
    box-shadow: 0 4px 12px rgba(26,107,92,0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26,107,92,0.35);
}
.btn-secondary {
    background: #f1f5f9;
    color: var(--text);
}
.btn-secondary:hover {
    background: #e2e8f0;
}
.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
    box-shadow: 0 4px 12px rgba(5,150,105,0.25);
}
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(5,150,105,0.35);
}
.btn-danger {
    background: #fee2e2;
    color: var(--error);
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn-danger:hover {
    background: #fecaca;
}
.btn-outline {
    border: 1.5px solid var(--border);
    padding: 8px 14px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
}
.btn-outline:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}
.btn-block {
    width: 100%;
    justify-content: center;
}
.btn-sm {
    padding: 8px 16px;
    font-size: 0.84rem;
    border-radius: 10px;
}

/* ===== Alerts in-page ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #a7f3d0;
}
.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid #fecaca;
}
.form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 6px;
}

/* ===== Period Tags ===== */
.period-tag {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
}
.period-morning {
    background: var(--morning-bg);
    color: var(--morning);
}
.period-evening {
    background: var(--evening-bg);
    color: var(--evening);
}

/* ===== Icon helpers ===== */
.btn i, button i { margin-left: 6px; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}
.empty-state h2 {
    margin: 0 0 8px;
    font-size: 1.3rem;
}
.empty-state p {
    color: var(--text-secondary);
    margin: 0 0 24px;
    font-size: 0.92rem;
}

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 0.84rem;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:hover td {
    background: #f8fafc;
}
.data-table tr:last-child td {
    border-bottom: none;
}

/* ===== Selection Table (student dashboard) ===== */
.selection-table {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.selection-table-head {
    display: flex;
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.84rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.selection-table-row {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.selection-table-row:last-child {
    border-bottom: none;
}
.selection-table-col-date {
    flex: 0 0 160px;
    padding: 14px 16px;
    font-weight: 500;
}
.selection-table-col-period {
    flex: 1;
    padding: 14px 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== Auth Cards ===== */
.auth-card {
    max-width: 420px;
    margin: 80px auto 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-light), var(--accent));
}
.auth-logo {
    text-align: center;
    margin-bottom: 20px;
}
.auth-logo img {
    max-width: 180px;
    height: auto;
}
.auth-header {
    margin-bottom: 28px;
    text-align: center;
}
.auth-header h1 {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 800;
}
.auth-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Days Grid ===== */
.days-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.day-card {
    display: block;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 1.05rem;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}
.day-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.period-full {
    border-color: var(--evening);
    background: var(--evening-bg);
}
.period-option input:checked + .period-full {
    border-color: var(--evening);
    background: #e0e7ff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* ===== Slot Options (selection page) ===== */
.slot-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
    background: var(--surface);
}
.slot-option:hover {
    border-color: var(--primary-light);
    background: #f8fafc;
}
.slot-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-light);
    flex-shrink: 0;
}
.slot-option:has(input:checked) {
    background: var(--primary-surface);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(26,107,92,0.1);
}
.slot-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}
.slot-date {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 100px;
}
.slot-period {
    font-size: 0.9rem;
    color: var(--text);
}

/* ===== Period Options (auth) ===== */
.period-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.period-option {
    position: relative;
    cursor: pointer;
}
.period-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.period-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.2s;
}
.period-icon { font-size: 2rem; }
.period-box strong { font-size: 1.05rem; }
.period-box small { color: var(--muted); }
.period-option input:checked + .period-box {
    border-color: var(--primary-light);
    background: var(--primary-surface);
    box-shadow: 0 0 0 3px rgba(26,107,92,0.12);
}

/* ===== Module Options ===== */
.module-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}
.module-option:hover {
    border-color: var(--primary-light);
    background: #f8fafc;
}
.module-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-light);
    flex-shrink: 0;
}
.module-option:has(input:checked) {
    background: var(--primary-surface);
    border-color: var(--primary-light);
}
.module-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.module-name {
    font-weight: 600;
    font-size: 0.92rem;
}
.module-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.module-period-tag {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== Period Checkboxes ===== */
.period-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.period-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.period-checkbox:hover {
    border-color: var(--primary-light);
    background: #f8fafc;
}
.period-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-light);
}
.period-checkbox:has(input:checked) {
    background: var(--primary-surface);
    border-color: var(--primary-light);
}
.period-label {
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===== Student Cards (admin) ===== */
.student-card {
    margin-bottom: 16px;
}
.student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.student-name {
    font-size: 1rem;
    font-weight: 600;
}
.student-cne {
    color: var(--muted);
    margin-right: 8px;
    font-size: 0.85rem;
}
.student-count {
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 4px 14px;
    border-radius: 999px;
    font-weight: 500;
}
.no-selections {
    color: var(--muted);
    font-size: 0.88rem;
}

/* ===== Search ===== */
.search-form {
    margin-bottom: 24px;
}
.search-box {
    display: flex;
    gap: 10px;
}
.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.9rem;
    background: var(--surface);
    transition: all 0.2s;
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(26,107,92,0.1);
}
.search-box select {
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.9rem;
    background: var(--surface);
    min-width: 150px;
}
.search-box select:focus {
    outline: none;
    border-color: var(--primary-light);
}

/* ===== Details List ===== */
.details-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 0 0 24px;
}
.details-list div {
    background: #f8fafc;
    padding: 14px;
    border-radius: var(--radius-sm);
}
.details-list dt {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 4px;
}
.details-list dd {
    margin: 0;
    font-weight: 600;
}

/* ===== Schedule Grid ===== */
#table_g {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
    direction: rtl;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
#table_g th, #table_g td {
    border: 1px solid var(--border);
    padding: 6px 8px;
    text-align: center;
    vertical-align: top;
}
#table_g .tr_g th {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    padding: 10px 8px;
}
#table_g .td_g[data-vailable="non"] {
    background: #f9fafb;
    color: #d1d5db;
}
#table_g .td_g[data-vailable="oui"] {
    background: #fff;
}
#table_g .module-name {
    font-weight: 700;
    color: var(--primary-light);
    font-size: 11px;
    line-height: 1.3;
}
#table_g .prof-name {
    color: var(--text-secondary);
    font-size: 10px;
    margin-bottom: 4px;
}
#table_g .student-item {
    background: var(--primary-surface);
    border-radius: 4px;
    padding: 2px 6px;
    margin: 2px 0;
    font-size: 10px;
    white-space: nowrap;
    line-height: 1.4;
}
#table_g .room-col {
    font-weight: 700;
    background: #f8fafc;
    white-space: nowrap;
    color: var(--text);
}
#table_g .num-col {
    background: #f8fafc;
    text-align: center;
    width: 30px;
    font-weight: 600;
}
#table_g .cell-used {
    transition: background 0.15s;
    background: #fff;
    min-height: 40px;
}
#table_g .cell-used.cell-over {
    background: #d1fae5;
    outline: 2px dashed var(--success);
    outline-offset: -2px;
}
#table_g .cell-unused {
    background: #f9fafb;
    color: #d1d5db;
}
#table_g .unused-label {
    color: #d1d5db;
    font-size: 10px;
}
#table_g .drop-hint {
    color: var(--success);
    font-size: 10px;
    font-weight: 500;
    padding: 8px 0;
}
#table_g .remove-student {
    cursor: pointer;
    color: var(--error);
    font-weight: 700;
    font-size: 13px;
    margin-right: 4px;
    line-height: 1;
}
#table_g .remove-student:hover {
    color: #dc2626;
}

/* ===== Drag & Drop ===== */
.draggable-students {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.period-group-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin: 4px 0;
    color: var(--text);
}
.student-cards-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.student-card-drag {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 18px;
    background: linear-gradient(135deg, #dbeafe, #e0f2fe);
    border: 1.5px solid #93c5fd;
    border-radius: var(--radius-sm);
    cursor: grab;
    user-select: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.15s;
    min-width: 100px;
}
.student-card-drag:active {
    cursor: grabbing;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    transform: scale(1.05);
}
.student-card-drag:hover {
    background: linear-gradient(135deg, #bfdbfe, #dbeafe);
    border-color: #60a5fa;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.student-card-drag small {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.student-card-drag.dragging {
    opacity: 0.5;
}
.drop-cell {
    vertical-align: top;
    min-width: 80px;
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.open {
    display: flex;
}
.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    direction: rtl;
    animation: modalIn 0.25s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted);
    padding: 0 4px;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text);
}
.modal-body {
    padding: 20px;
}
.modal-body h4 {
    margin: 16px 0 8px;
    font-size: 0.92rem;
}
.modal-body p {
    margin: 4px 0;
    font-size: 0.88rem;
}
.remove-btn {
    background: #fee2e2;
    border: none;
    border-radius: 6px;
    padding: 3px 10px;
    cursor: pointer;
    font-weight: 700;
    color: var(--error);
    font-size: 14px;
    line-height: 1.4;
}
.remove-btn:hover {
    background: #fecaca;
}

/* ===== Add Volunteer ===== */
.add-volunteer-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
    position: relative;
}
.add-volunteer-form input[type="text"] {
    flex: 1;
    min-width: 180px;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.88rem;
    transition: all 0.2s;
}
.add-volunteer-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(26,107,92,0.1);
}
.add-volunteer-form select {
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.88rem;
    background: var(--surface);
}
.add-volunteer-form .btn {
    padding: 11px 20px;
    font-size: 0.88rem;
}
.add-volunteer-form .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Search Results ===== */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    margin-top: 6px;
}
.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background: var(--primary-surface);
}
.search-result-item.disabled {
    color: var(--muted);
    cursor: default;
}
.search-result-item small {
    color: var(--muted);
    font-size: 0.8rem;
    margin-right: 8px;
}

/* ===== Warning Toast ===== */
.warning-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--accent-light);
    color: #92400e;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 24px;
    font-size: 0.92rem;
    font-weight: 600;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
    white-space: nowrap;
}
.warning-toast.show {
    transform: translateX(-50%) translateY(0);
}



/* ===== Settings ===== */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 900px;
}
.settings-grid .card {
    padding: 28px;
}
.settings-grid .card-title {
    margin: 0 0 20px;
    font-size: 1.08rem;
}
.settings-grid label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.settings-grid .form-group {
    margin-bottom: 16px;
    flex: 1;
}
.settings-grid .form-row {
    display: flex;
    gap: 16px;
}
.room-table th {
    background: #f8fafc;
    padding: 12px 14px;
    text-align: center;
    font-size: 0.84rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
}
.room-table td {
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}
.room-table code {
    background: #f1f5f9;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.84rem;
}
.room-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}
.status-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.status-active {
    background: #d1fae5;
    color: #065f46;
}
.status-inactive {
    background: #f3f4f6;
    color: #6b7280;
}

/* ===== Selection Summary ===== */
.selection-summary {
    position: relative;
}
.card-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--primary-light);
    color: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
}
.selection-summary h2 {
    margin: 0 0 20px;
    padding-left: 100px;
    font-size: 1.3rem;
}

/* ===== Period Section Title ===== */
.period-section-title {
    margin: 28px 0 14px;
    font-size: 1.15rem;
    font-weight: 700;
}

/* ===== Schedule Module Card ===== */
.schedule-module-card {
    margin-bottom: 12px;
}
.schedule-module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.schedule-module-header small {
    display: block;
    margin-top: 2px;
}
.schedule-rooms {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.room-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
}
.assigned-list {
    margin-top: 8px;
}
.assigned-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.assigned-row:last-child {
    border-bottom: none;
}
.unassigned-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.unassigned-row:last-child {
    border-bottom: none;
}
.salle-input {
    width: 80px;
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 0.84rem;
}
.module-select {
    flex: 1;
    min-width: 200px;
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 0.84rem;
}

/* ===== Day Group ===== */
.day-group {
    margin-bottom: 24px;
}
.day-group .card-title {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ===== Print Styles ===== */
@media print {
    .sidebar, .sidebar-overlay, .topbar, .flash-toast,
    .no-print, nav, footer, .flash-messages {
        display: none !important;
    }
    .main-wrapper {
        margin-right: 0 !important;
    }
    body {
        background: #fff !important;
    }
    .period-tag {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-right: 0;
    }
    .topbar {
        display: flex;
    }
    .app-main {
        padding: 20px 16px;
    }
    .stats-row {
        gap: 10px;
    }
    .stat-card {
        min-width: 100px;
        padding: 16px 12px;
    }
    .stat-number {
        font-size: 1.5rem;
    }
    .settings-grid .form-row {
        flex-direction: column;
        gap: 0;
    }
    .search-box {
        flex-direction: column;
    }
    .search-box select {
        width: 100%;
    }
    .period-options {
        grid-template-columns: 1fr;
    }
    .page-header h1 {
        font-size: 1.3rem;
    }
}

/* ===== Toolbar ===== */
.toolbar-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.student-check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.student-check-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-light);
}

