/* ==========================================================================
   1. Variables & Themes
   ========================================================================== */
:root {
    --sidebar-width: 250px;
    --primary-blue: var(--bs-primary) !important;
    --bg-light: #f8fafc;
    --hero-bg: radial-gradient(circle at top right, #1e293b 0%, #0f172a 100%);
    --sidebar-bg: #ffffff;
    --sidebar-border: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --header-bg: rgba(248, 250, 252, 0.8);
    --spacing: 0.25rem;
}

[data-bs-theme="dark"] {
    --bg-light: #0f172a;
    --sidebar-bg: #1e293b;
    --sidebar-border: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: #1e293b;
    --card-border: #334155;
    --hero-bg: radial-gradient(circle at top right, #334155 0%, #0f172a 100%);
    --header-bg: rgba(15, 23, 42, 0.8);
}

/* ==========================================================================
   2. Base Styles
   ========================================================================== */
body {
    font-family: "Noto Kufi Arabic", "Noto Kufi Arabic Fallback", sans-serif;
    background-color: var(--bg-light);
    overflow-x: hidden;
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
}

/* RTL Support via Language */
html:lang(ar) body,
html:lang(ar-u-nu-latn) body {
    direction: rtl;
    text-align: right;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: 0 0; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; }

/* Firefox Support */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
[data-bs-theme="dark"] * { scrollbar-color: #475569 transparent; }

/* ==========================================================================
   3. Layout & Sidebar
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    background: var(--sidebar-bg);
    border-inline-end: 1px solid var(--sidebar-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 20px 0 40px rgba(15, 23, 42, 0.05);
}

.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    padding-inline: calc(var(--spacing) * 8);
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: var(--bs-primary) !important;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s;
}

.sidebar-brand:hover .brand-logo { transform: scale(1.05); }

.brand-text-large {
    color: var(--text-main);
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1;
}

.brand-text-sub {
    font-size: 0.65rem;
    color: var(--bs-primary) !important;
    font-weight: 500;
    background: rgba(37, 99, 235, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    width: fit-content;
}

[data-bs-theme="dark"] .brand-text-sub {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: 12px;
    margin-bottom: 0.25rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-light);
    color: var(--text-main);
}

.sidebar-nav .nav-link.active {
    background: #eff6ff;
    color: var(--bs-primary) !important;
    font-weight: var(--font-weight-bold);
}

.sidebar-nav .nav-link.active .badge-count {
    background: #ffffff;
    color: var(--bs-primary) !important;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

[data-bs-theme="dark"] .sidebar-nav .nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.sidebar-nav .nav-link.active::before {
    content: "";
    position: absolute;
    inset-inline-start: -1rem;
    top: 15%;
    bottom: 15%;
    width: 4px;
    background: var(--bs-primary) !important;
}

[dir="ltr"] .sidebar-nav .nav-link.active::before { border-radius: 0 4px 4px 0; }
:lang(ar) .sidebar-nav .nav-link.active::before,
:lang(ar-u-nu-latn) .sidebar-nav .nav-link.active::before { border-radius: 4px 0 0 4px; }

[data-bs-theme="dark"] .sidebar-nav .nav-link.active::before {
    background: #60a5fa;
}

.sidebar-nav .nav-link i,
.sidebar-nav .nav-link svg {
    width: 18px !important;
    height: 18px !important;
    opacity: 0.8;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover i { transform: scale(1.1); }

.badge-count {
    margin-inline-start: auto;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #64748b;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav .nav-link:hover .badge-count {
    background: #ffffff;
    color: var(--bs-primary) !important;
}

[data-bs-theme="dark"] .badge-count {
    background: #334155;
    color: #94a3b8;
}

[data-bs-theme="dark"] .sidebar-nav .nav-link:hover .badge-count {
    background: #0f172a;
    color: #f8fafc;
}

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 500;
    letter-spacing: 0.05em;
    margin: 2rem 1rem 0.75rem;
    opacity: 0.7;
}

.interactions-share-container {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.05);
    margin-top: 35px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    flex-wrap: wrap;
}

.interactions-share-container:hover {
    box-shadow: 0 15px 50px rgba(15, 23, 42, 0.08);
}

.interactions-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.interaction-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #64748b;
    min-width: 48px;
    background: none;
    border: none;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.interaction-item i {
    width: 24px !important;
    height: 24px !important;
    stroke-width: 1.8px;
}

.interaction-item:hover {
    background: #f8fafc;
    color: var(--primary-blue);
    transform: translateY(-3px);
}

.interaction-item.btn-like:hover { color: #10b981; }
.interaction-item.btn-dislike:hover { color: #ef4444; }

.interaction-item .count {
    font-size: 0.75rem;
    font-weight: 500;
    font-family: sans-serif;
}

.h-divider {
    width: 1px;
    height: 24px;
    background: #e2e8f0;
    margin: 0 8px;
}

.interaction-btn-circle {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid #f1f5f9;
    background: #f8fafc;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-heart:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fee2e2;
    transform: scale(1.1) rotate(5deg);
}

.btn-comment {
    position: relative;
}

.comment-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-blue);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    border: 2px solid #fff;
}

.btn-comment:hover {
    background: #eff6ff;
    color: var(--primary-blue);
    border-color: #dbeafe;
    transform: scale(1.1) rotate(-5deg);
}

.v-divider-social {
    width: 1px;
    height: 40px;
    background: #f1f5f9;
}

.share-group {
    display: flex;
    align-items: center;
    gap: 24px;
}

.share-label {
    font-weight: 500;
    color: #1e293b;
    font-size: 0.9rem;
    white-space: nowrap;
}

.social-icons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.social-icons a {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    background: #f8fafc;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-icons a i, .social-icons a svg {
    font-size: 22px;
}

.social-icons a:hover {
    transform: translateY(-4px) scale(1.1);
    color: #fff;
}

.share-facebook:hover { background: #1877f2 !important; color: #fff !important; }
.share-messenger:hover { background: #0084ff !important; color: #fff !important; }
.share-twitter:hover { background: #000000 !important; color: #fff !important; }
.share-whatsapp:hover { background: #25d366 !important; color: #fff !important; }
.share-telegram:hover { background: #0088cc !important; color: #fff !important; }
.share-mail:hover { background: #ea4335 !important; color: #fff !important; }
.share-copy:hover { background: #64748b !important; color: #fff !important; }
.interaction-item.active-like { color: #10b981; background: #ecfdf5; }
.interaction-item.active-dislike { color: #ef4444; background: #fef2f2; }
.interaction-btn-circle.active-heart { color: #ef4444; background: #fef2f2; border-color: #fee2e2; }
.interaction-btn-circle.active-heart i { fill: #ef4444; }

.share-copy i { transition: transform 0.2s; }
.share-copy:active i { transform: scale(0.8); }

/* ==========================================================================
   Custom Modal (Comments)
   ========================================================================== */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: #fff;
    margin: 10vh auto;
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    background: #6366f1; /* purple-ish */
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    border-radius: 20px 20px 0 0;
}

.header-main-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-main-title i {
    width: 24px !important;
    height: 24px !important;
}

.header-main-title span {
    font-size: 1.25rem;
    font-weight: 500;
}

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

.close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 0;
    max-height: 70vh;
    overflow-y: auto;
}

.comment-form-container {
    padding: 20px 25px;
    background: #fff;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.user-avatar-placeholder {
    width: 48px;
    height: 48px;
    background: #ffedd5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f97316;
    flex-shrink: 0;
}

.form-group-wrapper {
    flex: 1;
}

.form-group-wrapper textarea {
    width: 100%;
    height: 100px;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    resize: none;
    font-size: 0.95rem;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.form-group-wrapper textarea:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-submit-comment {
    background: #94a3b8;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-submit-comment:hover {
    background: #64748b;
}

.btn-submit-comment:hover {
    background: #64748b;
    transform: translateY(-2px);
}

.comments-list {
    padding: 10px 25px 25px;
}

.comment-item {
    display: flex;
    gap: 15px;
    padding: 20px 0;
    border-bottom: 1px solid #f1f5f9;
}

.comment-item:last-child { border-bottom: none; }

.comment-user-avatar {
    width: 40px;
    height: 40px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.comment-content { flex: 1; }

.comment-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.user-name {
    font-weight: 500;
    color: #1e293b;
    font-size: 0.95rem;
}

.comment-date {
    color: #94a3b8;
    font-size: 0.75rem;
}

.comment-text {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
}

.no-comments {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-weight: 500;
}

.loading-comments {
    padding: 30px;
    text-align: center;
}

.comment-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    border: 2px solid #fff;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

[data-bs-theme="dark"] .modal-content { background: #1e293b; color: #f8fafc; }
[data-bs-theme="dark"] .comment-form-container { background: #0f172a; border-color: #334155; }
[data-bs-theme="dark"] .form-group-wrapper textarea { background: #1e293b; border-color: #334155; color: #fff; }
[data-bs-theme="dark"] .comment-item { border-color: #334155; }
[data-bs-theme="dark"] .user-name { color: #f8fafc; }
[data-bs-theme="dark"] .comment-text { color: #94a3b8; }

@media (max-width: 768px) {
    .interactions-share-container {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }
    .share-group {
        width: 100%;
        flex-direction: column;
        gap: 15px;
    }
    .v-divider-social { display: none; }
}

[data-bs-theme="dark"] .interactions-share-container {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .interaction-btn-circle,
[data-bs-theme="dark"] .social-icons a,
[data-bs-theme="dark"] .interaction-item:hover {
    background: #0f172a;
    border-color: #334155;
}

[data-bs-theme="dark"] .h-divider,
[data-bs-theme="dark"] .v-divider-social {
    background: #334155;
}

[data-bs-theme="dark"] .share-label {
    color: #f8fafc;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--sidebar-border);
    padding: 1.5rem 1rem;
}

/* ==========================================================================
   4. Content Header
   ========================================================================== */
.content-header {
    height: 80px;
    padding: 0 2rem;
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    align-items: center;
    position: absolute !important;
    top: 0;
    inset-inline-start: var(--sidebar-width);
    inset-inline-end: 0;
    z-index: 999;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--sidebar-border);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:lang(ar) .content-header,
:lang(ar-u-nu-latn) .content-header { justify-content: flex-end; }

[data-bs-theme="dark"] .content-header {
    background: rgba(30, 41, 59, 0.85);
}

.header-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border-radius: 10px;
    transition: all 0.2s;
}

.header-btn:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
}

.header-icon-link {
    width: 38px;
    height: 38px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 10px;
}

.header-icon-link svg,
.header-btn svg {
    width: 18px !important;
    height: 18px !important;
}

.header-icon-link:hover {
    background: #f0f4f8;
    color: #10b981;
}

[data-bs-theme="dark"] .header-icon-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.header-v-divider {
    width: 1px;
    height: 20px;
    background: var(--sidebar-border);
    margin: 0 0.35rem;
}

.notif-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    background: #ff4d4f;
    border: 1.5px solid #fff;
    border-radius: 50%;
}

[data-bs-theme="dark"] .notif-dot { border-color: var(--sidebar-bg); }

/* ==========================================================================
   5. Hero Banner
   ========================================================================== */
.hero-banner {
    background: #0f172a;
    background: radial-gradient(circle at 15% 50%, #1e293b 0%, #0f172a 100%);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: start;
    color: #fff;
    margin: 1.5rem 0 3rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (min-width: 48rem) {
    .hero-banner {
        padding: calc(var(--spacing) * 10) calc(var(--spacing) * 14);
    }
}

[data-bs-theme="dark"] .hero-banner {
    background: radial-gradient(circle at 15% 50%, #1e293b 0%, #020617 100%);
}

.hero-banner::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('https://www.transparenttextures.com/patterns/carbon-fibre.png');
    opacity: 0.02;
    z-index: 1;
}

.hero-aurora {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    mix-blend-mode: screen;
    animation: aurora-move 20s infinite alternate;
}

.aurora-1 { top: -20%; left: -20%; width: 70%; height: 70%; background: #10b981; }
.aurora-2 { top: 10%; right: -20%; width: 80%; height: 80%; background: #3b82f6; animation-delay: -5s; }
.aurora-3 { bottom: -20%; left: 10%; width: 60%; height: 60%; background: #a855f7; animation-delay: -10s; }

@keyframes aurora-move {
    from { transform: translate(0, 0) rotate(0deg); }
    to { transform: translate(10%, 10%) rotate(10deg); }
}

.hero-title {
    font-weight: 500;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 2;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.85;
    max-width: 800px;
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   7. Sujet Viewer (Madrassa Theme)
   ========================================================================== */
.sujet-view-page {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
}

.top-nav-segmented {
    display: flex;
    background: var(--bs-primary) !important;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    align-items: stretch;
}

.nav-segment {
    background: transparent;
    color: #fff !important;
    padding: 12px 15px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.2s;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    white-space: nowrap;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-segment:last-child {
    border-left: none;
}

.nav-chevron {
    width: 16px !important;
    height: 16px !important;
    opacity: 0.5;
}

.nav-segment:hover {
    background: rgba(255, 255, 255, 0.1);
}

.viewer-container {
    background: transparent;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: none;
    padding: 0;
}

.header-info-bar {
    background: var(--bs-primary) !important;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
    height: 50px;
    margin: 0;
}

.header-v-sep {
    width: 1.5px;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    display: block;
}

.header-v-sep-inner {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 15px;
    display: inline-block;
}

.header-title-text {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    padding: 0 20px;
    height: 100%;
}

.year-badge-viewer {
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 12px;
    border-radius: 50px;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.header-arrow.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.header-separator {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 300;
    margin: 0 5px;
}

.title-main {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-arrow {
    color: #fff;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    transition: all 0.2s;
    text-decoration: none !important;
}

.header-arrow:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.header-arrow i, .header-arrow svg {
    width: 20px !important;
    height: 20px !important;
}

.arrow-right {
    border: none;
}

.arrow-left {
    border: none;
}

.pdf-viewer-area {
    background: transparent;
    height: 800px;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.pdf-frame-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.viewer-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: opacity 0.4s ease, visibility 0.4s;
}

[data-bs-theme="dark"] .viewer-loader {
    background: #1e293b;
}

.viewer-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.bottom-action-bar {
    background: var(--bs-primary) !important;
    display: flex;
    border-radius: 0 0 12px 12px !important;
    overflow: hidden;
    height: 50px;
    margin: 0;
}

.action-btn-viewer {
    color: #fff !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 500;
    flex: 1;
    transition: all 0.2s ease;
}

.action-v-sep {
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    display: block;
}

.action-btn-viewer:hover {
    background: rgba(255, 255, 255, 0.15);
}

.action-btn-viewer i {
    width: 20px !important;
    height: 20px !important;
}

[dir="ltr"] .nav-segment:first-child { border-radius: 8px 0 0 0; }
[dir="ltr"] .nav-segment:last-child { border-radius: 0 8px 0 0; }
/* Breadcrumbs */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: flex-start;
}

.breadcrumb-item, .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.6) !important;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.breadcrumb-item.active { color: #fff !important; }

.breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.3) !important;
    content: "Ã¢â€ â€™";
}

:lang(ar) .breadcrumb-item + .breadcrumb-item::before,
:lang(ar-u-nu-latn) .breadcrumb-item + .breadcrumb-item::before { content: "Ã¢â€ Â"; }

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.section-icon {
    width: 44px;
    height: 44px;
    background: var(--bs-primary) !important;
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    flex-shrink: 0;
}

[data-bs-theme="dark"] .section-icon {
    background: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.section-icon svg {
    width: 20px !important;
    height: 20px !important;
}

.section-title-text {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* Pagination */
.pagination-rounded .page-link {
    border-radius: 12px !important;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-main);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
    margin: 0 2px;
}

.pagination-rounded .page-link:hover {
    background: var(--bg-light);
    border-color: var(--bs-primary) !important;
    color: var(--bs-primary) !important;
    transform: translateY(-2px);
}

.pagination-rounded .page-item.active .page-link {
    background: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.pagination-rounded .page-item.disabled .page-link {
    opacity: 0.5;
    background: var(--bg-light);
    pointer-events: none;
}

/* Stage Cards */
.stage-card {
    border-radius: 24px;
    padding: 1.25rem;
    height: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1.5px solid transparent;
}

.stage-card:hover {
    /* Animation removed as requested */
}

.stage-divider {
    height: 1px;
    width: 100%;
    margin: 1rem 0;
}

/* Primary Divider (Emerald) */
.stage-primary .stage-divider {
    background-color: rgba(167, 243, 208, 0.6); /* emerald-200/60 */
}
[data-bs-theme="dark"] .stage-primary .stage-divider {
    background-color: rgba(6, 78, 59, 0.4); /* emerald-700/40 */
}

/* Middle Divider (Blue) */
.stage-middle .stage-divider {
    background-color: rgba(191, 219, 254, 0.6); /* blue-200/60 */
}
[data-bs-theme="dark"] .stage-middle .stage-divider {
    background-color: rgba(29, 78, 216, 0.4); /* blue-700/40 */
}

/* Secondary Divider (Purple) */
.stage-secondary .stage-divider {
    background-color: rgba(233, 213, 255, 0.6); /* purple-200/60 */
}
[data-bs-theme="dark"] .stage-secondary .stage-divider {
    background-color: rgba(88, 28, 135, 0.4); /* purple-700/40 */
}

/* Distance Divider (Indigo) */
.stage-distance .stage-divider {
    background-color: rgba(199, 210, 254, 0.6); /* indigo-200/60 */
}
[data-bs-theme="dark"] .stage-distance .stage-divider {
    background-color: rgba(67, 56, 202, 0.4); /* indigo-700/40 */
}

/* Other Divider (Gray) */
.stage-other .stage-divider {
    background-color: rgba(226, 232, 240, 0.6); 
}
[data-bs-theme="dark"] .stage-other .stage-divider {
    background-color: rgba(51, 65, 85, 0.4); 
}

.stage-header {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    gap: 0.85rem;
}

.stage-header h3 {
    font-size: 1.15rem;
    margin-bottom: 0.15rem !important;
}

.stage-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff !important;
    border: 1px solid rgba(0,0,0,0.05);
}

.stage-icon svg {
    width: 22px !important;
    height: 22px !important;
}

/* Stage Themes */
.stage-primary { 
    background: #ebfaf2; 
    border-color: #c3f2d9; 
}
[data-bs-theme="dark"] .stage-primary {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}
.stage-primary h3 { color: #1a202c; }
[data-bs-theme="dark"] .stage-primary h3 { color: #f8fafc; }
.stage-primary .stage-icon { color: #10b981; }
.stage-primary .level-circle { background: #ebfaf2; color: #10b981; border-color: transparent; }
[data-bs-theme="dark"] .stage-primary .level-circle { background: rgba(16, 185, 129, 0.1); }

.stage-middle { 
    background: #eff6ff; 
    border-color: #dbeafe; 
}
[data-bs-theme="dark"] .stage-middle {
    background: rgba(59, 130, 246, 0.05);
    border-color: rgba(59, 130, 246, 0.2);
}
.stage-middle h3 { color: #1a202c; }
[data-bs-theme="dark"] .stage-middle h3 { color: #f8fafc; }
.stage-middle .stage-icon { color: #3b82f6; }
.stage-middle .level-circle { background: #eff6ff; color: #3b82f6; border-color: transparent; }
[data-bs-theme="dark"] .stage-middle .level-circle { background: rgba(59, 130, 246, 0.1); }

.stage-secondary { 
    background: #faf5ff; 
    border-color: #f3e8ff; 
}
[data-bs-theme="dark"] .stage-secondary {
    background: rgba(168, 85, 247, 0.05);
    border-color: rgba(168, 85, 247, 0.2);
}
.stage-secondary h3 { color: #1a202c; }
[data-bs-theme="dark"] .stage-secondary h3 { color: #f8fafc; }
.stage-secondary .stage-icon { color: #a855f7; }
.stage-secondary .level-circle { background: #faf5ff; color: #a855f7; border-color: transparent; }
[data-bs-theme="dark"] .stage-secondary .level-circle { background: rgba(168, 85, 247, 0.1); }

.stage-distance { 
    background: #eef2ff; 
    border-color: #e0e7ff; 
}
[data-bs-theme="dark"] .stage-distance {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.3);
}
.stage-distance h3 { color: #1a202c; }
[data-bs-theme="dark"] .stage-distance h3 { color: #f8fafc; }
.stage-distance .stage-icon { color: #4f46e5; }
.stage-distance .level-circle { background: #eef2ff; color: #4f46e5; border-color: transparent; }
[data-bs-theme="dark"] .stage-distance .level-circle { background: rgba(79, 70, 229, 0.1); }

.stage-other { 
    background: #f8fafc; 
    border-color: #e2e8f0; 
}
[data-bs-theme="dark"] .stage-other {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
}
.stage-other h3 { color: #1a202c; }
[data-bs-theme="dark"] .stage-other h3 { color: #f8fafc; }
.stage-other .stage-icon { color: #64748b; }
.stage-other .level-circle { background: #f8fafc; color: #64748b; border-color: transparent; }
[data-bs-theme="dark"] .stage-other .level-circle { background: rgba(148, 163, 184, 0.1); }

.level-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: #fff;
    border-radius: 14px;
    text-decoration: none;
    color: #1a202c;
    font-weight: 500;
    margin-bottom: 0.65rem;
    transition: all 0.2s;
    border: 1px solid rgba(0,0,0,0.03);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .level-item {
    background: var(--card-bg);
    border-color: var(--card-border);
    color: var(--text-main);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.level-item:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    color: #1a202c;
}

[data-bs-theme="dark"] .level-item:hover {
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

.level-item span.fs-6 {
    font-size: 0.85rem !important;
}

.level-circle {
    width: 28px;
    height: 28px;
    border-radius: 8px; /* rounded-lg */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 500;
}

.stage-badge {
    background: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.05);
}

[data-bs-theme="dark"] .stage-badge {
    background: var(--bg-light);
    border-color: var(--sidebar-border);
}

.stage-badge svg {
    width: 12px !important;
    height: 12px !important;
}

.stage-primary .stage-badge { color: #38a169; }
.stage-middle .stage-badge { color: #3182ce; }
.stage-secondary .stage-badge { color: #805ad5; }
.stage-distance .stage-badge { color: #4f46e5; }
.stage-other .stage-badge { color: #64748b; }

.level-badge {
    padding: 0px 8px;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.75;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-soon {
    background-color: #f1f5f9; /* bg-slate-100 */
    color: #64748b; /* text-slate-500 approx */
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-bs-theme="dark"] .badge-soon {
    background-color: #1e293b; /* bg-slate-800 */
    color: #94a3b8;
}

[data-bs-theme="dark"] .stage-primary .level-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

[data-bs-theme="dark"] .stage-middle .level-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

[data-bs-theme="dark"] .stage-secondary .level-badge {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

[data-bs-theme="dark"] .stage-other .level-badge {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

[data-bs-theme="dark"] .stage-distance .level-badge {
    background: rgba(79, 70, 229, 0.15);
    color: #818cf8;
}

.stage-primary .level-badge {
    background: #d1fae5;
    color: #065f46;
}

.stage-middle .level-badge {
    background: #dbeafe;
    color: #1e40af;
}

.stage-secondary .level-badge {
    background: #f3e8ff;
    color: #6b21a8;
}

.stage-distance .level-badge {
    background: #e0e7ff;
    color: #3730a3;
}

.stage-other .level-badge {
    background: #f1f5f9;
    color: #475569;
}

/* Subject Cards */
.subject-card {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-decoration: none !important;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.05);
    border-color: var(--bs-primary) !important;
}

.subject-icon-box {
    width: 64px;
    height: 64px;
    background: var(--bg-light);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-primary) !important;
    transition: all 0.3s;
}

.subject-icon-box svg {
    width: 28px !important;
    height: 28px !important;
}

.subject-card:hover .subject-icon-box { transform: scale(1.05); }

.subject-name {
    font-weight: 500;
    color: var(--text-main);
    margin: 0;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.subject-card:hover .subject-name {
    color: var(--bs-primary) !important;
}

/* Sujet Items */
.sujet-item {
}

.sujet-info { display: flex; align-items: center; gap: 1rem; }

.sujet-icon {
    width: 44px;
    height: 44px;
    background: rgba(37, 99, 235, 0.05);
    color: var(--bs-primary) !important;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sujet-icon svg {
    width: 20px !important;
    height: 20px !important;
}

[data-bs-theme="dark"] .sujet-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.sujet-title { font-weight: 500; color: var(--text-main); font-size: 1rem; }
.sujet-meta { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.sujet-action { color: var(--bs-primary) !important; font-size: 1.25rem; opacity: 0.5; transition: all 0.2s; }
.sujet-item:hover .sujet-action { opacity: 1; transform: scale(1.1); }

/* ==========================================================================
   7. Appearance & Themes
   ========================================================================== */
.lang-switcher {
    display: flex;
    background: var(--bg-light);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--sidebar-border);
}

.lang-btn {
    flex: 1;
    padding: 8px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--sidebar-bg);
    color: var(--text-main);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.appearance-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
}

.appearance-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.theme-toggle-pill {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.3s;
}

[data-bs-theme="dark"] .theme-toggle-pill {
    background: #1e293b;
}

.theme-icon-box {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1.2);
    color: #64748b;
    position: relative;
}

.theme-icon-box i,
.theme-icon-box svg {
    width: 12px !important;
    height: 12px !important;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Light mode animations */
[data-bs-theme="light"] .sun-box {
    background: white;
    color: #f59e0b;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transform: scale(1.1);
}

[data-bs-theme="light"] .sun-box i,
[data-bs-theme="light"] .sun-box svg {
    transform: rotate(360deg);
}

/* Dark mode animations */
[data-bs-theme="dark"] .moon-box {
    background: #334155;
    color: #818cf8;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transform: scale(1.1);
}

[data-bs-theme="dark"] .moon-box i,
[data-bs-theme="dark"] .moon-box svg {
    transform: rotate(-15deg);
}

.theme-toggle-pill {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Active icon styles */
[data-bs-theme="light"] .icon-sun {
    color: #f59e0b !important;
}

[data-bs-theme="dark"] .icon-moon {
    color: #4f46e5 !important;
}

[data-bs-theme="dark"] .switch-thumb {
    background: white;
}

/* ==========================================================================
   8. Utilities & Helpers
   ========================================================================== */
.bg-card { background: var(--card-bg) !important; }
.text-main { color: var(--text-main) !important; }
.bg-primary-subtle { background-color: #eff6ff !important; }
[data-bs-theme="dark"] .bg-primary-subtle { background-color: rgba(37, 99, 235, 0.1) !important; }
.bg-success-subtle { background-color: #ecfdf5 !important; }
[data-bs-theme="dark"] .bg-success-subtle { background-color: rgba(16, 185, 129, 0.1) !important; }
.text-primary { color: var(--bs-primary) !important !important; }
.border-primary-subtle { border-color: #dbeafe !important; }
[data-bs-theme="dark"] .border-primary-subtle { border-color: rgba(37, 99, 235, 0.2) !important; }
.bg-secondary-subtle { background-color: #f1f5f9 !important; }
[data-bs-theme="dark"] .bg-secondary-subtle { background-color: rgba(100, 116, 139, 0.1) !important; }
.text-secondary { color: #64748b !important; }
.border-secondary-subtle { border-color: #e2e8f0 !important; }
[data-bs-theme="dark"] .border-secondary-subtle { border-color: rgba(100, 116, 139, 0.2) !important; }
.btn-primary { background-color: var(--bs-primary) !important; border-color: var(--bs-primary) !important; }
.btn-primary:hover { background-color: #1d4ed8; border-color: #1d4ed8; }

/* Search Bar */
.search-container { flex-grow: 1; max-width: 400px; margin-inline-end: auto; }
.search-input-group { position: relative; }
.search-input {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    padding-inline-start: 2.75rem;
    width: 100%;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text-main);
}
.search-input:focus { outline: none; border-color: var(--bs-primary) !important; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.search-icon { position: absolute; top: 50%; inset-inline-start: 1rem; transform: translateY(-50%); color: var(--text-muted); }
.search-icon svg { width: 18px !important; height: 18px !important; }

/* ==========================================================================
   9. Responsive Styles
   ========================================================================== */
@media (max-width: 991.98px) {
    .sidebar {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    [dir="ltr"] .sidebar { transform: translateX(-100%); }
    :lang(ar) .sidebar,
    :lang(ar-u-nu-latn) .sidebar { transform: translateX(100%); }
    
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-inline-start: 0; }
    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 999;
        backdrop-filter: blur(4px);
    }
    .mobile-overlay.show { display: block; }
    .content-header { padding: 0 1rem; inset-inline-start: 0; }
    .search-container { max-width: none; }
}

.main-content {
    margin-inline-start: var(--sidebar-width);
    padding-top: 70px;
    min-height: 100vh;
    background: var(--bg-light);
    transition: margin 0.3s, background-color 0.3s;
    display: flex;
    flex-direction: column;
}

/* Footer */
.site-footer {
    background: var(--sidebar-bg);
    border-top: 1px solid var(--sidebar-border);
    padding: 4rem 0 2rem;
    margin-top: 5rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    margin-bottom: 1.5rem;
}

.footer-logo {
    width: 36px;
    height: 36px;
    background: var(--bs-primary) !important;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.footer-title {
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--bs-primary) !important;
}
[dir="ltr"] .footer-links a:hover { transform: translateX(5px); }
:lang(ar) .footer-links a:hover,
:lang(ar-u-nu-latn) .footer-links a:hover { transform: translateX(-5px); }

.social-links {
    display: flex;
    gap: 1rem;
}

.social-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-light);
    border: 1px solid var(--sidebar-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.social-btn:hover {
    background: var(--bs-primary) !important;
    color: #fff;
    border-color: var(--bs-primary) !important;
    transform: translateY(-3px);
}

.footer-bottom {
    padding-top: 2rem;
    margin-top: 3rem;
    border-top: 1px solid var(--sidebar-border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

/* ==========================================================================
   10. Extra Utilities & Components
   ========================================================================== */
.bg-light-box {
    background: var(--bg-light);
    border-radius: 1.25rem;
    padding: 1.25rem;
    border: 1px solid var(--sidebar-border);
}

.btn svg {
    width: 20px !important;
    height: 20px !important;
}

.bg-card-box {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-card-box svg {
    width: 22px !important;
    height: 22px !important;
}

.doc-preview-wrapper {
    background: var(--bg-light);
    border-radius: 2rem;
    padding: 3rem;
    display: inline-block;
    position: relative;
}

/* ========================================================================== */
/* DARK MODE - Complete Theme */
/* ========================================================================== */
[data-bs-theme="dark"] input,
[data-bs-theme="dark"] textarea,
[data-bs-theme="dark"] select,
[data-bs-theme="dark"] .form-control {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] input::placeholder,
[data-bs-theme="dark"] textarea::placeholder {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .form-control:focus {
    background: #334155 !important;
    color: #f8fafc !important;
    border-color: var(--bs-primary) !important !important;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25) !important;
}

[data-bs-theme="dark"] table {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] table th {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] table td {
    background: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] table tbody tr:hover td {
    background: #1e293b !important;
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-body {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .btn-light,
[data-bs-theme="dark"] .btn-outline-light {
    background: #334155 !important;
    color: #f8fafc !important;
    border-color: #4b5563 !important;
}

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

[data-bs-theme="dark"] .badge-light,
[data-bs-theme="dark"] .bg-light {
    background: #1e293b !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .breadcrumb {
    background: #0f172a !important;
}

[data-bs-theme="dark"] .breadcrumb-item {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .breadcrumb-item.active {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .dropdown-menu {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .navbar,
[data-bs-theme="dark"] .navbar-light {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .navbar-light .navbar-brand,
[data-bs-theme="dark"] .navbar-light .navbar-text {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .navbar-light .navbar-nav .nav-link {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .navbar-light .navbar-nav .nav-link:hover,
[data-bs-theme="dark"] .navbar-light .navbar-nav .nav-link.active {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .pagination {
    background: transparent !important;
}

[data-bs-theme="dark"] .page-link {
    background: #334155 !important;
    color: #94a3b8 !important;
    border-color: #4b5563 !important;
}

[data-bs-theme="dark"] .page-link:hover {
    background: #475569 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .page-link.active {
    background: var(--bs-primary) !important !important;
    border-color: var(--bs-primary) !important !important;
}

[data-bs-theme="dark"] .list-group-item {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .list-group-item.active {
    background: var(--bs-primary) !important !important;
    border-color: var(--bs-primary) !important !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .list-group-item:hover {
    background: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .accordion-button {
    background: #1e293b !important;
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .accordion-button:focus {
    border-color: var(--bs-primary) !important !important;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25) !important;
}

[data-bs-theme="dark"] .accordion-body {
    background: #0f172a !important;
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .tabs-container,
[data-bs-theme="dark"] .tab-content {
    background: #0f172a !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .custom-tabs-wrapper {
    background: #1e293b !important;
    border-color: #334155 !important;
}
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    border: 1px solid var(--card-border);
}

.pdf-icon-large {
    font-size: 6rem;
    filter: drop-shadow(0 10px 15px rgba(220, 38, 38, 0.2));
}

.info-note-box {
    background: var(--bg-light);
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.info-note-box svg {
    width: 22px !important;
    height: 22px !important;
}

.empty-state-box {
    text-align: center;
    padding: 5rem 2rem;
    border-radius: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.empty-state-icon {
    font-size: 3.5rem;
    color: var(--text-muted);
    opacity: 0.3;
    margin-bottom: 1.5rem;
    display: block;
}

.empty-state-icon svg {
    width: 3.5rem !important;
    height: 3.5rem !important;
}

.stage-badge svg {
    width: 12px !important;
    height: 12px !important;
}

.compact-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    opacity: 0.6;
}

.compact-empty-state i {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: block;
}

.subject-icon-img {
    height: 32px;
    width: 32px;
    object-fit: contain;
}

.rounded-start-10 {
    border-start-start-radius: 10px !important;
    border-end-start-radius: 10px !important;
}

.rounded-end-10 {
    border-start-end-radius: 10px !important;
    border-end-end-radius: 10px !important;
}

/* --- 11. Related Sujets Section --- */
.related-sujets-container {
    background: #fff;
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.related-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fff;
    cursor: pointer;
    border-bottom: 1px solid #f0f3f7;
    user-select: none;
}

.related-header .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.related-header .header-icon {
    width: 20px;
    height: 20px;
    color: #4a5d73;
}

.related-header .header-text {
    font-weight: 500;
    font-size: 1.1rem;
    color: #2d3748;
}

.related-header .header-badge {
    background: #e2e8f0;
    color: #4a5568;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.related-header .toggle-icon {
    width: 20px;
    height: 20px;
    color: #a0aec0;
    transition: transform 0.3s ease;
}

.related-header.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.related-body {
    max-height: 450px;
    overflow-y: auto;
    transition: max-height 0.3s ease-in-out;
}

.related-body.collapsed {
    max-height: 0;
}

.related-item-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: #2d3748;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    gap: 12px;
    background: #fff;
    position: relative;
}

.related-item-new:hover {
    background-color: #f8fafc;
}

.related-item-new.active {
    background-color: #f0f7ff;
    border-right: 4px solid var(--bs-primary) !important;
}

.related-item-new.active .item-title-text {
    color: var(--bs-primary) !important;
}

.item-right-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    order: 1;
}

.file-icon-wrapper-new {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    flex-shrink: 0;
}

.related-item-new.active .file-icon-wrapper-new {
    background: #dbeafe;
    color: var(--bs-primary) !important;
}

.item-title-text {
    flex: 1;
    text-align: right;
    font-weight: 500;
    font-size: 0.95rem;
    color: inherit;
    line-height: 1.5;
}

.item-left-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    order: 2;
}

.eye-view-icon-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    transition: all 0.2s ease;
}

.related-item-new:hover .eye-view-icon-small {
    background: #e2e8f0;
    color: #4a5568;
}

.related-item-new.active .eye-view-icon-small {
    background: #ebf8ff;
    color: #3182ce;
}

.eye-view-icon-small svg {
    width: 16px;
    height: 16px;
}

.badge-year-pill {
    background: #f1f5f9;
    color: #64748b;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

.badge-solution-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-solution-pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-solution-pill.with {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #dcfce7;
}

.badge-solution-pill.with .dot {
    background: #16a34a;
}

.badge-solution-pill.without {
    background: #fff5f5;
    color: #e53e3e;
    border: 1px solid #fed7d7;
}

.badge-solution-pill.without .dot {
    background: #e53e3e;
}

