/* ============================================================
   MADHAB COLOR VARIABLES
   ============================================================ */
:root {
    --madhab-hanafi: #2f6f4f;
    --madhab-maliki: #3b6ea5;
    --madhab-shafi_i: #b8860b;
    --madhab-hanbali: #a84438;
}

[data-bs-theme="dark"] {
    --madhab-hanafi: #4caf7d;
    --madhab-maliki: #6fa8dc;
    --madhab-shafi_i: #d4a017;
    --madhab-hanbali: #d16a5a;
}

/* ============================================================
   IMAM CARDS (Scholars Index Page)
   ============================================================ */
.imam-divider {
    width: 60px;
    border: none;
    border-top: 2px solid var(--madhab-hanafi);
    opacity: 0.6;
}

.imam-card {
    border-top: 3px solid var(--madhab-color) !important;
    transition: transform 0.15s ease;
}

.imam-card:hover {
    transform: translateY(-3px);
}

.arabic-hero {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--madhab-color);
}

.imam-badge {
    background-color: var(--madhab-color);
    color: #fff;
}

/* ============================================================
   SCHOLAR HERO (Individual Imam Page)
   ============================================================ */
.scholar-hero {
    background: var(--madhab-color); /* fallback for unsupported browsers */
    background: linear-gradient(
        135deg,
        var(--madhab-color),
        color-mix(in srgb, var(--madhab-color) 40%, #f5f0e6)
    );
    color: #fff;
    position: relative;
    overflow: hidden;
}

.scholar-hero::after {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.25),
        transparent 70%
    );
    pointer-events: none;
}

/* ============================================================
   TABS (Biography / Methodology / Quotes / etc.)
   ============================================================ */
.imam-tabs .nav-link {
    color: var(--text-muted, #6c757d);
    border: none;
    border-bottom: 2px solid transparent;
}

.imam-tabs .nav-link.active {
    background-color: color-mix(in srgb, var(--madhab-color) 10%, transparent);
    border-bottom: 2px solid var(--madhab-color);
    color: var(--madhab-color);
    font-weight: 600;
}

.tab-content > .tab-pane {
    padding-top: 0.5rem;
}

.tab-content .card + .card {
    margin-top: 1rem;
}

/* ============================================================
   GENERAL CARD STYLING
   ============================================================ */
.card.border-0.shadow-sm {
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
    transition: box-shadow 0.2s ease;
}

.card.border-0.shadow-sm:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07) !important;
}

.card h5.fw-bold,
.card h6.fw-bold {
    font-family: var(--font-body, inherit);
    letter-spacing: 0.02em;
}

/* ============================================================
   ARABIC TEXT
   ============================================================ */
.arabic {
    font-family: var(--font-arabic, "Amiri", "Scheherazade New", serif);
    line-height: 1.9;
    color: var(--madhab-color, inherit);
}

/* ============================================================
   QUOTES TAB
   ============================================================ */
.blockquote p.arabic {
    line-height: 2.1;
}

.blockquote-footer cite {
    font-size: 0.85rem;
    opacity: 0.75;
}

.quote-card {
    border-radius: 0.75rem;
    border-left: 5px solid var(--madhab-color, #ccc) !important;
    background: color-mix(in srgb, var(--madhab-color, #ccc) 4%, #fff);
}

.quote-card .arabic {
    line-height: 2.1;
    font-size: 1.25rem;
}

.quote-card .blockquote-footer cite {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ============================================================
   TRIALS & TESTS TAB
   ============================================================ */
.trials-card {
    border-radius: 0.75rem;
    border-left: 4px solid #b8860b !important;
    background: color-mix(in srgb, #b8860b 5%, transparent);
}

.trials-card h5 {
    color: #8a6914;
}

/* ============================================================
   LIST ITEMS (Students / Works)
   ============================================================ */
.list-group-item {
    transition: background-color 0.15s ease;
}

.list-group-item:hover {
    background-color: color-mix(
        in srgb,
        var(--madhab-color, #ccc) 5%,
        transparent
    );
}

.student-item {
    border-radius: 0.6rem;
    transition: background-color 0.15s ease;
}

.student-item:hover {
    background-color: color-mix(
        in srgb,
        var(--madhab-color, #ccc) 6%,
        transparent
    );
}

.student-item .arabic {
    font-size: 1.5rem;
    opacity: 0.85;
}

.work-card {
    border-radius: 0.6rem;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.03) !important;
}

.work-card h6 {
    color: var(--madhab-color, inherit);
}

.work-card .arabic {
    font-size: 1.5rem;
}

/* ============================================================
   BIOGRAPHY / METHODOLOGY / TEACHING CARDS
   ============================================================ */
.biography-card {
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

.biography-card hr {
    border-top: 1px solid var(--madhab-color, #ccc);
    opacity: 0.2;
}

.biography-card h5 {
    color: var(--madhab-color, inherit);
    font-size: 1.1rem;
}

.teaching-card {
    border-radius: 0.75rem;
    border-left: 3px solid var(--madhab-color, #ccc) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    transition: transform 0.15s ease;
}

.teaching-card:hover {
    transform: translateX(3px);
}

.teaching-card .card-title {
    font-size: 1rem;
    color: var(--madhab-color, inherit);
}

/* ============================================================
   SIDEBAR LAYOUT (Scholars Wrapper — Flexbox)
   ============================================================ */
.scholars-wrapper {
    display: flex;
    align-items: stretch;
}

.scholars-sidebar {
    flex: 0 0 260px;
    background: var(--emerald-dark);
    border-right: 1px solid rgba(201, 150, 58, 0.2);
}

.scholars-sidebar-inner {
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 2rem 0;
}

.scholars-sidebar-inner::-webkit-scrollbar {
    width: 4px;
}

.scholars-sidebar-inner::-webkit-scrollbar-thumb {
    background: var(--gold-dark);
    border-radius: 2px;
}

.sidebar-section-label {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(201, 150, 58, 0.6);
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
    margin-top: 1.5rem;
}

.sidebar-section-label:first-child {
    margin-top: 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-body);
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
    color: var(--gold-light);
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--gold-dark);
}

.sidebar-nav-link.active {
    color: var(--gold-light);
    background: rgba(201, 150, 58, 0.08);
    border-left-color: var(--gold);
    font-weight: 500;
}

.sidebar-nav-link .arabic-sm {
    font-family: var(--font-arabic);
    font-size: 0.9rem;
    direction: rtl;
    color: rgba(201, 150, 58, 0.7);
    line-height: 1;
}

.sidebar-madhab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    min-width: 8px;
}

.dot-hanafi {
    background: #5ac98a;
}

.dot-maliki {
    background: #60a5fa;
}

.dot-shafi_i {
    background: #f59e0b;
}

.dot-hanbali {
    background: #f87171;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid rgba(201, 150, 58, 0.15);
    margin: 1rem 1.5rem;
}

.scholars-main {
    flex: 1 1 0;
    padding: 2.5rem;
    background: var(--cream);
    min-width: 0;
}

.scholars-topbar {
    background: var(--cream-dark);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--muted);
    font-family: var(--font-body);
}

.scholars-topbar a {
    color: var(--emerald);
    text-decoration: none;
}

.scholars-topbar a:hover {
    color: var(--gold-dark);
}

.scholars-topbar .separator {
    color: var(--border);
}

/* ============================================================
   RESPONSIVE — Mobile: sidebar collapses to off-canvas
   ============================================================ */
@media (max-width: 992px) {
    .scholars-wrapper {
        flex-direction: column;
    }

    .scholars-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 1050;
    }

    .scholars-sidebar.open {
        display: block;
    }

    .scholars-main {
        padding: 1.5rem 1rem;
    }

    .scholars-topbar {
        padding: 0.6rem 1rem;
    }
}
