:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --purple: #8b5cf6;
    --purple-light: #ede9fe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #0f172a 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255,255,255,.03) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(5deg); }
    66% { transform: translate(-20px, 20px) rotate(-3deg); }
}
.login-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}
.login-lang-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}
html[dir="rtl"] .login-lang-row {
    justify-content: flex-start;
}
html[lang="ar"] body.login-page-body .login-page,
html[lang="ar"] body.login-page-body .login-card {
    font-family: 'Noto Sans Arabic', 'Inter', sans-serif;
}
html[dir="rtl"] .login-card .input-icon-wrapper .form-control {
    padding-left: 16px;
    padding-right: 44px;
}
html[dir="rtl"] .login-card .input-icon-wrapper i {
    left: auto;
    right: 16px;
}
.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 25px 50px rgba(0,0,0,.25);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}
.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}
.login-logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: all .2s;
    background: var(--white);
    color: var(--gray-800);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.input-icon-wrapper {
    position: relative;
}
.input-icon-wrapper .form-control {
    padding-left: 44px;
}
.input-icon-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    line-height: 1;
}
.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #d97706; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-200);
    color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #93c5fd; }

/* ===== APP LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.sidebar {
    width: var(--sidebar-width);
    max-width: min(var(--sidebar-width), 88vw);
    background: var(--gray-900);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
}
.sidebar-logo img {
    height: 32px;
    width: 32px;
    object-fit: contain;
    border-radius: 6px;
}
.sidebar-logo i { font-size: 24px; color: var(--primary); }
.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 20px;
    cursor: pointer;
}
.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all .15s;
    margin-bottom: 2px;
    position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-link.active {
    background: var(--primary);
    color: var(--white);
}
.nav-link i { width: 20px; text-align: center; font-size: 15px; }
.nav-badge {
    position: absolute;
    right: 12px;
    background: var(--danger);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
}
.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    position: sticky;
    top: 0;
    z-index: 99;
    gap: 12px;
    min-width: 0;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-700);
    cursor: pointer;
    padding: 8px;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: clamp(6px, 2vw, 14px);
    margin-inline-start: auto;
    min-width: 0;
    flex-shrink: 1;
}
.user-info {
    text-align: right;
}
.user-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}
.user-role {
    font-size: 12px;
    color: var(--gray-500);
}
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-avatar i { color: var(--primary); font-size: 18px; }

.content-area {
    flex: 1;
    padding: 28px;
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    min-width: 0;
}

/* ===== SITE FOOTER ===== */
.site-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
    text-align: center;
}
.site-footer-developed {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 4px;
    font-weight: 500;
}
.site-footer-developed i {
    color: var(--danger);
    margin-right: 4px;
    font-size: 12px;
}
.site-footer-copy {
    font-size: 12px;
    color: var(--gray-400);
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}
.page-header p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
}
.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}
.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}
.stat-info p {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
    font-weight: 500;
}

/* ===== TABLE ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
/* Fit wide data tables to the content area: share column width, wrap text (avoids horizontal scroll on large screens) */
.table-responsive > table {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}
.table-responsive > table th {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
    vertical-align: bottom;
    hyphens: auto;
}
.table-responsive > table td {
    word-break: break-word;
    overflow-wrap: anywhere;
}
.table-responsive > table td.actions,
.table-responsive > table .actions {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}
.table-responsive > table th:first-child,
.table-responsive > table td:first-child {
    min-width: 0;
}
@media (min-width: 1200px) {
    .table-responsive > table th,
    .table-responsive > table td {
        padding: 10px 10px;
    }
    .table-responsive > table th {
        font-size: 11px;
    }
    .table-responsive > table td {
        font-size: 13px;
    }
}
/* Phones / small tablets: avoid squashed columns + heavy text wrapping — scroll horizontally instead */
@media (max-width: 1023px) {
    .table-responsive > table {
        table-layout: auto;
        width: max-content;
        min-width: 100%;
    }
    .table-responsive > table th {
        white-space: nowrap;
        overflow-wrap: normal;
        word-break: normal;
        hyphens: manual;
    }
    .table-responsive > table td {
        word-break: normal;
        overflow-wrap: normal;
    }
}
table {
    width: 100%;
    border-collapse: collapse;
}
table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
    vertical-align: middle;
}
table tr:hover td { background: var(--gray-50); }
table .actions { white-space: nowrap; display: flex; gap: 6px; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-info { background: #e0e7ff; color: #3730a3; }

/* ===== MATERIAL CARDS ===== */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.material-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all .2s;
}
.material-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.material-card-header {
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.material-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.material-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
    line-height: 1.3;
}
.material-meta {
    font-size: 12px;
    color: var(--gray-500);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.material-card-footer {
    padding: 14px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,.25);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { font-size: 18px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
}
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.modal-footer--single {
    justify-content: center;
}
.modal.modal--viewer-report {
    max-width: min(640px, calc(100vw - 32px));
}
.modal-body--scroll {
    max-height: min(500px, 70vh);
    overflow-y: auto;
}
.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 16px;
}
.report-tab {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--gray-500);
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
}
.report-tab.active {
    border-bottom-color: var(--success);
    color: var(--success);
}
@media (min-width: 480px) {
    .report-tab {
        padding: 10px 18px;
        flex: 0 1 auto;
    }
}
.report-inner-table {
    width: 100%;
    min-width: 0;
}

/* ===== FILE UPLOAD ===== */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    transition: all .2s;
    cursor: pointer;
    background: var(--gray-50);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-zone i { font-size: 40px; color: var(--gray-400); margin-bottom: 12px; }
.upload-zone h3 { font-size: 16px; color: var(--gray-700); margin-bottom: 4px; }
.upload-zone p { font-size: 13px; color: var(--gray-500); }

/* Worksheet builder (teacher/create-worksheet.php dynamic rows) */
.pair-row { flex-wrap: wrap; }
@media (max-width: 540px) {
    .pair-row {
        flex-direction: column;
        align-items: stretch !important;
    }
    .pair-row > .fa-arrows-alt-h { display: none; }
}

/* ===== WHATSAPP FLOAT ===== */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 28px;
    text-decoration: none;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(37,211,102,.4);
    transition: all .3s;
    animation: whatsapp-pulse 2s infinite;
}
.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37,211,102,.6);
}
/* Site-wide float: extra inset on large screens so table actions aren’t under the FAB */
@media (min-width: 1024px) {
    body.logged-in:has(.whatsapp-float--site) .content-area {
        padding-right: max(28px, calc(28px + 72px));
        padding-bottom: max(28px, calc(28px + 56px + env(safe-area-inset-bottom, 0px)));
    }
}
/* Phones / tablets: don’t reserve ~100px on the right — content uses full width; float stays fixed */
@media (max-width: 1023px) {
    body.logged-in:has(.whatsapp-float--site) .content-area {
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: max(20px, calc(20px + 72px + env(safe-area-inset-bottom, 0px)));
    }
}
@keyframes whatsapp-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(37,211,102,.4); }
    50% { box-shadow: 0 4px 20px rgba(37,211,102,.6), 0 0 0 10px rgba(37,211,102,.1); }
}

/* ===== CHECKBOX GRID ===== */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s;
    font-size: 14px;
}
.checkbox-item:hover { border-color: var(--primary); background: var(--primary-light); }
.checkbox-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
    overflow-x: auto;
}
.tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .15s;
    white-space: nowrap;
}
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}
.empty-state i {
    font-size: 56px;
    color: var(--gray-300);
    margin-bottom: 16px;
}
.empty-state h3 {
    font-size: 18px;
    color: var(--gray-700);
    margin-bottom: 8px;
}

/* ===== PROFILE ===== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--white);
}
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar i { font-size: 36px; }
.profile-details h2 { font-size: 22px; font-weight: 700; }
.profile-details p { opacity: .85; font-size: 14px; }

/* ===== VIEWER ===== */
.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.video-container video {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}
.pdf-viewer {
    width: 100%;
    height: min(600px, 75vh);
    min-height: 280px;
    border: none;
    border-radius: var(--radius-sm);
}

/* Metadata grid (e.g. material detail stats) */
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 992px) {
    .metadata-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .metadata-grid { grid-template-columns: 1fr; }
}

/* ===== GRID HELPERS ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ===== RESPONSIVE ===== */
/* Up to large tablet: drawer sidebar + full-width main (fixes portrait tablet layout) */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
    }
    .sidebar-close { display: block; }
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 44px;
        height: 44px;
        border-radius: var(--radius-sm);
    }
    .menu-toggle:hover {
        background: var(--gray-100);
    }
    .main-content {
        margin-left: 0;
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
    .content-area {
        padding: 20px 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    .topbar {
        padding: 0 16px 0 8px;
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    .user-info { max-width: min(260px, 55vw); min-width: 0; }
    .user-name {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }
    .tabs {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        gap: 0;
        margin-bottom: 20px;
    }
    .tab {
        padding: 12px 16px;
        font-size: 13px;
    }
    .card .table-responsive table th,
    .card .table-responsive table td {
        padding: 11px 12px;
        font-size: 13px;
    }
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar .form-control { max-width: 100%; }
    .filter-bar form { width: 100%; }
}
@media (max-width: 768px) {
    .content-area { padding: 16px 10px; padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
    .topbar { padding: 0 12px 0 4px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header > div:first-child { min-width: 0; }
    .page-header > .btn { width: 100%; justify-content: center; }
    .page-header > div:not(:first-child) {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    .page-header > div:not(:first-child) .btn { width: 100%; justify-content: center; }
    .page-header h1 { font-size: 20px; word-wrap: break-word; }
    .user-info { max-width: min(50%, 42vw); min-width: 0; }
    .user-name {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }
    .user-role { display: none; }
    .topbar .lang-switch--toggle .lang-switch__btn {
        min-height: 40px;
        padding-left: clamp(8px, 2.5vw, 12px);
        padding-right: clamp(8px, 2.5vw, 12px);
    }
    .login-page .lang-switch--toggle .lang-switch__btn {
        min-height: 40px;
        padding-left: clamp(8px, 2.5vw, 12px);
        padding-right: clamp(8px, 2.5vw, 12px);
    }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
    .stat-card { padding: 18px; }
    .stat-info h3 { font-size: 22px; }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .materials-grid { grid-template-columns: 1fr; }
    .login-card { padding: 32px 24px; }
    .profile-header { flex-direction: column; text-align: center; padding: 24px; }
    .modal { margin: 10px; max-width: calc(100vw - 20px); }
    .checkbox-grid { grid-template-columns: 1fr; }
    table th, table td { padding: 10px 12px; font-size: 13px; }
    .pdf-viewer { height: min(70vh, 600px); min-height: 240px; }
    input.form-control,
    textarea.form-control,
    select.form-control {
        font-size: 16px;
    }
    .filter-bar form { width: 100%; }
    .filter-bar .form-control { width: 100%; max-width: none; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .content-area {
        padding: 12px 8px;
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }
    .card-body { padding: 14px 12px; }
    .card-header { padding: 14px 12px; }
    .site-footer { padding: 16px 12px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
    .page-header h1 { font-size: 18px; }
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,.4);
    z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    align-items: center;
}
.filter-bar .form-control {
    max-width: 220px;
    padding: 10px 14px;
}

/* ===== SETTINGS FORM ===== */
.settings-section {
    padding: 24px;
    border-bottom: 1px solid var(--gray-100);
}
.settings-section:last-child { border-bottom: none; }
.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
}
.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.color-input-wrapper input[type="color"] {
    width: 48px;
    height: 38px;
    border: 2px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
}

/* ===== QUIZ BUILDER ===== */
.quiz-builder-question {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    transition: all .2s;
}
.quiz-builder-question:hover {
    box-shadow: var(--shadow-md);
}
.quiz-builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}
.quiz-q-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.quiz-options-builder {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.quiz-option-input {
    display: flex;
    align-items: center;
    gap: 10px;
}
.opt-label {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--gray-600);
    flex-shrink: 0;
}
.quiz-option-input .form-control {
    flex: 1;
}

/* ===== QUIZ PREVIEW (admin) ===== */
.quiz-options-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.quiz-option-preview {
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gray-600);
}
.quiz-option-preview.correct {
    border-color: var(--success);
    background: var(--success-light);
    color: #065f46;
}
.quiz-option-preview i {
    font-size: 14px;
}
.quiz-option-preview.correct i {
    color: var(--success);
}

/* ===== QUIZ TAKING ===== */
.quiz-take-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.quiz-take-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}
.quiz-take-header p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 2px;
}
.quiz-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius);
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    border: 2px solid var(--primary);
    min-width: 130px;
    justify-content: center;
}
.quiz-timer i {
    font-size: 18px;
}
.quiz-timer.warning {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
    animation: timer-pulse 1s infinite;
}
.quiz-timer.expired {
    background: var(--danger);
    color: var(--white);
}
@keyframes timer-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.quiz-progress {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 20px;
    overflow: hidden;
}
.quiz-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 20px;
    transition: width .4s ease;
}

.quiz-question-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    transition: all .2s;
    border-left: 4px solid var(--gray-300);
}
.quiz-question-card:hover {
    box-shadow: var(--shadow);
}
.quiz-question-card.correct { border-left-color: var(--success); }
.quiz-question-card.incorrect { border-left-color: var(--danger); }
.quiz-question-card.pending-grade { border-left-color: var(--warning); }

.quiz-question-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px;
}
.quiz-question-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.5;
}

.quiz-options {
    padding: 0 20px 20px 62px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s;
    font-size: 14px;
}
.quiz-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.quiz-option input[type="radio"] {
    display: none;
}
.quiz-option input[type="radio"]:checked + .quiz-option-letter {
    background: var(--primary);
    color: var(--white);
}
.quiz-option input[type="radio"]:checked ~ .quiz-option-text {
    font-weight: 600;
    color: var(--primary-dark);
}
.quiz-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}
.quiz-option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--gray-600);
    flex-shrink: 0;
    transition: all .15s;
}
.quiz-option-text {
    flex: 1;
    transition: all .15s;
}

/* ===== QUIZ RESULT ===== */
.quiz-result-summary {
    text-align: center;
    margin-bottom: 32px;
}
.quiz-result-score {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
    display: inline-block;
    min-width: 300px;
}
.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 6px solid;
}
.quiz-result-score.success .score-circle {
    border-color: var(--success);
    background: var(--success-light);
}
.quiz-result-score.warning .score-circle {
    border-color: var(--warning);
    background: var(--warning-light);
}
.quiz-result-score.danger .score-circle {
    border-color: var(--danger);
    background: var(--danger-light);
}
.score-number {
    font-size: 28px;
    font-weight: 800;
}
.quiz-result-score.success .score-number { color: #065f46; }
.quiz-result-score.warning .score-number { color: #92400e; }
.quiz-result-score.danger .score-number { color: #991b1b; }
.quiz-result-score h2 {
    font-size: 20px;
    color: var(--gray-800);
    margin-bottom: 6px;
}
.quiz-result-score p {
    font-size: 14px;
    color: var(--gray-600);
}

/* ===== RESPONSIVE QUIZ ===== */
@media (max-width: 768px) {
    .quiz-take-header { flex-direction: column; align-items: flex-start; }
    .quiz-take-header h1 { font-size: 20px; }
    .quiz-timer { align-self: flex-start; padding: 10px 18px; font-size: 18px; }
    .quiz-options { padding-left: 20px; }
    .quiz-question-header { padding: 16px; }
    .quiz-builder-header { flex-direction: column; gap: 10px; align-items: flex-start; }
    .quiz-result-score { min-width: auto; width: 100%; padding: 30px 20px; }
    .score-circle { width: 100px; height: 100px; }
    .score-number { font-size: 24px; }
}

/* ===== CHATBOT ===== */
.chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 96px;
    z-index: 9998;
}
.chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37,99,235,.4);
    transition: all .3s;
    position: relative;
}
.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(37,99,235,.5);
}
.chatbot-toggle.active {
    background: var(--gray-700);
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--white);
}
.chatbot-toggle.active::before { display: none; }

.chatbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-height: 520px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(.95);
    pointer-events: none;
    transition: all .3s cubic-bezier(.4,0,.2,1);
}
.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chatbot-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.chatbot-header h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}
.chatbot-header span {
    font-size: 11px;
    opacity: .8;
}
.chatbot-header-close {
    background: rgba(255,255,255,.15);
    border: none;
    color: var(--white);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background .2s;
}
.chatbot-header-close:hover {
    background: rgba(255,255,255,.3);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
    max-height: 320px;
    scroll-behavior: smooth;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }

.chat-msg {
    display: flex;
    max-width: 85%;
    animation: chatFadeIn .3s ease;
}
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; }

@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.55;
    word-wrap: break-word;
}
.chat-msg.bot .chat-bubble {
    background: var(--gray-100);
    color: var(--gray-800);
    border-bottom-left-radius: 4px;
}
.chat-msg.user .chat-bubble {
    background: var(--primary);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.chat-bubble.typing {
    display: flex;
    gap: 4px;
    padding: 14px 20px;
}
.chat-bubble.typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
    animation: typingDot 1.4s infinite;
}
.chat-bubble.typing span:nth-child(2) { animation-delay: .2s; }
.chat-bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.chatbot-suggestions {
    padding: 8px 16px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid var(--gray-100);
    flex-shrink: 0;
}
.chat-suggestion {
    padding: 6px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    background: var(--white);
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    white-space: nowrap;
}
.chat-suggestion:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.chatbot-input {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid var(--gray-100);
    gap: 8px;
    flex-shrink: 0;
    background: var(--white);
}
.chatbot-input input {
    flex: 1;
    border: 2px solid var(--gray-200);
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
}
.chatbot-input input:focus {
    border-color: var(--primary);
}
.chatbot-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background .2s;
    flex-shrink: 0;
}
.chatbot-input button:hover {
    background: var(--primary-dark);
}

/* ===== RESPONSIVE CHATBOT ===== */
@media (max-width: 1024px) {
    .chatbot-widget {
        right: max(16px, env(safe-area-inset-right));
        bottom: max(16px, env(safe-area-inset-bottom));
    }
    .chatbot-toggle { width: 50px; height: 50px; font-size: 20px; }
    .chatbot-window {
        width: calc(100vw - 32px);
        max-width: calc(100dvw - 32px);
        right: -8px;
        bottom: 62px;
        max-height: min(70vh, 70dvh);
    }
    .whatsapp-float {
        bottom: max(80px, calc(env(safe-area-inset-bottom) + 72px));
        right: max(16px, env(safe-area-inset-right));
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
}
@media (min-width: 1025px) {
    .whatsapp-float { bottom: 24px; right: 24px; }
}

/* Language switch + RTL layout */
.lang-switch {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-right: 8px;
}
.lang-switch__btn {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    line-height: 1.2;
}
.lang-switch__btn:hover { color: var(--primary); border-color: var(--primary); }
.lang-switch__btn.is-active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Pill toggle (login + topbar): same shape; login uses frosted-on-gradient, topbar uses light track */
.lang-switch.lang-switch--toggle {
    gap: 0;
    padding: 3px;
    border-radius: 999px;
    flex-shrink: 0;
    max-width: 100%;
}
.lang-switch--toggle .lang-switch__btn {
    border: none;
    border-radius: 999px;
    padding: 6px clamp(10px, 3vw, 14px);
    font-size: clamp(11px, 2.8vw, 12px);
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.login-page .lang-switch--toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(8px);
}
.login-page .lang-switch--toggle .lang-switch__btn {
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
}
.login-page .lang-switch--toggle .lang-switch__btn:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.12);
}
.login-page .lang-switch--toggle .lang-switch__btn.is-active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.topbar .lang-switch--toggle {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
}
.topbar .lang-switch--toggle .lang-switch__btn {
    color: var(--gray-600);
    background: transparent;
}
.topbar .lang-switch--toggle .lang-switch__btn:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.06);
}
.topbar .lang-switch--toggle .lang-switch__btn.is-active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

html[dir="rtl"] .lang-switch { margin-right: 0; margin-left: 8px; }
html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}
html[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}
@media (max-width: 1024px) {
    html[dir="rtl"] .main-content { margin-right: 0; }
}

/* Hide site WhatsApp when chatbot panel is open (avoids overlap on phones) */
body.chatbot-open .whatsapp-float {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
