﻿/* =========================
   ROOT VARIABLES
========================= */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    
    --gradient-main: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f87171);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --surface: #ffffff;
    --surface-soft: #f1f5f9;
    --border: #e2e8f0;
}

body[data-theme="dark"] {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --primary-light: #a78bfa;
    --secondary: #06b6d4;
    --dark: #f8fafc;
    --light: #0f172a;
    --gray: #cbd5e1;
    --gray-light: #334155;
    --surface: #111827;
    --surface-soft: #1f2937;
    --border: #334155;
    --gradient-main: linear-gradient(135deg, #7c3aed, #0891b2);
}

/* =========================
   GLOBAL STYLES
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--light);
    color: var(--dark);
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}

/* Links */
a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary);
}
/* =========================
   NAVBAR STYLES - FIXED
========================= */

/* تأكيد أن الـ navbar له خلفية ملونة */
.bg-gradient {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
}

/* تأكيد أن لون النص في الـ navbar أبيض */
.navbar {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
}

.navbar .navbar-brand,
.navbar .nav-link {
    color: white !important;
}

.navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white !important;
}

.navbar .nav-link.active {
    background: rgba(255, 255, 255, 0.3);
    color: white !important;
}

/* زر dropdown */
.navbar .btn-light {
    background: white !important;
    color: #6366f1 !important;
    border: none !important;
}

.navbar .btn-light:hover {
    background: #f1f5f9 !important;
    color: #6366f1 !important;
}

.navbar .btn-outline-light {
    color: white !important;
    border-color: white !important;
}

.navbar .btn-outline-light:hover {
    background: white !important;
    color: #6366f1 !important;
}

/* قائمة dropdown */
.dropdown-menu {
    background: white !important;
    border: none !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.dropdown-item {
    color: #1e293b !important;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: white !important;
}

.dropdown-item.text-danger {
    color: #ef4444 !important;
}

.dropdown-item.text-danger:hover {
    background: #ef4444 !important;
    color: white !important;
}
/* =========================
   NAVBAR
========================= */
.custom-navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--gray-light);
}

.custom-navbar .navbar-brand {
    font-size: 1.5rem;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
}

.custom-navbar .nav-link {
    color: var(--dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: all 0.3s;
}

.custom-navbar .nav-link:hover,
.custom-navbar .nav-link.active {
    background: var(--gradient-main);
    color: white !important;
}

/* =========================
   BUTTONS
========================= */
.btn-main {
    background: var(--gradient-main);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-main:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-outline-main {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-outline-main:hover {
    background: var(--gradient-main);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
}

.btn-soft {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 8px 20px;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-soft:hover {
    background: var(--primary);
    color: white;
}

.btn-danger-soft {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    padding: 8px 20px;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-danger-soft:hover {
    background: var(--danger);
    color: white;
}

/* =========================
   LIVE FILTERS
========================= */
.live-filter-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.live-filter-search {
    position: relative;
    flex: 1 1 260px;
}

.live-filter-search i {
    position: absolute;
    inset-inline-start: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    pointer-events: none;
}

.live-filter-search .form-control {
    padding-inline-start: 2.35rem;
}

.live-filter-toolbar .form-select {
    width: auto;
    min-width: 160px;
}

.live-filter-count {
    min-width: max-content;
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.88rem;
}

body[data-theme="dark"] .live-filter-toolbar {
    background: var(--surface);
    border-color: var(--border);
}

body[data-theme="dark"] .live-filter-count {
    background: rgba(139, 92, 246, 0.16);
    color: #ddd6fe;
}

@media (max-width: 768px) {
    .live-filter-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .live-filter-search,
    .live-filter-toolbar .form-select,
    .live-filter-count {
        width: 100%;
        min-width: 0;
    }
}


/* =========================
   NAVBAR ADDITIONAL STYLES
========================= */
.navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0.8rem 0;
}

.navbar .nav-link {
    color: rgba(255,255,255,0.95) !important;
    transition: all 0.3s;
    border-radius: 8px;
    padding: 8px 16px;
}

.navbar .nav-link:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.navbar .nav-link.active {
    background: rgba(255,255,255,0.3);
}

.dropdown-item i {
    width: 24px;
    margin-left: 8px;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.btn-outline-light:hover {
    background: white;
    color: #6366f1;
}

@media (max-width: 768px) {
    .navbar .nav-link {
        text-align: center;
    }
    .d-flex.gap-2 {
        justify-content: center;
        margin-top: 0.5rem;
    }
}

/* =========================
   CARDS
========================= */
.card {
    background: white;
    border: none;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.course-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.course-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.5s;
}

.course-card:hover img {
    transform: scale(1.05);
}

.course-card .course-info {
    padding: 1.25rem;
}

.course-card .course-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.course-card .course-teacher {
    font-size: 0.875rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.course-card .course-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Book Cards */
.book-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: var(--shadow);
    height: 100%;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.book-cover {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    min-height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.book-cover-img {
    width: 100%;
    height: 210px;
    object-fit: cover;
    display: block;
}

.book-cover-placeholder {
    width: 100%;
    min-height: 210px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    color: #dc3545;
}

.book-cover-placeholder i {
    font-size: 4rem;
}

.book-cover-placeholder span {
    font-size: 1.1rem;
    font-weight: 800;
}

.book-type-badge {
    position: absolute;
    top: 0.75rem;
    inset-inline-start: 0.75rem;
    z-index: 2;
}

.dashboard-book-thumb {
    width: 100%;
    max-width: 220px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.dashboard-book-thumb-placeholder {
    margin-inline: auto;
    background: linear-gradient(135deg, #fff7ed, #fee2e2);
    color: #dc3545;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.dashboard-book-thumb-placeholder i {
    font-size: 3.25rem;
}

.dashboard-book-thumb-placeholder span {
    font-weight: 800;
}

.book-cover-preview {
    width: 180px;
    height: 130px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.teacher-banner-preview {
    width: 100%;
    max-width: 420px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.teacher-branded-hero {
    --teacher-primary: #6c5ce7;
    --teacher-secondary: #8b5cf6;
    background: var(--teacher-banner, linear-gradient(135deg, color-mix(in srgb, var(--teacher-primary) 88%, #111827), color-mix(in srgb, var(--teacher-secondary) 88%, #ffffff)));
    background-size: cover;
    background-position: center;
}

.teacher-profile-course-group {
    border: 1px solid rgba(108, 92, 231, 0.16);
    border-radius: 16px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.teacher-profile-course-card {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    background: #fff;
    height: 100%;
}

.teacher-profile-course-card img {
    width: 150px;
    height: 92px;
    object-fit: cover;
    border-radius: 12px;
}

.student-player-tools .player-tool-btn,
.student-player-tools .player-tool-select {
    border-color: color-mix(in srgb, var(--teacher-primary, #6c5ce7) 32%, #ffffff);
    color: var(--teacher-primary, #6c5ce7);
}

.accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, var(--teacher-primary, #6c5ce7), var(--teacher-secondary, #8b5cf6));
    color: #fff;
}

@media (max-width: 576px) {
    .teacher-profile-course-card {
        grid-template-columns: 1fr;
    }

    .teacher-profile-course-card img {
        width: 100%;
        height: 160px;
    }
}

.book-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-price {
    font-weight: 700;
    color: var(--primary);
}

/* Step Circle */
.step-circle {
    width: 60px;
    height: 60px;
    background: var(--gradient-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

/* Page Hero */
.page-hero {
    background: var(--gradient-main);
    border-radius: 0 0 40px 40px;
    margin-bottom: -2rem;
    padding: 60px 0;
    color: white;
}

/* =========================
   GRADE CARDS
========================= */
.grade-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.grade-card:hover {
    background: var(--gradient-main);
    color: white;
    transform: translateY(-5px);
}

.grade-card i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.grade-card h5 {
    margin: 0;
    font-weight: 600;
}

/* Stage Card */
.stage-card {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    height: 100%;
}

.stage-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stage-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary);
}

.grade-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.grade-link {
    padding: 0.5rem;
    border-radius: 10px;
    transition: all 0.3s;
    display: block;
    color: var(--gray);
}

.grade-link:hover {
    background: var(--gradient-main);
    color: white;
    transform: translateX(-5px);
}

/* Feature Card */
.feature-card {
    background: white;
    border-radius: 20px;
    transition: all 0.3s;
    height: 100%;
    box-shadow: var(--shadow);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: var(--gradient-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.feature-icon i {
    font-size: 2rem;
    color: white;
}

/* Testimonial Card */
.testimonial-card {
    background: white;
    border-radius: 20px;
    transition: all 0.3s;
    height: 100%;
    box-shadow: var(--shadow);
}

.testimonial-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* =========================
   VIDEO PLAYER
========================= */
.video-container {
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.video-container video {
    width: 100%;
    height: auto;
    display: block;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.video-container:hover .video-controls {
    opacity: 1;
}

/* =========================
   PROGRESS BAR
========================= */
.progress-bar-custom {
    height: 8px;
    background: var(--gray-light);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-custom .progress {
    height: 100%;
    background: var(--gradient-main);
    border-radius: 10px;
    transition: width 0.3s;
}

/* =========================
   HERO SECTION
========================= */
.hero {
    background: var(--gradient-main);
    padding: 80px 0;
    border-radius: 0 0 40px 40px;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,154.7C960,171,1056,181,1152,165.3C1248,149,1344,107,1392,85.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    opacity: 0.3;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.125rem;
    opacity: 0.95;
    margin-bottom: 2rem;
}

/* =========================
   FORMS
========================= */
.form-control,
.form-select {
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* =========================
   TOAST NOTIFICATIONS
========================= */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    color: var(--dark);
    padding: 12px 20px;
    border-radius: 12px;
    margin-top: 10px;
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    transition: transform 0.3s;
    font-weight: 500;
    border-right: 4px solid var(--primary);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-right-color: var(--success);
}

.toast.error {
    border-right-color: var(--danger);
}

/* =========================
   LOADER
========================= */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero {
        padding: 50px 0;
    }
    
    .course-card img {
        height: 150px;
    }
    
    .page-hero {
        padding: 40px 0;
    }
    
    .book-card {
        margin-bottom: 1rem;
    }
    
    .feature-card, .stage-card, .testimonial-card {
        margin-bottom: 1rem;
    }
}

/* =========================
   UTILITIES
========================= */
.bg-gradient {
    background: var(--gradient-main);
}

.text-gradient {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Stat Box */
.stat-box {
    text-align: center;
}

.stat-box h3 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
}

.stat-box p {
    margin: 0;
    font-size: 0.875rem;
}

/* Stats Cards */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    height: 100%;
}

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

.stat-card i {
    font-size: 2rem;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.stat-card p {
    color: var(--gray);
    margin: 0;
    font-size: 0.875rem;
}

/* Stat Card Mini */
.stat-card-mini {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

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

.stat-card-mini i {
    font-size: 2rem;
}

/* Footer */
.footer {
    background: #0f172a;
    color: #94a3b8;
    margin-top: auto;
}

.footer h5, .footer h6 {
    color: white;
    margin-bottom: 1.25rem;
}

.footer a {
    color: #94a3b8;
    transition: color 0.3s;
}

.footer a:hover {
    color: var(--primary);
}

.footer .social-links a {
    display: inline-block;
    width: 35px;
    height: 35px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    text-align: center;
    line-height: 35px;
    margin-left: 8px;
    transition: all 0.3s;
}

.footer .social-links a:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

/* Dashboard Sidebar */
.sidebar,
.dashboard-sidebar {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    min-height: calc(100vh - 200px);
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .dropdown-menu,
body[data-theme="dark"] .modal-content,
body[data-theme="dark"] .stat-card,
body[data-theme="dark"] .stat-card-mini,
body[data-theme="dark"] .course-card,
body[data-theme="dark"] .feature-card,
body[data-theme="dark"] .stage-card,
body[data-theme="dark"] .quick-action-card,
body[data-theme="dark"] .dashboard-sidebar,
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .course-card-price {
    background: var(--surface) !important;
    color: var(--dark);
    border-color: var(--border) !important;
}

body[data-theme="dark"] .bg-light {
    background: var(--surface-soft) !important;
}

body[data-theme="dark"] .text-muted,
body[data-theme="dark"] .dropdown-item,
body[data-theme="dark"] .form-label {
    color: var(--gray) !important;
}

body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-select,
body[data-theme="dark"] textarea {
    background: #0b1220;
    color: var(--dark);
    border-color: var(--border);
}

body[data-theme="dark"] .form-control::placeholder {
    color: #94a3b8;
}

body[data-theme="dark"] .table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--dark);
    --bs-table-border-color: var(--border);
}

.theme-toggle-btn {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.dashboard-sidebar-wrap {
    padding-top: 1rem;
}

.dashboard-sidebar {
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.45) transparent;
}

.dashboard-sidebar::-webkit-scrollbar {
    width: 6px;
}

.dashboard-sidebar::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.45);
    border-radius: 999px;
}

.dashboard-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-nav {
    padding-bottom: 0.5rem;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--gray-light);
}

.sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: var(--gradient-main);
    flex: 0 0 44px;
    overflow: hidden;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0;
    background: linear-gradient(135deg, #6366f1, #14b8a6);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-teacher {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
}

.avatar-student {
    background: linear-gradient(135deg, #7c3aed, #f97316);
}

.avatar-admin {
    background: linear-gradient(135deg, #0f172a, #64748b);
}

.avatar-assistant {
    background: linear-gradient(135deg, #14b8a6, #6366f1);
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-profile strong,
.sidebar-profile span {
    display: block;
}

.sidebar-profile strong {
    color: var(--dark);
    line-height: 1.3;
}

.sidebar-profile span {
    color: var(--gray);
    font-size: 0.8rem;
    text-transform: capitalize;
}

.sidebar .nav-link,
.dashboard-nav .nav-link {
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--gray);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active,
.dashboard-nav .nav-link:hover,
.dashboard-nav .nav-link.active {
    background: var(--gradient-main);
    color: white;
}

.sidebar .nav-link i,
.dashboard-nav .nav-link i {
    width: 24px;
    margin-left: 0;
    text-align: center;
}

.text-primary,
.stat-card-mini .text-primary,
.quick-action-card i,
.page-header i,
.card-header i:not(.text-danger):not(.text-warning):not(.text-success),
.teacher-action i {
    color: var(--primary) !important;
}

.dashboard-nav .nav-link.active i,
.dashboard-nav .nav-link:hover i,
.btn-main i,
.bg-gradient i {
    color: inherit !important;
}

@media (max-width: 767.98px) {
    .dashboard-sidebar {
        position: static;
        min-height: auto;
        max-height: none;
        overflow: visible;
        margin-bottom: 1rem;
    }

    .dashboard-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .dashboard-nav .nav-link {
        margin-bottom: 0;
        min-height: 48px;
    }
}

/* Certificate Card */
.certificate-card {
    transition: all 0.3s;
}

.certificate-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.brand-logo-link {
    min-width: 48px;
    display: inline-flex;
    align-items: center;
}

.brand-logo-img {
    max-height: 44px;
    max-width: 150px;
    object-fit: contain;
}

.footer-logo img {
    max-height: 64px;
    max-width: 180px;
    object-fit: contain;
}

.profile-photo-control {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.profile-photo-preview,
.chat-avatar {
    width: 84px;
    height: 84px;
    border-radius: 18px;
    background: var(--gradient-main);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 auto;
}

.profile-photo-preview {
    font-size: 2rem;
}

.profile-photo-preview img,
.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 1rem;
}

.chat-panel {
    min-height: 620px;
}

.chat-thread {
    min-height: 440px;
    max-height: 560px;
    overflow-y: auto;
    background: var(--surface-soft);
}

.chat-bubble {
    display: flex;
    margin-bottom: 0.85rem;
}

.chat-bubble.mine {
    justify-content: flex-end;
}

.chat-bubble-body {
    max-width: min(76%, 560px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-sm);
}

.chat-bubble.mine .chat-bubble-body {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

.chat-bubble-body p {
    margin: 0 0 0.35rem;
}

.chat-bubble-body small {
    opacity: 0.75;
}

.dashboard-tutorial-modal .modal-content {
    border: 0;
    border-radius: 18px;
    overflow: hidden;
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .stat-card,
body[data-theme="dark"] .quick-action-card,
body[data-theme="dark"] .course-card,
body[data-theme="dark"] .list-group-item,
body[data-theme="dark"] .modal-content,
body[data-theme="dark"] .dropdown-menu {
    background: var(--surface) !important;
    color: var(--dark) !important;
    border-color: var(--border) !important;
}

body[data-theme="dark"] .text-muted,
body[data-theme="dark"] small,
body[data-theme="dark"] .list-group-item small {
    color: #cbd5e1 !important;
}

/* Table Styles */
.table-custom {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* Dashboard polish */
.container-fluid > .row > main,
.container-fluid > .row > .col-md-9,
.container-fluid > .row > .col-lg-10 {
    min-width: 0;
}

.card {
    border: 1px solid var(--border);
    border-radius: 12px;
}

.card-header {
    border-bottom: 1px solid rgba(255,255,255,0.16);
    padding: 1rem 1.25rem;
}

.card-header h5,
.card-header h6 {
    line-height: 1.4;
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    min-height: 145px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card h3 {
    word-break: break-word;
}

.quick-action-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    min-height: 92px;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99,102,241,0.45);
    box-shadow: var(--shadow-md);
}

.quick-action-card i {
    flex: 0 0 2.25rem;
    text-align: center;
}

.quick-action-card h6,
.quick-action-card small {
    display: block;
}

.list-group-item,
.table {
    color: var(--dark);
}

.list-group-item {
    background: var(--surface);
    border-color: var(--border);
}

.border.rounded {
    border-color: var(--border) !important;
}

body[data-theme="dark"] .list-group-item,
body[data-theme="dark"] .border.rounded {
    background: var(--surface);
    color: var(--dark);
    border-color: var(--border) !important;
}

body[data-theme="dark"] .card-header.bg-gradient,
body[data-theme="dark"] .bg-gradient {
    background: var(--gradient-main) !important;
}

@media (max-width: 767.98px) {
    .card-header.d-flex {
        gap: 0.75rem;
        align-items: flex-start !important;
        flex-direction: column;
    }

    .stat-card {
        min-height: 125px;
    }

    .quick-action-card {
        min-height: 82px;
    }
}

.table-custom thead th {
    background: var(--gradient-main);
    color: white;
    border: none;
    padding: 1rem;
}

.table-custom tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* Progress */
.progress {
    height: 8px;
    border-radius: 10px;
}

.progress-bar {
    background: var(--gradient-main);
}

/* Protected content viewers */
.protected-content,
.secure-viewer {
    -webkit-user-select: none;
    user-select: none;
}

.secure-viewer {
    position: relative;
    min-height: 78vh;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-soft);
    box-shadow: var(--shadow);
}

.secure-viewer iframe {
    width: 100%;
    height: 78vh;
    border: 0;
    display: block;
    background: #fff;
}

.secure-viewer-watermark {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: rgba(15, 23, 42, 0.12);
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    font-weight: 800;
    text-align: center;
    transform: rotate(-24deg);
    pointer-events: none;
    user-select: none;
}

body[data-theme="dark"] .secure-viewer-watermark {
    color: rgba(255,255,255,0.14);
}

/* Course community */
.course-chat-thread {
    max-height: 640px;
    overflow-y: auto;
    background: var(--surface-soft);
}

.course-message {
    display: flex;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.course-message.mine {
    flex-direction: row-reverse;
}

.course-message-body {
    width: min(760px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.course-message.mine .course-message-body {
    border-color: rgba(99,102,241,0.35);
}

.course-message-text {
    line-height: 1.8;
    word-break: break-word;
}

.course-attachment img {
    max-width: min(100%, 420px);
    max-height: 320px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.rich-toolbar button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--dark);
    border-radius: 10px;
}

.poll-box {
    display: grid;
    gap: 0.6rem;
}

.poll-option {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--dark);
    text-align: start;
}

.poll-option em {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    background: rgba(99,102,241,0.14);
    z-index: 0;
}

.poll-option span,
.poll-option strong {
    position: relative;
    z-index: 1;
}

.poll-option.selected {
    border-color: var(--primary);
}

.profile-public-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: clamp(1.25rem, 3vw, 2rem);
    box-shadow: var(--shadow);
}

.profile-public-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.profile-public-avatar {
    width: 110px;
    height: 110px;
    border-radius: 24px;
    background: var(--gradient-main);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 2.4rem;
    overflow: hidden;
    flex: 0 0 auto;
}

.profile-public-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-public-header h1 {
    margin: 0 0 0.35rem;
}

.profile-public-header p,
.profile-public-bio {
    color: var(--gray);
    margin: 0;
}

.profile-public-bio {
    margin-top: 1rem;
    line-height: 1.8;
}

/* =========================
   DARK MODE FINAL OVERRIDES
   Keep this block at the end so it wins older page-level styles.
========================= */
body[data-theme="dark"] {
    background: var(--light) !important;
    color: var(--dark) !important;
}

html:has(body[data-theme="dark"]) {
    background: var(--light) !important;
}

body[data-theme="dark"] main,
body[data-theme="dark"] section,
body[data-theme="dark"] .container,
body[data-theme="dark"] .container-fluid {
    color: var(--dark);
}

body[data-theme="dark"] .navbar,
body[data-theme="dark"] .navbar.bg-gradient {
    background: linear-gradient(135deg, #111827, #312e81) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.24);
}

body[data-theme="dark"] .navbar .navbar-brand,
body[data-theme="dark"] .navbar .nav-link,
body[data-theme="dark"] .navbar .navbar-toggler {
    color: #f8fafc !important;
}

body[data-theme="dark"] .navbar .nav-link:hover,
body[data-theme="dark"] .navbar .nav-link.active {
    background: rgba(255,255,255,0.14) !important;
    color: #ffffff !important;
}

body[data-theme="dark"] .navbar .btn-light,
body[data-theme="dark"] .navbar .btn-outline-light:hover {
    background: #f8fafc !important;
    color: #111827 !important;
}

body[data-theme="dark"] .navbar .btn-outline-light {
    background: transparent !important;
    color: #f8fafc !important;
    border-color: rgba(248,250,252,0.72) !important;
}

body[data-theme="dark"] .dropdown-menu {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 18px 45px rgba(0,0,0,0.35);
}

body[data-theme="dark"] .dropdown-item {
    color: var(--dark) !important;
}

body[data-theme="dark"] .dropdown-item:hover,
body[data-theme="dark"] .dropdown-item:focus {
    background: var(--gradient-main) !important;
    color: #fff !important;
}

body[data-theme="dark"] .dropdown-divider {
    border-color: var(--border);
}

body[data-theme="dark"] .bg-white,
body[data-theme="dark"] .bg-light,
body[data-theme="dark"] .page-hero + section,
body[data-theme="dark"] .table-custom,
body[data-theme="dark"] .book-card,
body[data-theme="dark"] .course-card,
body[data-theme="dark"] .certificate-template,
body[data-theme="dark"] .certificate-preview,
body[data-theme="dark"] .profile-public-card,
body[data-theme="dark"] .chat-panel,
body[data-theme="dark"] .course-compose,
body[data-theme="dark"] .course-message-body,
body[data-theme="dark"] .poll-option,
body[data-theme="dark"] .rich-toolbar button,
body[data-theme="dark"] .verification-card {
    background: var(--surface) !important;
    color: var(--dark) !important;
    border-color: var(--border) !important;
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .stat-card,
body[data-theme="dark"] .quick-action-card,
body[data-theme="dark"] .list-group-item,
body[data-theme="dark"] .accordion-item,
body[data-theme="dark"] .accordion-button,
body[data-theme="dark"] .modal-content,
body[data-theme="dark"] .border,
body[data-theme="dark"] .border-bottom,
body[data-theme="dark"] .border-top,
body[data-theme="dark"] .border.rounded {
    background-color: var(--surface) !important;
    color: var(--dark) !important;
    border-color: var(--border) !important;
}

body[data-theme="dark"] .accordion-button:not(.collapsed),
body[data-theme="dark"] .card-header.bg-gradient,
body[data-theme="dark"] .bg-gradient {
    background: var(--gradient-main) !important;
    color: #fff !important;
}

body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .input-group-text {
    background-color: #0b1220 !important;
    color: var(--dark) !important;
    border-color: var(--border) !important;
}

body[data-theme="dark"] .form-control:focus,
body[data-theme="dark"] .form-select:focus {
    background-color: #0f172a !important;
    color: var(--dark) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(139,92,246,0.22) !important;
}

body[data-theme="dark"] .form-control::placeholder {
    color: #94a3b8 !important;
}

body[data-theme="dark"] .text-dark,
body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] h4,
body[data-theme="dark"] h5,
body[data-theme="dark"] h6,
body[data-theme="dark"] .card-title,
body[data-theme="dark"] .book-title,
body[data-theme="dark"] .course-title,
body[data-theme="dark"] strong {
    color: var(--dark) !important;
}

body[data-theme="dark"] .text-muted,
body[data-theme="dark"] small,
body[data-theme="dark"] .card-text,
body[data-theme="dark"] .book-description,
body[data-theme="dark"] .course-teacher,
body[data-theme="dark"] .profile-public-bio {
    color: var(--gray) !important;
}

body[data-theme="dark"] .table,
body[data-theme="dark"] .table > :not(caption) > * > * {
    --bs-table-bg: var(--surface) !important;
    --bs-table-color: var(--dark) !important;
    --bs-table-border-color: var(--border) !important;
    --bs-table-striped-bg: #0f172a !important;
    --bs-table-hover-bg: #1f2937 !important;
    color: var(--dark) !important;
    border-color: var(--border) !important;
}

body[data-theme="dark"] .alert-info {
    background: rgba(59,130,246,0.14) !important;
    color: #bfdbfe !important;
    border-color: rgba(59,130,246,0.35) !important;
}

body[data-theme="dark"] .alert-success {
    background: rgba(16,185,129,0.14) !important;
    color: #bbf7d0 !important;
    border-color: rgba(16,185,129,0.35) !important;
}

body[data-theme="dark"] .alert-warning {
    background: rgba(245,158,11,0.14) !important;
    color: #fde68a !important;
    border-color: rgba(245,158,11,0.35) !important;
}

body[data-theme="dark"] .alert-danger {
    background: rgba(239,68,68,0.14) !important;
    color: #fecaca !important;
    border-color: rgba(239,68,68,0.35) !important;
}

body[data-theme="dark"] .book-cover,
body[data-theme="dark"] .certificate-preview,
body[data-theme="dark"] .chat-thread,
body[data-theme="dark"] .course-chat-thread,
body[data-theme="dark"] .secure-viewer {
    background: var(--surface-soft) !important;
}

body[data-theme="dark"] .progress,
body[data-theme="dark"] .progress-bar-custom {
    background: #334155 !important;
}

body[data-theme="dark"] .btn-soft {
    background: rgba(139,92,246,0.18) !important;
    color: #ddd6fe !important;
}

body[data-theme="dark"] .btn-soft:hover {
    background: var(--primary) !important;
    color: #fff !important;
}

body[data-theme="dark"] .btn-outline-main {
    color: var(--primary-light) !important;
    border-color: var(--primary-light) !important;
}

body[data-theme="dark"] .btn-outline-main:hover {
    color: #fff !important;
}

/* Floating Messenger-style chat */
.floating-chat {
    position: fixed;
    left: 22px;
    bottom: 22px;
    z-index: 9997;
    direction: rtl;
}
.floating-chat-toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 18px 45px rgba(37, 99, 235, 0.34);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    position: relative;
}
.floating-chat.minimized .floating-chat-toggle { display: inline-flex; }
.floating-chat-badge,
.floating-chat-count {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.floating-chat-badge { position: absolute; top: -3px; right: -3px; }
.floating-chat-window {
    width: min(380px, calc(100vw - 28px));
    height: min(560px, calc(100vh - 110px));
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.floating-chat.minimized .floating-chat-window { display: none; }
.floating-chat-header {
    padding: 0.95rem 1rem;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.floating-chat-header strong,
.floating-chat-header small { display: block; }
.floating-chat-header small { opacity: 0.82; font-size: 0.78rem; }
.floating-chat-actions { display: flex; align-items: center; gap: 0.35rem; }
.floating-chat-actions button,
.floating-chat-compose button {
    border: 0;
    color: inherit;
    background: rgba(255,255,255,0.18);
    border-radius: 10px;
    width: 34px;
    height: 34px;
}
.floating-chat-body { flex: 1; min-height: 0; background: #f8fafc; }
.floating-chat-contacts,
.floating-chat-thread { height: 100%; overflow-y: auto; padding: 0.75rem; }
.floating-chat-contact {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0.75rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: right;
    color: #0f172a;
}
.floating-chat-contact:hover { background: #fff; }
.floating-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
}
.floating-chat-contact-body { min-width: 0; flex: 1; }
.floating-chat-contact-body strong,
.floating-chat-contact-body small { display: block; }
.floating-chat-contact-body small {
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.floating-chat-message {
    max-width: 82%;
    width: fit-content;
    margin-bottom: 0.65rem;
    padding: 0.65rem 0.8rem;
    border-radius: 16px 16px 16px 4px;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    overflow-wrap: anywhere;
}
.floating-chat-message.mine {
    margin-right: auto;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 16px 16px 4px 16px;
}
.floating-chat-message small { display: block; margin-top: 0.25rem; font-size: 0.68rem; opacity: 0.72; }

.smart-tips-card {
    border: 1px solid rgba(99, 102, 241, 0.14);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(16, 185, 129, 0.07));
}

.tip-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #10b981);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.22);
}

.tip-pill {
    height: 100%;
    padding: 0.85rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #334155;
    font-size: 0.9rem;
    line-height: 1.7;
}

[data-theme="dark"] .smart-tips-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(16, 185, 129, 0.12));
    border-color: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .tip-pill {
    background: rgba(15, 23, 42, 0.78);
    color: #e5e7eb;
    border-color: rgba(148, 163, 184, 0.18);
}

.site-footer {
    background: #0f172a;
    color: #e5e7eb;
    padding: 3rem 0 1.25rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.site-footer .footer-brand img {
    max-height: 58px;
    max-width: 180px;
    object-fit: contain;
}

.site-footer a {
    color: #cbd5e1;
    text-decoration: none;
}

.site-footer a:hover {
    color: #fff;
}

.footer-link-list li,
.footer-contact-list li {
    margin-bottom: 0.65rem;
}

.footer-social a {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    margin-inline-start: 0.35rem;
}

.locked-document-box {
    padding: 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.08);
    color: #334155;
    display: grid;
    gap: 0.35rem;
}

.locked-document-box i {
    color: #059669;
}

[data-theme="dark"] .locked-document-box {
    background: rgba(16, 185, 129, 0.12);
    color: #e5e7eb;
}
.floating-chat-empty {
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748b;
    padding: 1rem;
}
.floating-chat-compose {
    padding: 0.75rem;
    display: flex;
    gap: 0.5rem;
    background: #fff;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
}
.floating-chat-compose input {
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #f8fafc;
    border-radius: 999px;
    padding: 0.65rem 0.9rem;
}
.floating-chat-compose button {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 50%;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
}
body[data-theme="dark"] .floating-chat-window,
body[data-theme="dark"] .floating-chat-contact:hover,
body[data-theme="dark"] .floating-chat-compose { background: #111827; border-color: #334155; }
body[data-theme="dark"] .floating-chat-body,
body[data-theme="dark"] .floating-chat-compose input { background: #0f172a; color: #f8fafc; }
body[data-theme="dark"] .floating-chat-contact,
body[data-theme="dark"] .floating-chat-message { color: #f8fafc; }
body[data-theme="dark"] .floating-chat-message { background: #1f2937; }
@media (max-width: 575.98px) {
    .floating-chat { left: 10px; right: 10px; bottom: 10px; }
    .floating-chat-window { width: 100%; height: min(540px, calc(100vh - 80px)); }
}

/* Full messages page */
.messenger-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 1rem;
    min-height: 660px;
}
.messenger-contacts,
.messenger-thread-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.08));
    overflow: hidden;
}
.messenger-section-title {
    padding: 1rem;
    font-weight: 800;
    border-bottom: 1px solid var(--border, #e2e8f0);
}
.messenger-contact {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem 1rem;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(148,163,184,.16);
}
.messenger-contact:hover,
.messenger-contact.active {
    background: rgba(99,102,241,.1);
}
.messenger-contact-copy {
    min-width: 0;
    flex: 1;
}
.messenger-contact-copy strong,
.messenger-contact-copy small {
    display: block;
}
.messenger-contact-copy small {
    color: var(--gray, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.messenger-thread-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.messenger-thread-head {
    min-height: 72px;
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
}
.messenger-thread-head strong,
.messenger-thread-head small {
    display: block;
}
.messenger-thread-head small {
    color: var(--gray, #64748b);
}
.messenger-thread {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: var(--surface-soft, #f8fafc);
}
.messenger-message {
    display: flex;
    margin-bottom: .75rem;
}
.messenger-message.mine {
    justify-content: flex-end;
}
.messenger-message-body {
    max-width: min(74%, 620px);
    padding: .8rem 1rem;
    background: #fff;
    color: #0f172a;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 1px 2px rgba(15,23,42,.08);
    overflow-wrap: anywhere;
}
.messenger-message.mine .messenger-message-body {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 16px 16px 4px 16px;
}
.messenger-message-body small {
    display: block;
    margin-top: .35rem;
    opacity: .72;
    font-size: .72rem;
}
.messenger-compose {
    padding: .8rem;
    display: flex;
    gap: .65rem;
    align-items: end;
    border-top: 1px solid var(--border, #e2e8f0);
}
.messenger-compose textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 999px;
    padding: .75rem 1rem;
    min-height: 46px;
}
.messenger-compose button {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    padding: 0;
    flex: 0 0 46px;
}
body[data-theme="dark"] .messenger-contacts,
body[data-theme="dark"] .messenger-thread-card,
body[data-theme="dark"] .messenger-message-body,
body[data-theme="dark"] .messenger-compose textarea {
    background: #111827;
    color: #f8fafc;
    border-color: #334155;
}
body[data-theme="dark"] .messenger-thread {
    background: #0f172a;
}
@media (max-width: 991.98px) {
    .messenger-layout { grid-template-columns: 1fr; min-height: auto; }
    .messenger-contacts { max-height: 360px; overflow-y: auto; }
    .messenger-thread-card { min-height: 540px; }
}
.teacher-profile-link {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}

.teacher-profile-link:hover {
    color: var(--primary-color, #6c5ce7);
    text-decoration: underline;
}
