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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-bg: #1a1d29;
    --sidebar-hover: #252836;
    --sidebar-active: #2d3143;
    --primary: #6C5CE7;
    --primary-light: #a29bfe;
    --primary-dark: #5541d7;
    --success: #00b894;
    --danger: #e74c3c;
    --warning: #fdcb6e;
    --info: #0984e3;
    --text-dark: #2d3436;
    --text-light: #636e72;
    --text-white: #dfe6e9;
    --bg-main: #f5f6fa;
    --bg-card: #ffffff;
    --border-color: #e1e4e8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    direction: rtl;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============ LOGIN PAGE ============ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1d29 0%, #2d3143 50%, #6C5CE7 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.login-brand h2 {
    font-size: 28px;
    font-weight: 800;
    color: #1a1d29;
    line-height: 1.2;
}

.login-brand span {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 2px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-light);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    text-align: right;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.15);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108,92,231,0.4);
}

.messages { margin-bottom: 20px; }
.message {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 8px;
}
.message-error { background: #fde8e8; color: var(--danger); border: 1px solid #f5c6c6; }

/* ============ APP LAYOUT ============ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR (RIGHT SIDE) ============ */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--sidebar-bg);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 100;
    box-shadow: 2px 0 20px rgba(0,0,0,0.3);
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.logo-icon.large {
    width: 52px;
    height: 52px;
    font-size: 28px;
    border-radius: var(--radius-md);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-light);
    letter-spacing: 3px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section {
    padding: 4px 0;
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    margin: 2px 8px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background: rgba(108,92,231,0.2);
    color: #fff;
    border-left: 3px solid var(--primary);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    margin-right: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-main);
}

/* ============ TOPBAR ============ */
.topbar {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
    gap: 10px;
}

.btn-back {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.btn-back:hover {
    background: #f0edff;
    border-color: var(--primary-light);
    color: var(--primary);
}

.page-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    white-space: nowrap;
}

.topbar-center {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-width: 200px;
}

.topbar-center .search-box {
    width: 100%;
    max-width: 400px;
}

.topbar-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 0;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    gap: 8px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}

.search-icon {
    width: 18px;
    height: 18px;
    color: var(--text-light);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-dark);
    text-align: right;
}

.search-input:focus { outline: none; }
.search-input::placeholder { color: #b2bec3; }

.search-shortcut {
    background: var(--border-color);
    color: var(--text-light);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    font-weight: 600;
}

.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    background: #f8f9fc;
    border: 1px solid transparent;
}

.user-dropdown:hover {
    background: #f0edff;
    border-color: var(--primary-light);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

.dropdown-arrow {
    color: var(--text-light);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.user-dropdown:hover .dropdown-arrow {
    color: var(--primary);
}

.user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    z-index: 300;
    padding: 8px;
    border: 1px solid var(--border-color);
}

.user-menu.show {
    display: block;
    animation: menuSlideIn 0.15s ease;
}

@keyframes menuSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.15s;
}

.menu-item:hover {
    background: #f5f6fa;
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

.logout-item {
    color: var(--danger) !important;
    font-weight: 700 !important;
}

.logout-item:hover {
    background: #fde8e8 !important;
}

/* ============ CONTENT AREA ============ */
.content-area {
    padding: 24px;
    flex: 1;
}

/* ============ DASHBOARD GRID ============ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 26px;
    height: 26px;
    color: #fff;
}

.stat-icon.purple { background: linear-gradient(135deg, #6C5CE7, #a29bfe); }
.stat-icon.green { background: linear-gradient(135deg, #00b894, #55efc4); }
.stat-icon.orange { background: linear-gradient(135deg, #e17055, #fdcb6e); }
.stat-icon.blue { background: linear-gradient(135deg, #0984e3, #74b9ff); }
.stat-icon.teal { background: linear-gradient(135deg, #00cec9, #81ecec); }
.stat-icon.pink { background: linear-gradient(135deg, #fd79a8, #e84393); }
.stat-icon.red { background: linear-gradient(135deg, #e74c3c, #ff7675); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

/* ============ CARDS ============ */
.card {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-main);
    color: var(--text-dark);
}

.badge-green { background: #e6fff8; color: #00b894; }
.badge-red { background: #fde8e8; color: #e74c3c; }
.badge-orange { background: #fef3e2; color: #e17055; }
.badge-purple { background: #f0edff; color: #6C5CE7; }
.badge-blue { background: #e3f2ff; color: #0984e3; }
.badge-info { background: #e8f8f5; color: #00b894; }

/* ============ TABLES ============ */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: #f8f9fc;
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 12px 10px;
    font-weight: 700;
    font-size: 12px;
    color: var(--text-dark);
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

.data-table .col-group {
    background: #f0edff;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 13px;
}

.data-table .col-sub {
    font-weight: 600;
    color: var(--text-light);
    font-size: 11px;
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    text-align: center;
    color: var(--text-dark);
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: #f8f9ff;
}

.data-table .text-center { text-align: center; }
.data-table .text-right { text-align: right; }
.data-table .text-left { text-align: left; direction: ltr; }
.data-table .text-bold { font-weight: 700; }
.data-table .text-danger { color: var(--danger); font-weight: 600; }
.data-table .text-success { color: var(--success); font-weight: 600; }

.data-table .col-id { width: 40px; }
.data-table .col-name { min-width: 140px; }
.data-table .col-grade { min-width: 80px; }
.data-table .col-phone { min-width: 120px; }
.data-table .col-notes { min-width: 280px; max-width: 350px; text-align: right; font-size: 12px; line-height: 1.6; }

.table-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
}

.records-count {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

/* ============ REPORT CARD ============ */
.report-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.report-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.report-header-icon {
    width: 60px;
    height: 60px;
    background: #f0edff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.report-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.report-description {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.5;
}

/* ============ FILTERS ============ */
.report-filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filters-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}

.filter-group .filter-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
}

.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
    text-align: right;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}

/* Checkboxes */
.checkboxes-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
    user-select: none;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============ ACTION BUTTONS ============ */
.actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(108,92,231,0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(108,92,231,0.45);
}

.btn-excel {
    background: transparent;
    color: var(--success);
    border: 2px solid var(--success);
}

.btn-excel:hover {
    background: #e6fff8;
}

.btn-advanced {
    background: #f1f2f6;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-advanced:hover {
    background: #e1e4e8;
}

/* ============ DATA TABLE CARD ============ */
.data-table-card {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* ============ FAB ============ */
.fab {
    position: fixed;
    bottom: 28px;
    left: 28px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(108,92,231,0.4);
    z-index: 200;
    transition: var(--transition);
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 28px rgba(108,92,231,0.5);
}

/* ============ AI FAB ============ */
.fab-ai {
    position: fixed;
    bottom: 28px;
    left: 28px;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #6C5CE7, #e84393);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(108,92,231,0.5);
    z-index: 200;
    transition: var(--transition);
    animation: ai-pulse 2.5s ease-in-out infinite;
}

.fab-ai:hover {
    transform: scale(1.15);
    box-shadow: 0 12px 32px rgba(232,67,147,0.6);
}

.fab-ai-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #fdcb6e, #e17055);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 1px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

@keyframes ai-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(108,92,231,0.5); }
    50% { box-shadow: 0 8px 32px rgba(232,67,147,0.55), 0 0 40px rgba(108,92,231,0.2); }
}

/* ============ AI CHAT PANEL ============ */
.ai-chat-panel {
    position: fixed;
    bottom: 100px;
    left: 28px;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    z-index: 199;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
}

.ai-chat-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(135deg, #6C5CE7, #a29bfe);
    color: #fff;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
}

.ai-chat-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-chat-close:hover { background: rgba(255,255,255,0.35); }

.ai-chat-body {
    flex: 1;
    max-height: 320px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-message { max-width: 90%; }
.ai-message.bot { align-self: flex-end; }
.ai-message.user { align-self: flex-start; }

.ai-message p {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
}

.ai-message.bot p {
    background: #f0edff;
    color: var(--text-dark);
    border-bottom-right-radius: 4px;
}

.ai-message.user p {
    background: var(--primary);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-suggestion {
    padding: 8px 14px;
    background: #f5f6fa;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    transition: var(--transition);
}

.ai-suggestion:hover {
    background: #f0edff;
    border-color: var(--primary-light);
}

.ai-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
}

.ai-chat-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-family: inherit;
    font-size: 13px;
    text-align: right;
}

.ai-chat-input input:focus { outline: none; border-color: var(--primary); }

.ai-chat-input button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.ai-chat-input button:hover { transform: scale(1.05); }

/* ============ REPORT DATE ============ */
.report-date {
    position: fixed;
    bottom: 16px;
    right: 280px;
    font-size: 11px;
    color: var(--text-light);
    opacity: 0.5;
    font-weight: 500;
}

/* ============ DETAIL GRID ============ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
}

.detail-item {
    font-size: 14px;
    color: var(--text-dark);
}

.detail-item span {
    font-weight: 700;
    color: var(--text-light);
    display: block;
    font-size: 12px;
    margin-bottom: 2px;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

/* ============ WELCOME SECTION ============ */
.welcome-section {
    text-align: center;
    padding: 40px 20px;
}

.welcome-section h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.welcome-section p {
    font-size: 15px;
    color: var(--text-light);
}

/* ============ EMPTY STATE ============ */
.empty-state {
    padding: 60px 20px;
}

.empty-icon {
    color: var(--border-color);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-light);
    font-size: 15px;
}

/* ============ QR PLACEHOLDER ============ */
.qr-placeholder {
    text-align: center;
    padding: 60px 20px;
}

.qr-placeholder svg {
    width: 180px;
    height: 180px;
    color: var(--primary-light);
    margin-bottom: 16px;
    opacity: 0.6;
}

.qr-placeholder p {
    color: var(--text-light);
    font-size: 14px;
}

/* ============ FORM GRID (2-column table layout) ============ */
.form-grid { display: grid; grid-template-columns: 180px 1fr; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; background: #fff; }
.form-label { padding: 14px 18px; background: #f8f9fc; border-bottom: 1px solid var(--border-color); font-size: 14px; font-weight: 600; color: var(--text-dark); display: flex; align-items: center; border-left: 1px solid var(--border-color); }
.form-value { padding: 10px 14px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; overflow: visible; }
.form-label:last-of-type, .form-value:last-of-type { border-bottom: none; }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px; font-family: inherit; font-size: 14px; background: #fff; transition: var(--transition); text-align: right; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,92,231,0.1); }
.form-control:disabled { background: #f5f6fa; color: #999; cursor: not-allowed; }
select.form-control { cursor: pointer; direction: rtl; text-align: right; padding-right: 12px; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c0c4cc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a4ac;
}

/* ============ زر القائمة الجانبية (جوال/تابلت) ============ */
.btn-menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.btn-menu-toggle:hover {
    background: #f0edff;
    border-color: var(--primary-light);
    color: var(--primary);
}

/* خلفية القائمة الجانبية على الجوال */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 90;
}

/* زر إغلاق القائمة الجانبية (جوال/تابلت) */
.sidebar-close {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-inline-start: auto;
}
.sidebar-close:hover {
    background: rgba(255,255,255,0.22);
}

/* قفل تمرير الصفحة عند فتح القائمة */
body.no-scroll {
    overflow: hidden;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .btn-menu-toggle {
        display: flex;
    }
    .sidebar-close {
        display: flex;
    }
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.3s ease;
        width: 260px;
        min-width: 260px;
        box-shadow: 4px 0 30px rgba(0,0,0,0.35);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-backdrop.show {
        display: block;
    }
    .main-content {
        margin-right: 0;
    }
    .content-area {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        padding: 12px 16px;
    }
    .topbar-left {
        min-width: 0;
    }
    .page-title {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 40vw;
    }
    .topbar-center {
        order: 3;
        max-width: 100%;
        flex-basis: 100%;
    }
    .topbar-right {
        margin-right: auto;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .filters-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-group {
        width: 100%;
    }
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .actions-row {
        flex-wrap: wrap;
    }
    .topbar {
        gap: 10px;
    }

    /* تحويل النماذج ذات العمودين إلى عمود واحد */
    .user-form-grid,
    .employee-form-grid,
    .parent-form-grid,
    .subject-form-grid,
    .homework-form-grid,
    .teacher-form-grid,
    .supervisor-form-grid,
    .message-form-grid,
    .student-placement-grid,
    .class-list-filter-grid,
    .students-filter-grid,
    .transport-filter-grid,
    .exams-filter-grid,
    .exam-take-filter-grid,
    .assign-filter-grid,
    .parent-student-filter {
        grid-template-columns: 1fr !important;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ===== تكديس الليبل فوق الحقل في النماذج ===== */
    .detail-grid[class*="-form-grid"] .detail-item {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .detail-grid[class*="-form-grid"] .detail-item > span {
        flex: none;
        width: auto;
        padding-top: 0;
        text-align: right;
    }
    .detail-grid[class*="-form-grid"] .detail-item input,
    .detail-grid[class*="-form-grid"] .detail-item select,
    .detail-grid[class*="-form-grid"] .detail-item textarea {
        width: 100%;
        flex: none;
    }
    .detail-grid[class*="-form-grid"] .detail-item > div {
        width: 100%;
        flex: none !important;
    }

    /* ===== تكديس الليبل فوق مربع الاختيار في الفلاتر ===== */
    .filters-row[class*="-filter-grid"] .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    .filters-row[class*="-filter-grid"] .filter-label {
        flex: none;
        width: auto;
        text-align: right;
    }
    .filters-row[class*="-filter-grid"] .filter-select {
        width: 100%;
    }

    /* ===== استمارة الطالب وكشف المراجعة (form-grid) ===== */
    .form-grid {
        grid-template-columns: 1fr !important;
    }
    .form-grid .form-label {
        border-left: none;
        padding-bottom: 4px;
    }
    .placement-grid {
        grid-template-columns: 1fr !important;
    }
    .placement-grid .form-value:nth-child(2),
    .placement-grid .form-value:nth-child(6) {
        border-left: none;
    }
}

/* ============ PRINT STYLES ============ */
@media print {
    .sidebar, .topbar, .fab, .fab-ai, .report-date, .btn, .actions-row, .report-filters {
        display: none !important;
    }
    .main-content {
        margin-right: 0 !important;
    }
    .data-table-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
