/* ============================================
منصة آفاق التعليمية - ملف CSS الرئيسي
============================================ */

/* ==================== VARIABLES ==================== */
:root {
    --primary: #11315a;
    --primary-dark: #0d2546;
    --secondary: #e2ad33;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);
    
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
}

/* ==================== BASE STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==================== LOADER ==================== */
.loader {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    color: white;
}

.logo-loader {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    animation: pulse 2s infinite;
}

.logo-loader-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

@keyframes pulse { 
    0%, 100% { opacity: 1; transform: scale(1); } 
    50% { opacity: 0.8; transform: scale(0.95); } 
}

/* ============================================
   طلبات المعلمين - تصميم حديث
============================================ */
.teachers-requests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
}

.teacher-request-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid var(--gray-100);
}

.teacher-request-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.request-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 1.25rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.request-header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.badge-warning {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

.request-details {
    padding: 1.25rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}

.request-details p {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.request-details i {
    width: 20px;
    color: var(--primary);
}

.request-actions {
    padding: 1.25rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    background: white;
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-success:hover {
    background: #0b8f5c;
    transform: scale(1.02);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: #c82333;
    transform: scale(1.02);
}

/* ============================================
   مواد الصفوف - تصميم حديث
============================================ */
.grade-subject-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: all 0.3s;
    border: 1px solid var(--gray-100);
    position: relative;
    overflow: hidden;
}

.grade-subject-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.grade-subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
}

.grade-subject-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.grade-subject-card p {
    color: var(--gray-500);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* ==================== HERO VISUAL ==================== */
.hero-visual {
    position: relative;
    height: 500px;
}

.floating-elements {
    position: absolute;
    inset: 0;
    z-index: 10;
}

.float-card {
    position: absolute;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    animation: float-card 6s infinite ease-in-out;
}
.landing-page {
    min-height: 100vh;
    background: white;
}

.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-200);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo-icon {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
}

.nav-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.nav-logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary);
}

.btn-nav-login {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.btn-nav-login:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ==================== HERO SECTION ==================== */
.hero {
    min-height: 100vh;
    padding: 8rem 2rem 4rem;
    position: relative;
    overflow: hidden;
}

.hero-bg-effects {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.effect-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.c1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -100px;
    right: -100px;
    animation: float 20s infinite;
}

.c2 {
    width: 400px;
    height: 400px;
    background: var(--secondary);
    bottom: -100px;
    left: -100px;
    animation: float 15s infinite reverse;
}

.c3 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    top: 50%;
    left: 30%;
    animation: float 18s infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0,0) scale(1); }
    33% { transform: translate(30px,-30px) scale(1.1); }
    66% { transform: translate(-20px,20px) scale(0.9); }
}

.hero-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(37,99,235,0.1);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
}

.hero-desc {
    font-size: 1.25rem;
    color: var(--gray-600);
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
}

.btn-hero-main {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(37,99,235,0.3);
}

.btn-hero-main:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(37,99,235,0.4);
}

.btn-hero-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s;
}

.btn-hero-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.hero-stats-row {
    display: flex;
    gap: 3rem;
}

.h-stat {
    text-align: center;
}

.h-stat strong {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
}

.h-stat span {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ==================== HERO VISUAL ==================== */
.hero-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 450px;
}

.floating-elements {
    position: absolute;
    inset: 0;
    z-index: 10;
}

.float-card {
    position: absolute;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    animation: float-card 6s infinite ease-in-out;
}

.float-card i {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.f1 {
    top: 10%;
    right: 10%;
    animation-delay: 0s;
}

.f1 i { background: var(--primary); }

.f2 {
    top: 40%;
    left: 0;
    animation-delay: 2s;
}

.f2 i { background: var(--secondary); }

.f3 {
    bottom: 20%;
    right: 5%;
    animation-delay: 4s;
}

.f3 i { background: var(--success); }

@keyframes float-card {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.main-preview {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
}

.browser-window {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.browser-bar {
    background: var(--gray-100);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
}

.browser-dots {
    display: flex;
    gap: 0.5rem;
}

.browser-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gray-300);
}

.browser-dots span:nth-child(1) { background: #ef4444; }
.browser-dots span:nth-child(2) { background: #f59e0b; }
.browser-dots span:nth-child(3) { background: #10b981; }

.browser-body {
    display: flex;
    height: 250px;
}

.mock-sidebar {
    width: 60px;
    background: var(--gray-50);
    border-left: 1px solid var(--gray-200);
}

.mock-content {
    flex: 1;
    padding: 1rem;
}

.mock-header {
    height: 40px;
    background: var(--gray-100);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.mock-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.mock-grid div {
    height: 60px;
    background: linear-gradient(135deg, rgba(37,99,235,0.1), rgba(249,115,22,0.1));
    border-radius: var(--radius);
}

/* ==================== FEATURES SECTION ==================== */
.features-section {
    padding: 6rem 2rem;
    background: var(--gray-50);
}

.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 4rem;
}

.section-label {
    display: inline-block;
    background: rgba(37,99,235,0.1);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--gray-600);
    font-size: 1.1rem;
}

.features-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.feature-box {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: all 0.3s;
}

.feature-box:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.f-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.f-icon.blue { background: rgba(37,99,235,0.1); color: var(--primary); }
.f-icon.orange { background: rgba(249,115,22,0.1); color: var(--secondary); }
.f-icon.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.f-icon.green { background: rgba(16,185,129,0.1); color: var(--success); }
.f-icon.pink { background: rgba(236,72,153,0.1); color: #ec4899; }
.f-icon.teal { background: rgba(20,184,166,0.1); color: #14b8a6; }

.feature-box h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.feature-box p {
    color: var(--gray-600);
    line-height: 1.7;
}

/* ==================== CTA SECTION ==================== */
.cta-section {
    padding: 6rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    position: relative;
    overflow: hidden;
}

.cta-box {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    color: white;
    position: relative;
    z-index: 1;
}

.cta-box h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.cta-box p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.btn-cta-main {
    background: white;
    color: var(--primary);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.btn-cta-main:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

/* ==================== FOOTER ==================== */
.main-footer {
    background: var(--gray-900);
    color: white;
    padding: 4rem 2rem 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 4rem;
    margin-bottom: 3rem;
}

.footer-brand {
    max-width: 300px;
}

.footer-brand .nav-logo {
    margin-bottom: 1rem;
}

.footer-brand .nav-logo-icon {
    color: var(--primary);
}

.footer-brand .nav-logo-text {
    background: linear-gradient(135deg, white, var(--gray-300));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.footer-brand p {
    color: var(--gray-400);
    line-height: 1.7;
}

.footer-links {
    display: flex;
    gap: 4rem;
}

.f-col h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.f-col a {
    display: block;
    color: var(--gray-400);
    text-decoration: none;
    margin-bottom: 0.75rem;
    transition: color 0.3s;
}

.f-col a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding-top: 2rem;
    text-align: center;
    color: var(--gray-500);
}

/* ==================== AUTH SCREEN ==================== */
.auth-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.btn-back {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.btn-back:hover {
    background: white;
    color: var(--primary);
}

.auth-box {
    background: white;
    border-radius: var(--radius-xl);
    padding: 3rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 auto 1rem;
}

.auth-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-logo h1 {
    font-size: 1.75rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.auth-logo p {
    color: var(--gray-500);
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--gray-100);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.3s;
}

.auth-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.phone-group {
    grid-column: 1 / -1;
}

.phone-wrapper {
    display: flex;
    gap: 0.5rem;
}

.phone-wrapper select {
    width: 120px;
    flex-shrink: 0;
    padding: 0.875rem 0.5rem;
}

.phone-wrapper input {
    flex: 1;
}

.password-input {
    position: relative;
}

.password-input input {
    width: 100%;
    padding-left: 2.5rem;
}

.toggle-pass {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    cursor: pointer;
    transition: color 0.3s;
}

.toggle-pass:hover {
    color: var(--primary);
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37,99,235,0.3);
}

.error-text {
    color: var(--danger);
    font-size: 0.875rem;
    text-align: center;
    min-height: 1.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.875rem;
    color: var(--gray-500);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* ==================== DASHBOARD ==================== */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 280px;
    background: white;
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.s-logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
}

.s-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.s-logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    padding: 0 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    transition: all 0.3s;
    position: relative;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.nav-link.active {
    background: rgba(37,99,235,0.1);
    color: var(--primary);
    font-weight: 600;
}

.nav-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.nav-badge {
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 50px;
    margin-right: auto;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info span {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.9rem;
}

.user-info small {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all 0.3s;
}

.btn-logout:hover {
    color: var(--danger);
    background: rgba(239,68,68,0.1);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-right: 280px;
    transition: all 0.3s;
}

.content-header {
    background: white;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: var(--radius);
    transition: all 0.3s;
    position: relative;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.pages-container {
    padding: 2rem;
}

/* ==================== PAGES ==================== */
.page {
    display: none;
    animation: fadeIn 0.3s;
}

.page.active {
    display: block;
}

.page.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== HOME PAGE ==================== */
.welcome-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-xl);
    border-left: 4px solid rgba(255,255,255,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.welcome-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(37,99,235,0.2);
}

.welcome-text h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.welcome-text p {
    opacity: 0.9;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(37,99,235,0.1); color: var(--primary); }
.stat-icon.orange { background: rgba(249,115,22,0.1); color: var(--secondary); }
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.stat-icon.warning { background: rgba(245,158,11,0.1); color: #f59e0b; }
.stat-icon.danger { background: rgba(239,68,68,0.1); color: #ef4444; }
.stat-icon.success { background: rgba(16,185,129,0.1); color: var(--success); }

.stat-info h4 {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-info span {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
}

.activity-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.activity-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: var(--gray-800);
}

/* ==================== VIDEO/SESSIONS PAGE ==================== */
.video-container {
    background: var(--gray-900);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.video-box {
    aspect-ratio: 16/9;
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    position: relative;
    transition: all 0.3s;
}

.video-box i {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.video-box span {
    font-size: 1.25rem;
}

.video-controls {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
}

.video-controls button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.video-controls button:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.video-controls button.active {
    background: var(--danger);
}

.video-controls button.btn-end {
    background: var(--danger);
}

.video-controls button.btn-rec {
    background: var(--gray-600);
}

.video-controls button.btn-rec.active {
    background: var(--danger);
    animation: pulse 1.5s infinite;
}

.session-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-800);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    gap: 1rem;
}

.rec-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--danger);
    font-weight: 600;
}

.rec-indicator.hidden {
    display: none;
}

.rec-dot {
    width: 10px;
    height: 10px;
    background: var(--danger);
    border-radius: 50%;
    animation: blink 1s infinite;
}

.session-timer {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
}

/* ==================== CHAT PAGE ==================== */
.chat-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    height: calc(100vh - 200px);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.chat-sidebar {
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
}

.chat-search-box {
    padding: 1rem;
    position: relative;
    border-bottom: 1px solid var(--gray-200);
    background: white;
}

.chat-search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-family: inherit;
    transition: all 0.3s;
}

.chat-search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-search-box i {
    position: absolute;
    left: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.chat-area {
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    background: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--gray-50);
    display: flex;
    flex-direction: column;
}

.chat-input {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.75rem;
    background: white;
    align-items: center;
}

.chat-input.hidden {
    display: none;
}

.chat-input input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-family: inherit;
    transition: all 0.3s;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-input button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.chat-input button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.btn-record {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-record:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-record.recording {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    animation: pulse 1s infinite;
}

/* ==================== CHAT ITEMS ==================== */
.chat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: white;
}

.chat-item:hover {
    background: var(--gray-100);
    transform: translateX(-4px);
}

.chat-item.active {
    background: rgba(37, 99, 235, 0.1);
    border-right: 3px solid var(--primary);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.chat-preview {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-msg {
    font-size: 0.875rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== MESSAGES ==================== */
.message {
    max-width: 70%;
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    position: relative;
    animation: msgSlide 0.3s ease-out;
}

@keyframes msgSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-bottom-left-radius: 4px;
    margin-left: auto;
}

.message.received {
    align-self: flex-start;
    background: white;
    color: var(--gray-800);
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.message-content {
    margin-bottom: 0.5rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message audio {
    border-radius: var(--radius);
    max-width: 100%;
}

/* ==================== TABLES ==================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    padding: 1rem;
    text-align: right;
    font-weight: 700;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.data-table tr:hover {
    background: var(--gray-50);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.text-center {
    text-align: center;
    color: var(--gray-500);
    padding: 3rem;
}

/* ==================== CARDS GRID ==================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--gray-200);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ==================== TEACHER CARDS ==================== */
.teacher-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: all 0.3s;
}

.teacher-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.teacher-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.teacher-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.teacher-subject {
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.teacher-email {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.teachers-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.teacher-admin-card {
    background: white;
    border-radius: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.teacher-admin-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.teacher-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
}

.teacher-info h4 {
    margin: 0;
    font-size: 1.1rem;
}

.teacher-info p {
    margin: 0.15rem 0;
    color: var(--gray-500);
    font-size: 0.9rem;
}

.teacher-details {
    padding: 0 1.5rem 1rem;
    display: grid;
    gap: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

.teacher-details p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.teacher-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem;
    justify-content: flex-end;
    border-top: 1px solid var(--gray-100);
}

.btn-whatsapp {
    background: #25d366;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-whatsapp:hover {
    background: #1ebd5a;
}

.btn-success,
.btn-danger {
    min-width: 120px;
}

.teacher-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-100);
}

.t-stat {
    text-align: center;
}

.t-stat strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.t-stat span {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
}

/* ==================== QUIZ CARDS ==================== */
.quizzes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.quiz-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.quiz-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.quiz-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
}

.quiz-card h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--gray-800);
}

.quiz-card p {
    color: var(--gray-600);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.quiz-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.quiz-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.quiz-meta i {
    color: var(--primary);
}

/* ==================== QUIZ BUILDER ==================== */
.builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-100);
    flex-wrap: wrap;
    gap: 1rem;
}

.builder-form {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.option-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.option-row input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.option-row input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    transition: all 0.3s;
}

.option-row input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-add-opt {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    background: none;
    color: var(--gray-500);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
}

.btn-add-opt:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

/* ==================== RECORDING CARDS ==================== */
.recording-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: all 0.3s;
}

.recording-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.rec-thumb {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, var(--gray-800), var(--gray-900));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    position: relative;
}

.rec-play {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.5rem;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s;
    cursor: pointer;
}

.recording-card:hover .rec-play {
    opacity: 1;
    transform: scale(1);
}

.rec-info {
    padding: 1.25rem;
}

.rec-title {
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.rec-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.rec-actions {
    display: flex;
    gap: 0.5rem;
}

/* ==================== MONITORING ==================== */
.monitor-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--gray-100);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    width: fit-content;
}

.mon-tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.3s;
}

.mon-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.monitor-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    min-height: 400px;
}

.monitor-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
    background: white;
}

.monitor-header {
    background: var(--gray-50);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

.monitor-header:hover {
    background: var(--gray-100);
}

.monitor-users {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mon-sender {
    font-weight: 700;
    color: var(--primary);
}

.monitor-msgs {
    padding: 1rem 1.25rem;
    background: white;
    max-height: 300px;
    overflow-y: auto;
}

.mon-msg {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius);
    background: var(--gray-50);
    border-right: 3px solid var(--primary);
}

/* ==================== MODALS ==================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    padding: 1rem;
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease-out;
    box-shadow: var(--shadow-xl);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
}

.btn-close {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1.25rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-close:hover {
    background: var(--gray-100);
    color: var(--danger);
}

.modal form {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* ==================== BUTTONS ==================== */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

/* ==================== PAGE HEADER ==================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-input {
    position: relative;
    width: 300px;
}

.search-input input {
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-family: inherit;
    transition: all 0.3s;
}

.search-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-input i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* ==================== ACTIVITY ITEMS ==================== */
.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    transition: all 0.3s;
    border: 1px solid var(--gray-100);
}

.activity-item:hover {
    background: var(--gray-100);
    transform: translateX(-4px);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-size: 1rem;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.empty-activity {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.empty-activity i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.5;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
#toast-container {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    animation: toastSlide 0.3s ease-out;
    border-right: 4px solid;
}

.toast.success {
    border-right-color: var(--success);
}

.toast.error {
    border-right-color: var(--danger);
}

.toast.info {
    border-right-color: var(--primary);
}

.toast.warning {
    border-right-color: var(--warning);
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.toast.info .toast-icon {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.toast.warning .toast-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* ==================== UTILITY CLASSES ==================== */
.hidden {
    display: none !important;
}

/* ==================== EMPTY STATES ==================== */
.empty-chats,
.empty-activity,
.select-chat-msg {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-500);
}

.empty-chats i,
.empty-activity i,
.select-chat-msg i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.5;
}

/* ==================== HERO IMAGE ==================== */
.hero-image-container {
    text-align: center;
    animation: float 4s ease-in-out infinite;
    position: relative;
    z-index: 5;
}

.hero-image {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-image:hover {
    transform: scale(1.02);
    box-shadow: 0 30px 50px rgba(0,0,0,0.3);
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* للشاشات الصغيرة */
@media (max-width: 768px) {
    .hero-image {
        max-height: 300px;
    }
    .hero-image-container {
        animation: float 3s ease-in-out infinite;
    }
}

/* ==================== ABOUT SECTION ==================== */
.about-section {
    padding: 6rem 2rem;
    background: white;
}

.about-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    flex-wrap: wrap;
}

.about-text {
    flex: 1;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--gray-700);
}

.about-text p {
    margin-bottom: 1rem;
}

.about-stats {
    display: flex;
    gap: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 2rem;
    border-radius: 32px;
    color: white;
}

.about-stat {
    text-align: center;
}

.about-stat span {
    font-size: 2rem;
    font-weight: 800;
    display: block;
}

.about-stat p {
    margin-top: 0.5rem;
}

/* ==================== CONTACT SECTION ==================== */
.contact-section {
    padding: 6rem 2rem;
    background: var(--gray-50);
}

.contact-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 4rem;
    flex-wrap: wrap;
}

.contact-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-card {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.contact-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.contact-card h4 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.contact-card a {
    color: var(--secondary);
    text-decoration: none;
    transition: all 0.3s;
}

.contact-card a:hover {
    opacity: 0.8;
}

.contact-form {
    flex: 1;
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(17, 49, 90, 0.1);
}

.contact-form button {
    width: 100%;
}

/* ==================== TERMS CONTENT ==================== */
.terms-content {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    max-width: 1000px;
    margin: 0 auto;
    line-height: 1.8;
}

.terms-content h4 {
    color: var(--primary);
    font-size: 1.2rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.terms-content p {
    color: var(--gray-700);
    margin-bottom: 1rem;
}

.terms-content ul {
    list-style: none;
    padding-right: 2rem;
    margin-bottom: 1rem;
}

.terms-content li {
    padding: 0.5rem 0;
    color: var(--gray-700);
    padding-right: 1rem;
}

.terms-content li:before {
    content: "✓ ";
    color: var(--secondary);
    font-weight: bold;
    margin-right: 0.5rem;
}

/* ==================== RISEUP LINK ==================== */
.riseup-link {
    cursor: pointer;
    font-weight: bold;
    color: var(--secondary);
    position: relative;
    display: inline-block;
    transition: all 0.3s;
}

.riseup-link:hover {
    color: #ff8c00;
    text-shadow: 0 0 8px rgba(255,140,0,0.6);
    transform: scale(1.05);
}

.riseup-link:active {
    transform: scale(0.95);
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: inline-block;
    color: var(--gray-400);
    font-size: 1.5rem;
    transition: all 0.3s;
    text-decoration: none;
}

.social-links a:hover {
    color: var(--secondary);
    transform: translateY(-3px);
}

/* ==================== MODAL ANIMATIONS ==================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-box {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 1rem;
}

.modal-header h3 {
    color: var(--primary);
    font-size: 1.3rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    transition: color 0.3s;
}

.btn-close:hover {
    color: var(--gray-700);
}

.modal-body {
    margin-bottom: 2rem;
    color: var(--gray-700);
    line-height: 1.8;
}

.modal-body h4 {
    color: var(--primary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-body ul {
    list-style: none;
    padding-right: 2rem;
}

.modal-body li {
    padding: 0.5rem 0;
    padding-right: 1rem;
}

.modal-body li:before {
    content: "✓ ";
    color: var(--secondary);
    font-weight: bold;
    margin-right: 0.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ==================== LOGO ANIMATIONS ==================== */
.nav-logo-icon {
    transition: transform 0.3s ease;
}

.nav-logo-icon:hover {
    transform: scale(1.1) rotate(5deg);
}

.auth-logo-icon {
    transition: transform 0.3s;
}

.auth-logo-icon:hover {
    transform: scale(1.05);
}

.footer-brand .nav-logo-icon:hover {
    transform: scale(1.1) rotate(-5deg);
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
    .about-content {
        flex-direction: column;
        text-align: center;
    }

    .about-stats {
        flex-direction: column;
        gap: 1.5rem;
    }

    .contact-container {
        flex-direction: column;
    }

    .footer-links {
        flex-direction: column;
        gap: 2rem;
    }

    .social-links a {
        font-size: 1.2rem;
        margin-left: 0.8rem;
    }

    .contact-form,
    .contact-info {
        max-width: 100%;
    }
}
@media (max-width: 1024px) {
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content {
        order: 2;
    }

    .hero-visual {
        order: 1;
        height: 300px;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-stats-row {
        justify-content: center;
    }

    .floating-elements {
        display: none;
    }

    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-right: 0;
    }

    .chat-layout {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        display: none;
    }

    .nav-links {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .auth-box {
        padding: 2rem 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .phone-wrapper {
        flex-direction: column;
    }

    .phone-wrapper select {
        width: 100%;
    }

    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 2rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        width: 100%;
    }

    .quizzes-grid,
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .builder-header {
        flex-direction: column;
        gap: 1rem;
    }

    .monitor-tabs {
        width: 100%;
    }

    .data-table {
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .chat-layout {
        height: calc(100vh - 150px);
    }
    
    .video-controls button {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .btn-hero-main,
    .btn-hero-secondary {
        width: 100%;
        justify-content: center;
    }

    .nav-container {
        padding: 1rem;
    }

    .auth-box {
        padding: 1.5rem 1rem;
    }

    .welcome-card {
        padding: 1.5rem;
    }

    .welcome-text h1 {
        font-size: 1.5rem;
    }
    
    .session-info-bar {
        flex-direction: column;
        text-align: center;
    }
    
    .chat-input {
        flex-wrap: wrap;
    }
    
    .chat-input input {
        order: -1;
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .sidebar,
    .landing-nav,
    .btn-icon,
    .modal,
    #toast-container,
    .video-controls,
    .chat-input,
    .btn-record {
        display: none !important;
    }

    .main-content {
        margin-right: 0;
    }

    .page {
        display: block !important;
    }
}

/* ==================== SCROLLBAR STYLING ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--radius);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ==================== SELECTION ==================== */
::selection {
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary-dark);
}

/* ==================== FOCUS VISIBLE ==================== */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* ==================== LOADING STATES ==================== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}
/* ==================== إضافات لجلسات Jitsi Meet ==================== */

.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.session-card {
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: all 0.3s;
}

.session-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.session-card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 1.25rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-card-header h4 {
    margin: 0;
    font-size: 1.1rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-scheduled {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.status-live {
    background: var(--danger);
    color: white;
    animation: pulse 2s infinite;
}

.status-ended {
    background: var(--gray-500);
    color: white;
}

.session-card-info {
    padding: 1.25rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.info-row i {
    width: 20px;
    color: var(--primary);
}

.session-card-actions {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-100);
}

.session-controls {
    background: var(--gray-900);
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
}

.session-header-info {
    background: var(--gray-800);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid var(--gray-700);
}

.session-header-info h3 {
    color: white;
    margin: 0;
    font-size: 1.25rem;
}

.session-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.session-timer {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gray-700);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: white;
}

.jitsi-container {
    flex: 1;
    min-height: 500px;
    background: var(--gray-800);
    position: relative;
}

#jitsi-meet {
    height: 100%;
    width: 100%;
}

.session-actions {
    padding: 1rem 1.5rem;
    background: var(--gray-800);
    display: flex;
    gap: 1rem;
    justify-content: center;
    border-top: 1px solid var(--gray-700);
}

.sessions-header {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.sessions-header .page-header {
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .sessions-grid {
        grid-template-columns: 1fr;
    }
    
    .session-header-info {
        flex-direction: column;
        text-align: center;
    }
    
    .session-info {
        justify-content: center;
    }
    
    .session-actions {
        flex-direction: column;
    }
    
    .session-actions button {
        width: 100%;
        justify-content: center;
    }
    
    .jitsi-container {
        min-height: 400px;
    }
}

@media (max-width: 480px) {
    .session-card-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}
/* ==================== Dashboard Enhancements ==================== */

/* تحسين بطاقات الإحصائيات */
.stat-card {
    transition: all 0.3s ease;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* ==================== تنسيقات الاختبارات الجديدة ==================== */

.quiz-card {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--gray-100);
}

.quiz-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.quiz-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--gray-800);
}

.quiz-grade {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.quiz-body {
    margin-bottom: 1rem;
}

.quiz-question {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 12px;
    line-height: 1.6;
}

.quiz-question i {
    color: var(--primary);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.quiz-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--gray-500);
    flex-wrap: wrap;
}

.quiz-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.quiz-meta i {
    color: var(--primary);
}

.quiz-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
}

/* خيارات الاختبار */
.quiz-questions-container {
    padding: 2rem;
}

.quiz-question-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    max-width: 600px;
    margin: 0 auto;
}

.quiz-question-card h3 {
    color: var(--gray-800);
    margin-bottom: 2rem;
    font-size: 1.3rem;
    line-height: 1.6;
}

.quiz-options {
    margin-bottom: 2rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--gray-50);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.quiz-option:hover {
    background: rgba(37, 99, 235, 0.05);
    border-color: var(--primary);
}

.quiz-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.quiz-option span {
    flex: 1;
    color: var(--gray-700);
    font-weight: 500;
}

/* حالة التحميل */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.loading-state i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
    color: var(--primary);
}

/* ==================== تنسيقات الواجبات الجديدة ==================== */

.assignment-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
    border: 1px solid var(--gray-100);
    margin-bottom: 1.5rem;
}

.assignment-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--gray-800);
    flex: 1;
}

.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info);
}

.assignment-card p {
    color: var(--gray-600);
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.card-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.card-meta i {
    color: var(--primary);
}

.card-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* واجبات الطالب */
.student-assignment {
    position: relative;
}

.student-assignment .teacher-name {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.assignment-details {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 12px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.assignment-details span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.due-date.overdue {
    color: var(--danger);
    font-weight: 600;
}

.grade {
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    color: var(--success);
    font-weight: 600;
}

.feedback-section {
    background: rgba(6, 182, 212, 0.05);
    padding: 1rem;
    border-left: 4px solid var(--info);
    border-radius: 8px;
    margin-top: 1rem;
}

.feedback-section strong {
    display: block;
    color: var(--info);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.feedback-section p {
    color: var(--gray-700);
    margin: 0;
}

/* ==================== تنسيقات الحجوزات ==================== */

.booking-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
    border: 1px solid var(--gray-100);
    margin-bottom: 1.5rem;
}

.booking-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.booking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.booking-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--gray-800);
}

.booking-details {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.booking-details p {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.booking-details i {
    color: var(--primary);
    width: 20px;
}

.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* ==================== responsive ==================== */

@media (max-width: 768px) {
    .quiz-card {
        padding: 1rem;
    }

    .quiz-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .quiz-question-card {
        padding: 1rem;
    }

    .assignment-card {
        padding: 1rem;
    }

    .card-header {
        flex-direction: column;
    }

    .booking-card {
        padding: 1rem;
    }

    .booking-details p {
        flex-wrap: wrap;
    }

    .card-footer {
        flex-direction: column;
    }

    .card-footer button {
        width: 100%;
    }
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* تنسيق رسالة الترحيب */
.welcome-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    position: relative;
    overflow: hidden;
}

.welcome-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulseGlow 8s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.welcome-text h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.welcome-text h1 small {
    font-size: 0.9rem;
    opacity: 0.8;
    display: block;
    margin-top: 0.25rem;
}

/* تنسيق عناصر النشاطات */
.activity-item {
    transition: all 0.3s ease;
}

.activity-icon.orange {
    background: rgba(249, 115, 22, 0.1);
    color: var(--secondary);
}

.activity-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.role-badge {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.status-text {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    margin-right: 0.5rem;
}

.status-text.confirmed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-text.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* تنسيق إضافي للبطاقات */
.stat-info h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
}

.stat-info span {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-800);
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 768px) {
    .welcome-text h1 {
        font-size: 1.3rem;
    }
    
    .stat-info span {
        font-size: 1.2rem;
    }
    
    .stat-info h4 {
        font-size: 0.75rem;
    }
}

/* ============================================
تحسينات Dashboard الجديدة
============================================ */

/* تحسين بطاقات الإحصائيات */
.stat-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--gray-100);
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.stat-icon.teal {
    background: rgba(20, 184, 166, 0.1);
    color: #14b8a6;
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* تحسين رسالة الترحيب */
.welcome-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.welcome-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulseGlow 8s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* تحسين عناصر النشاطات */
.activity-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    margin-top: 2rem;
}

.activity-section h3 {
    color: var(--gray-800);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activity-section h3::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary);
    border-radius: 2px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    transition: all 0.3s;
    border: 1px solid var(--gray-100);
    border-right: 3px solid transparent;
}

.activity-item:hover {
    background: white;
    border-right-color: var(--primary);
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

.activity-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.activity-icon.blue { background: rgba(37, 99, 235, 0.1); color: var(--primary); }
.activity-icon.orange { background: rgba(249, 115, 22, 0.1); color: var(--secondary); }
.activity-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.activity-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.activity-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.activity-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* ==================== تحسينات الشات ==================== */
.chat-messages {
    background: #f8fafc;
    scroll-behavior: smooth;
}

.message {
    max-width: 75%;
    word-wrap: break-word;
}

.message.sent {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.message.received {
    background: white;
    border: 1px solid #e2e8f0;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    gap: 0.5rem;
}

.reply-btn, .message-actions button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.reply-btn:hover, .message-actions button:hover {
    opacity: 1;
}

.reply-preview {
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #475569;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reply-preview-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.cancel-reply {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    margin-right: auto;
}
.cancel-reply:hover {
    color: #ef4444;
}

.reply-to {
    background: rgba(0,0,0,0.05);
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-block;
}

.reply-name {
    font-weight: bold;
    margin-left: 0.3rem;
}

.chat-input-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}
.chat-input-row textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    max-height: 120px;
}
.chat-input-row button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.chat-input-row button:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

/* ============================================
   تحسينات للشاشات الصغيرة (Mobile)
============================================ */
@media (max-width: 768px) {
    /* Dashboard sidebar */
    .sidebar {
        width: 280px;
        transform: translateX(100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0;
    }

    /* Chat layout */
    .chat-layout {
        grid-template-columns: 1fr;
        height: calc(100vh - 120px);
    }
    .chat-sidebar {
        display: none;
    }
    .chat-sidebar.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 200;
        width: 100%;
    }
    .chat-area {
        height: 100%;
    }
    .chat-messages {
        max-height: calc(100% - 100px);
    }

    /* Forms */
    .form-row {
        flex-direction: column;
    }
    .phone-wrapper {
        flex-direction: column;
    }
    .phone-wrapper select {
        width: 100%;
    }

    /* Tables */
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Cards */
    .cards-grid {
        grid-template-columns: 1fr;
    }

    /* Session card */
    .session-card-header {
        flex-direction: column;
        text-align: center;
    }
    .session-info-bar {
        flex-direction: column;
        text-align: center;
    }

    /* Welcome card */
    .welcome-text h1 {
        font-size: 1.3rem;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    .stat-card {
        padding: 1rem;
    }
    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    .stat-info span {
        font-size: 1.2rem;
    }

    /* Modal */
    .modal-box {
        width: 95%;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
    }
    .hero-desc {
        font-size: 1rem;
    }
    .hero-buttons {
        flex-direction: column;
    }
    .btn-hero-main, .btn-hero-secondary {
        width: 100%;
        justify-content: center;
    }
    .auth-box {
        padding: 1.5rem;
    }
    .message {
        max-width: 85%;
    }
}
.activity-icon.teal { background: rgba(20, 184, 166, 0.1); color: #14b8a6; }

/* ============================================
   تحسينات للهواتف والأجهزة اللوحية
   ============================================ */

/* عام */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    /* شريط جانبي */
    .sidebar {
        width: 280px;
        transform: translateX(100%);
        position: fixed;
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .main-content {
        margin-right: 0;
        width: 100%;
    }
    
    /* رأس الصفحة */
    .content-header {
        padding: 1rem;
    }
    
    .content-header h2 {
        font-size: 1.2rem;
    }
    
    /* المحتوى الرئيسي */
    .pages-container {
        padding: 1rem;
    }
    
    /* بطاقات الإحصائيات */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .stat-info span {
        font-size: 1.2rem;
    }
    
    .stat-info h4 {
        font-size: 0.75rem;
    }
    
    /* بطاقات المواد والمعلمين */
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* الجداول */
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

/* ============================================
   تصميم الشات مثل واتساب - متجاوب بالكامل
   ============================================ */

/* تنسيق صفحة الشات الرئيسية */
#page-chat {
    height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f0f2f5;
}

/* تخطيط الشات */
.chat-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* الشريط الجانبي للمحادثات */
.chat-sidebar {
    width: 320px;
    background: white;
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
}

/* رأس الشريط الجانبي */
.chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e9ecef;
    background: white;
}

.chat-sidebar-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

/* مربع البحث */
.chat-search-box {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    background: white;
}

.chat-search-box input {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 24px;
    background: #f0f2f5;
    font-family: inherit;
    font-size: 0.9rem;
}

.chat-search-box input:focus {
    outline: none;
    background: #e9ecef;
}

/* قائمة المحادثات */
.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* عنصر المحادثة */
.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.chat-item:hover {
    background: #f0f2f5;
}

.chat-item.active {
    background: #e9ecef;
}

.chat-item.unread {
    background: #e8f0fe;
}

/* صورة المستخدم */
.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* معاينة الرسالة */
.chat-preview {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-msg {
    font-size: 0.85rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 0.7rem;
    color: #94a3b8;
}

.unread-badge {
    width: 10px;
    height: 10px;
    background: #2563eb;
    border-radius: 50%;
    flex-shrink: 0;
}

/* منطقة المحادثة الرئيسية */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f8fafc;
}

/* رأس المحادثة */
.chat-header {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-to-chats {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #2563eb;
    padding: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-status {
    font-size: 0.75rem;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

/* منطقة الرسائل */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
}

/* تنسيق الرسائل */
.message {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.message.sent {
    align-self: flex-end;
    background: #2563eb;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.message-text {
    line-height: 1.4;
    font-size: 0.95rem;
}

.message-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 0.65rem;
    opacity: 0.7;
}

.message-time {
    font-size: 0.65rem;
}

.read-status {
    font-size: 0.7rem;
}

.read-status.read {
    color: #34d399;
}

.reply-btn {
    background: none;
    border: none;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 2px;
}

.reply-btn:hover {
    opacity: 1;
}

.reply-to {
    background: rgba(0,0,0,0.05);
    padding: 4px 8px;
    border-radius: 12px;
    margin-bottom: 6px;
    font-size: 0.7rem;
    cursor: pointer;
}

/* ============================================
   تنسيقات الملفات والصور في الرسائل
   ============================================ */
.message-image {
    margin: 6px 0;
}

.message-image img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    display: block;
}

.message-image img:hover {
    transform: scale(1.02);
}

.message-caption {
    font-size: 0.85rem;
    margin-top: 6px;
    line-height: 1.3;
}

.message-file {
    background: #f1f5f9;
    padding: 10px 14px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
    max-width: 100%;
    flex-wrap: wrap;
}

.message-file i {
    font-size: 1.1rem;
    color: #2563eb;
    flex-shrink: 0;
}

.message-file a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.message-file a:hover {
    text-decoration: underline;
}

.file-size {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    flex-shrink: 0;
}

/* منطقة إدخال الرسالة */
.chat-input {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 12px 16px;
}

.reply-preview {
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 16px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.reply-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cancel-reply {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    margin-right: auto;
}

.chat-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input-row textarea {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 100px;
    min-height: 42px;
    background: white;
}

.chat-input-row textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.chat-input-row button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-input-row button:hover {
    background: #1d4ed8;
}

/* زر رفع الملفات */
.file-upload-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f0f2f5;
    color: #2563eb;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 1rem;
}

.file-upload-btn:hover {
    background: #e2e8f0;
    transform: scale(1.05);
}

.file-upload-btn:active {
    transform: scale(0.95);
}

/* ============================================
   تصميم الهاتف (شات مثل واتساب)
   ============================================ */
@media (max-width: 768px) {
    #page-chat {
        height: calc(100vh - 60px);
    }
    
    .chat-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        z-index: 100;
        transform: translateX(0);
        border-radius: 0;
    }
    
    .chat-sidebar.hidden {
        transform: translateX(-100%);
    }
    
    .chat-area {
        width: 100%;
    }
    
    .back-to-chats {
        display: flex;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .chat-input {
        padding: 10px 12px;
    }
}

/* ============================================
   تحسين القائمة الجانبية للهاتف
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: right 0.3s ease;
    }
    
    .sidebar.open {
        right: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 12px;
        right: 12px;
        z-index: 1001;
        background: #2563eb;
        color: white;
        border: none;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 1.2rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    
    .main-content {
        margin-right: 0;
        width: 100%;
    }
    
    .content-header {
        padding-right: 60px;
    }
}

/* ============================================
   تصميم بطاقات المواد - تصميم حديث
============================================ */
.subjects-modern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.8rem;
    margin-top: 1.5rem;
}

.subject-card {
    background: white;
    border-radius: 24px;
    padding: 1.8rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #f0f2f5;
    position: relative;
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.subject-card:hover::before {
    transform: scaleX(1);
}

.subject-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
    border-color: var(--primary);
}

.subject-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin-bottom: 1.2rem;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.subject-card:hover .subject-icon {
    transform: scale(1.15) rotate(10deg);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
}

.subject-card h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    transition: color 0.3s;
}

.subject-card:hover h4 {
    color: var(--primary);
}

.subject-card p {
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 1.2rem;
}

.subject-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

/* ============================================
   تحديثات الشات – تصميم عصري وفاخر
   ============================================ */

/* الحاوية الرئيسية */
#page-chat {
    background: linear-gradient(145deg, #f0f4fa 0%, #e9eef5 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-layout {
    display: flex;
    height: 100%;
    width: 100%;
    border-radius: 0;
    background: white;
    overflow: hidden;
}

/* منطقة المحادثة الرئيسية */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    overflow: hidden;
}

.chat-header {
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.back-to-chats {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    border: none;
    padding: 8px 16px;
    border-radius: 40px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.back-to-chats:hover {
    background: #e2e8f0;
    transform: translateX(-2px);
}

.back-to-chats i {
    font-size: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,0.2);
}

.user-status {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #10b981;
    margin-top: 2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 4px rgba(16,185,129,0.5);
}

.typing-text {
    font-size: 0.75rem;
    color: #64748b;
}

/* منطقة الرسائل */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

/* فقاعة الرسالة */
.message {
    max-width: 70%;
    position: relative;
    animation: fadeInUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

.message.sent {
    align-self: flex-end;
}

.message.sent > * {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border-radius: 22px 22px 6px 22px;
    padding: 10px 16px;
    box-shadow: 0 4px 12px rgba(37,99,235,0.2);
}

.message.received {
    align-self: flex-start;
}

.message.received > * {
    background: white;
    color: #1e293b;
    border-radius: 22px 22px 22px 6px;
    padding: 10px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
}

.deleted-text {
    color: #94a3b8;
    font-style: italic;
    font-size: 0.9rem;
}

.message-text {
    line-height: 1.5;
    word-wrap: break-word;
}

.message-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 0.7rem;
    opacity: 0.8;
}

.message-time {
    font-size: 0.7rem;
}

.read-status {
    font-size: 0.7rem;
}

.read-status.read {
    color: #34d399;
}

.reply-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 2px 4px;
}

.reply-btn:hover {
    opacity: 1;
}

.edited-mark {
    font-size: 0.65rem;
    opacity: 0.6;
    font-style: italic;
}

/* معاينة الرد */
.reply-to {
    background: rgba(0,0,0,0.05);
    padding: 6px 10px;
    border-radius: 12px;
    margin-bottom: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid #2563eb;
    padding-left: 8px;
}

.reply-to:hover {
    background: rgba(0,0,0,0.08);
}

.reply-name {
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.reply-preview {
    opacity: 0.7;
}

/* معاينة الرد أثناء الكتابة */
.chat-input .reply-preview {
    background: #f1f5f9;
    border-radius: 16px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: #334155;
}

.reply-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cancel-reply {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    margin-left: auto;
    font-size: 1rem;
    padding: 0;
    transition: color 0.2s;
}

.cancel-reply:hover {
    color: #ef4444;
}

/* ============================================
   الصور والملفات
   ============================================ */

.message-image {
    margin: 4px 0;
    cursor: pointer;
}

.message-image img {
    max-width: 100%;
    max-height: 260px;
    border-radius: 16px;
    transition: transform 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
}

.message-image img:hover {
    transform: scale(1.02);
}

.message-caption {
    font-size: 0.85rem;
    margin-top: 6px;
    line-height: 1.4;
}

.message-file {
    background: rgba(0,0,0,0.03);
    border-radius: 16px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
    max-width: 100%;
    flex-wrap: wrap;
    transition: background 0.2s;
    border: 1px solid rgba(0,0,0,0.05);
}

.message-file:hover {
    background: rgba(0,0,0,0.05);
}

.message-file i {
    font-size: 1.2rem;
    color: #2563eb;
    flex-shrink: 0;
}

.message-file a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    word-break: break-word;
    flex: 1;
    min-width: 0;
    transition: color 0.2s;
}

.message-file a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.file-size {
    font-size: 0.7rem;
    color: #64748b;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================
   منطقة إدخال الرسالة
   ============================================ */

.chat-input {
    background: white;
    border-top: 1px solid #f0f2f5;
    padding: 12px 24px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.02);
}

.chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input-row textarea {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 28px;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    background: #ffffff;
    transition: all 0.2s;
    color: #1e293b;
}

.chat-input-row textarea::placeholder {
    color: #94a3b8;
}

.chat-input-row textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.chat-input-row button,
.file-upload-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.chat-input-row button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
}

.chat-input-row button:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

.chat-input-row button:active {
    transform: scale(0.95);
}

.file-upload-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
}

.file-upload-btn:hover {
    background: #e2e8f0;
    transform: scale(1.05);
}

.file-upload-btn:active {
    transform: scale(0.95);
}

/* ============================================
   نافذة عرض الصور (Lightbox)
   ============================================ */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    cursor: not-allowed;
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255,255,255,0.2);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    transition: all 0.2s;
    z-index: 2001;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   تحسينات للشريط الجانبي
   ============================================ */

.chat-sidebar {
    width: 100%;
    max-width: 320px;
    background: white;
    border-left: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.chat-sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f2f5;
}

.chat-sidebar-header h3 {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.chat-search-box {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f2f5;
}

.chat-search-box input {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 0.9rem;
    width: 100%;
    transition: all 0.2s;
}

.chat-search-box input:focus {
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
    outline: none;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px;
}

/* عنصر المحادثة */
.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.chat-item:hover {
    background: #f8fafc;
}

.chat-item.active {
    background: #eef2ff;
    border-left: 3px solid #2563eb;
    padding-left: 10px;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,0.2);
}

.chat-preview {
    flex: 1;
    min-width: 0;
}

.chat-name {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
    gap: 8px;
}

.chat-name span:first-child {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

.chat-time {
    font-size: 0.7rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.chat-msg {
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    width: 12px;
    height: 12px;
    background: #2563eb;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(37,99,235,0.4);
}

/* ============================================
   تحسينات للهواتف
   ============================================ */

@media (max-width: 768px) {
    .chat-layout {
        position: relative;
    }

    .chat-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: none;
        width: 100%;
        z-index: 10;
        transform: translateX(0);
        transition: transform 0.3s ease;
    }

    .chat-sidebar.hidden {
        transform: translateX(-100%);
        pointer-events: none;
    }

    .chat-area {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .chat-area.hidden {
        display: none !important;
    }

    .message {
        max-width: 85%;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .back-to-chats {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .chat-messages {
        padding: 16px;
    }

    .chat-input {
        padding: 8px 16px;
    }

    .lightbox-close {
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
}

.subject-btn:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

/* تحسينات للشاشات الكبيرة */
@media (max-width: 1024px) {
    .subjects-modern-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.5rem;
    }
}

/* تحسينات للأجهزة اللوحية والهواتف */
@media (max-width: 768px) {
    .subjects-modern-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1.2rem;
    }

    .subject-card {
        padding: 1.2rem;
        border-radius: 16px;
    }

    .subject-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .subject-card h4 {
        font-size: 1rem;
    }

    .subject-card p {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .subject-btn {
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
    }
}

/* تحسينات للهواتف الصغيرة */
@media (max-width: 480px) {
    .subjects-modern-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .subject-card {
        padding: 1rem;
        border-radius: 14px;
    }

    .subject-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .subject-card h4 {
        font-size: 0.95rem;
    }

    .subject-card p {
        font-size: 0.8rem;
    }
}

/* ============================================
   إإعادة بناء القائمة الجانبية مع Bottom Nav
============================================ */

.sidebar {
    display: block !important;
    width: 280px;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 500;
    background: white;
    border-left: 1px solid var(--gray-200);
    transition: transform 0.3s ease;
}

.sidebar-overlay {
    display: none !important;
}

#mobile-menu-btn {
    display: none !important;
}

.main-content {
    margin-right: 280px;
    margin-left: 0;
    padding-bottom: 0;
}

/* ============================================
   تحسين القائمة السفلية على الهواتف
============================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 0.75rem 0.5rem;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 1000;
    transition: all 0.3s ease;
}

.bottom-nav.active {
    display: flex;
}

/* ============================================
   إخفاء القائمة الجانبية بالكامل
============================================ */
.sidebar,
.sidebar-overlay,
.sidebar-toggle,
#teacher-menu,
#admin-menu {
    display: none !important;
}

/* جعل المحتوى الرئيسي يأخذ كامل العرض */
.main-content {
    margin-right: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0 !important;
}

/* تعديل padding للصفحات لتناسب الشاشات */
.pages-container {
    padding: 1rem;
    margin-bottom: 70px; /* مساحة للقائمة السفلية */
    width: 100%;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--gray-500);
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
}

.bottom-nav-item i {
    font-size: 1.3rem;
    color: #2563eb !important;
}

.bottom-nav-item.active i {
    color: #1e40af !important;
}

.bottom-nav-item.active {
    color: var(--primary);
    background: rgba(37,99,235,0.1);
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

/* إخفاء العناصر الثانوية على الشاشات الكبيرة */
.secondary-nav-item {
    display: flex;
}

.bottom-nav-item.more-btn {
    color: var(--gray-600);
}

/* ============================================
   قائمة المزيد المنسدلة
============================================ */

.more-menu {
    position: fixed;
    bottom: 80px;
    left: 20px;
    right: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border-radius: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    min-width: 220px;
    max-width: 280px;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transform-origin: bottom left;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.more-menu.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.more-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: right;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.more-menu-item:last-child {
    border-bottom: none;
}

.more-menu-item i {
    font-size: 1.2rem;
    width: 28px;
    color: #2563eb;
    transition: transform 0.2s;
}

.more-menu-item:hover {
    background: rgba(37, 99, 235, 0.08);
    padding-right: 24px;
}

.more-menu-item:hover i {
    transform: translateX(-4px);
}

.more-menu-item:active {
    background: rgba(37, 99, 235, 0.15);
    transform: scale(0.98);
}

/* على الهواتف */
@media (max-width: 768px) {
    .more-menu {
        left: 16px;
        right: 16px;
        bottom: 80px;
        min-width: auto;
        max-width: none;
        border-radius: 24px;
    }
    
    .more-menu-item {
        padding: 16px 20px;
        font-size: 1rem;
    }
}

/* Profile Modal */
.profile-modal {
    position: fixed;
    bottom: 80px;
    left: 16px;
    right: 16px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    padding: 1rem;
    z-index: 10000;
    transform: translateY(30px);
    opacity: 0;
    pointer-events: none;
    display: block;
    transition: all 0.25s ease;
    max-height: 340px;
    overflow-y: auto;
}

.profile-modal.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.profile-modal.active {
    display: block !important;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.5rem;
}

.profile-info {
    flex: 1;
}

.profile-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.profile-info small {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.profile-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
}

.profile-actions button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-profile {
    background: rgba(37,99,235,0.1);
    color: var(--primary);
}

.btn-profile:active {
    background: rgba(37,99,235,0.2);
}

.btn-logout {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

.btn-logout:active {
    background: rgba(239,68,68,0.2);
}

/* ============================================
   تحسين الحجم على الهواتف
============================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
        margin-left: 0;
        padding-bottom: 0;
    }

    .pages-container {
        padding-bottom: 80px;
    }

    .chat-layout {
        height: calc(100vh - 140px);
    }

    .chat-messages {
        max-height: calc(100vh - 200px);
    }

    .bottom-nav.active {
        display: flex;
    }

    /* إخفاء العناصر الثانوية على الشاشات الصغيرة */
    .secondary-nav-item {
        display: none !important;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none !important;
    }

    .sidebar-overlay.active {
        display: block !important;
    }

    /* تعديل موضع قائمة المزيد على الهواتف */
    .more-menu {
        bottom: 80px;
        right: 5px;
        left: auto;
        max-width: 250px;
    }
}

/* ============================================
   التأكد من ظهور صفحة الشات بشكل صحيح
============================================ */

#page-chat {
    height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    overflow: hidden;
}

#page-chat.active {
    display: flex !important;
}

.chat-layout {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: white;
    border-radius: 0;
}

.chat-sidebar {
    width: 320px;
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    background: white;
    flex-shrink: 0;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    overflow: hidden;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chat-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

/* للشاشات الصغيرة */
@media (max-width: 768px) {
    .chat-sidebar {
        width: 240px;
    }
    
    #page-chat {
        height: calc(100vh - 80px);
    }
}

/* نقطة حمراء تشير إلى رسائل غير مقروءة */
.bottom-nav-item {
    position: relative;
}

.chat-unread-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.badge-notification {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* ============================================
تحسينات صفحة المحادثات للهواتف - Responsive Chat Design
============================================ */
@media (max-width: 768px) {
    #page-chat .chat-layout {
        display: flex;
        position: relative;
        overflow: hidden;
        height: 100%;
    }

    #page-chat .chat-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        z-index: 10;
        background: white;
        transform: translateX(0);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    #page-chat .chat-sidebar.hidden {
        transform: translateX(-100%);
        pointer-events: none;
    }

    #page-chat .chat-area {
        width: 100%;
        z-index: 5;
        transition: opacity 0.2s;
        display: flex;
        flex-direction: column;
    }

    #page-chat .chat-area.hidden {
        display: none !important;
    }

    .back-to-chats {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: none;
        border: none;
        color: var(--primary);
        font-size: 0.95rem;
        font-weight: 600;
        cursor: pointer;
        padding: 8px;
        margin-left: 8px;
        transition: opacity 0.2s;
    }

    .back-to-chats:hover {
        opacity: 0.7;
    }

    .back-to-chats i {
        font-size: 1.1rem;
    }

    .chat-header {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .user-info {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .user-info > div:last-child {
        flex: 1;
        min-width: 0;
    }

    .chat-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ============================================
   زر التمرير للأسفل - Scroll to Bottom Button
============================================ */
.scroll-to-bottom {
    position: absolute;
    bottom: 90px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 10;
}

.scroll-to-bottom:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
    transform: scale(1.1);
}

.scroll-to-bottom:active {
    transform: scale(0.95);
}

/* للشاشات الصغيرة */
@media (max-width: 768px) {
    .scroll-to-bottom {
        bottom: 110px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ============================================
   إصلاح ظهور مربعات المميزات على جميع الأجهزة
   ============================================ */

/* التأكد من أن قسم المميزات يظهر دائماً */
.features-section {
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
}

/* الشبكة (grid) الخاصة بالمميزات */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    padding: 0 1rem;
}

/* لكل جهاز، نضمن أن المربعات تظهر بشكل صحيح */
@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
        padding: 0 0.5rem;
    }
    
    /* التأكد من أن كل مربع ليس به أي إخفاء */
    .feature-box {
        display: block !important;
        width: 100%;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .features-grid {
        grid-template-columns: 1fr; /* صف واحد على الهواتف الصغيرة */
        gap: 1rem;
    }
    
    .feature-box {
        margin-bottom: 0.5rem;
    }
}

/* إزالة أي إخفاء محتمل عبر overflow أو display */
.feature-box {
    overflow: visible !important;
    transform: none !important;
    opacity: 1 !important;
}

/* التأكد من ظهور جميع العناصر الأساسية */
.hero, .features-section, .about-section, .contact-section, .cta-section {
    display: block !important;
    overflow: visible !important;
}

/* ============================================
   إظهار البطاقات العائمة على جميع الشاشات
   ============================================ */

/* منع إخفاء الحاويات الأب للبطاقات */
.hero-visual,
.hero-image-container {
    overflow: visible !important;
}

/* ضمان ظهور البطاقات على جميع الأجهزة مع تخطيط أفقي */
.float-card,
.floating-elements {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.float-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.75rem !important;
}

/* على التابلت - تصغير الحجم */
@media (max-width: 992px) {
    .float-card {
        padding: 0.75rem 1.25rem !important;
        font-size: 0.95rem !important;
    }
    
    .float-card i {
        width: 35px !important;
        height: 35px !important;
        font-size: 1.1rem !important;
    }
    
    .floating-elements {
        display: block !important;
        visibility: visible !important;
    }
}

/* على الموبايل - تصغير أكثر */
@media (max-width: 768px) {
    .float-card {
        padding: 0.65rem 1rem !important;
        font-size: 0.9rem !important;
        max-width: 90vw !important;
    }
    
    .float-card i {
        width: 30px !important;
        height: 30px !important;
        font-size: 1rem !important;
    }
    
    .floating-elements {
        display: block !important;
        visibility: visible !important;
        overflow: visible !important;
    }
}

/* على الهواتف الصغيرة جداً */
@media (max-width: 480px) {
    .float-card {
        padding: 0.6rem 0.9rem !important;
        font-size: 0.85rem !important;
        max-width: 85vw !important;
    }
    
    .float-card i {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.95rem !important;
    }
}

/* ============================================
   نافذة الإشعارات
============================================ */
.notifications-modal {
    position: fixed;
    top: 60px;
    right: 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    width: 90%;
    max-width: 450px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

.notifications-modal.hidden {
    display: none !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notifications-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.notifications-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: var(--gray-50);
}

.notification-item.unread {
    background-color: #f0f7ff;
}

.notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.notification-icon.type-success {
    background-color: #d4edda;
    color: #155724;
}

.notification-icon.type-error {
    background-color: #f8d7da;
    color: #721c24;
}

.notification-icon.type-warning {
    background-color: #fff3cd;
    color: #856404;
}

.notification-icon.type-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.notification-message {
    color: var(--gray-600);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    line-height: 1.4;
    word-break: break-word;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.unread-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    background-color: var(--primary);
    border-radius: 50%;
    margin-top: 0.5rem;
}

.notifications-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.9rem;
}

.loading-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--gray-600);
}

.loading-state i {
    margin-right: 0.5rem;
}

/* شارة الإشعارات على أيقونة الجرس */
.notification-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

/* على الموبايل */
@media (max-width: 768px) {
    .notifications-modal {
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
        width: auto;
    }
    
    .notification-item {
        padding: 0.75rem;
    }
}