/* =========================================
   Wiki Premium - Modern Encyclopedia Design
   ========================================= */

:root {
    --wiki-font-display: 'Merriweather', serif;
    --wiki-font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --wiki-bg: #ffffff;
    --wiki-text: #2c3e50;
    --wiki-link: #2563eb;
    --wiki-border: #e2e8f0;
    --wiki-accent: #f8fafc;
    --wiki-danger: #ef4444;
    --wiki-success: #10b981;
    --wiki-warning: #f59e0b;
}

/* Scoped to .wiki-wrapper to strictly avoid affecting other pages */
.wiki-wrapper {
    font-family: var(--wiki-font-body);
    color: var(--wiki-text);
    line-height: 1.8;
    background-color: var(--wiki-bg);
}

/* --- Layout --- */
.wiki-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.wiki-body-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    align-items: start;
}

@media (max-width: 960px) {
    .wiki-body-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* --- Typography --- */
.wiki-main-col h1.page-title {
    font-family: var(--wiki-font-display);
    font-weight: 700;
    font-size: 2.5rem;
    color: #1a202c;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    border-bottom: none;
    /* Modern style removes bottom border from main title */
}

.wiki-wrapper h2 {
    font-family: var(--wiki-font-display);
    font-weight: 700;
    font-size: 1.75rem;
    color: #1a202c;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--wiki-border);
    padding-bottom: 0.5rem;
}

.wiki-wrapper h3 {
    font-family: var(--wiki-font-display);
    font-weight: 600;
    font-size: 1.25rem;
    color: #2d3748;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.wiki-wrapper p {
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    /* Readable premium size */
    color: #374151;
}

.wiki-wrapper a {
    color: var(--wiki-link);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
    border-bottom: 1px solid transparent;
}

.wiki-wrapper a:hover {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
}

/* --- Infobox (Premium Card) --- */
.wiki-infobox {
    background: #ffffff;
    border: 1px solid var(--wiki-border);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

/* --- Infobox (Premium Horizontal Bar) --- */
.wiki-infobox-horizontal {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.05);
    /* Modern soft shadow */
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.infobox-title {
    display: none;
}

.infobox-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 1.5rem;
    padding: 2rem;
    align-items: center;
}

/* Modern Stat Item */
.infobox-stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    /* Remove flex:1 since grid handles width */
    justify-content: flex-start;
    /* Align content left within cell */
    position: relative;
    border-right: 1px solid #f1f5f9;
    /* Border instead of psuedo */
}

/* Remove last border in row */
.infobox-stat-item:nth-child(3),
.infobox-stat-item:last-child {
    border-right: none;
}

/* Category Item (4th) - Force to next row, align left */
.infobox-stat-item:nth-child(4) {
    grid-column: 1 / 2;
    grid-row: 2;
    border-right: none;
    /* No border for single item in row start */
}

/* Engagement Widget (5th child usually) - Align to right or span rest */
.infobox-content>div:last-child {
    grid-column: 2 / 4;
    grid-row: 2;
    margin-top: 0 !important;
    justify-self: start;
    /* Align left to be close to category? Or right? User screenshot shows feedback on right */
    justify-self: end;
    text-align: right;
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

/* Mobile Responsive */
/* Mobile Responsive */
@media (max-width: 768px) {
    .infobox-content {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 0;
        /* Remove gap to let borders touch */
        padding: 1rem;
    }

    .infobox-stat-item {
        padding: 1rem 0.5rem;
        flex-direction: column;
        text-align: center;
        justify-content: flex-start;
        align-items: center;
        gap: 0.5rem;
        min-height: 110px;
    }

    /* Icon smaller on mobile */
    .stat-icon-wrapper {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        margin-bottom: 0;
    }

    .stat-content {
        align-items: center;
    }

    .stat-label {
        font-size: 0.65rem;
        margin-bottom: 0.1rem;
    }

    .stat-value {
        font-size: 0.9rem;
    }

    /* Borders for 2x2 Grid Effect */
    /* Item 1: Top Left */
    .infobox-stat-item:nth-child(1) {
        border-right: 1px solid #f1f5f9;
        border-bottom: 1px solid #f1f5f9;
    }

    /* Item 2: Top Right */
    .infobox-stat-item:nth-child(2) {
        border-bottom: 1px solid #f1f5f9;
        border-right: none;
    }

    /* Item 3: Bottom Left */
    .infobox-stat-item:nth-child(3) {
        border-right: 1px solid #f1f5f9;
        border-bottom: none;
    }

    /* Item 4: Bottom Right */
    .infobox-stat-item:nth-child(4) {
        grid-column: auto;
        /* Reset desktop forcing */
        grid-row: auto;
        border-right: none;
        border-bottom: none;
    }

    /* Engagement Widget */
    .infobox-content>div:last-child {
        grid-column: 1 / -1;
        /* Span full width */
        grid-row: auto;
        justify-self: center;
        justify-content: center;
        margin-top: 1rem !important;
        border-top: 1px solid #f1f5f9;
        padding-top: 1rem;
        width: 100%;
    }
}

/* Vertical Divider handled by border-right above */
/* .infobox-stat-item:not(:last-child)::after { ... } removed */

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.infobox-stat-item:hover .stat-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 0.2rem;
    font-family: var(--wiki-font-body);
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
    font-family: var(--wiki-font-body);
}

/* --- Table of Contents (Modern) --- */
.toc {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    border: 1px solid var(--wiki-border);
    display: inline-block;
    min-width: 250px;
}

.toc-title {
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    font-family: var(--wiki-font-display);
    color: #334155;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: #475569;
    display: block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.toc a:hover {
    background: #e2e8f0;
    color: #1e293b;
    border-bottom: none;
}

.toc-number {
    font-weight: 600;
    color: #94a3b8;
    margin-right: 0.5rem;
}

/* --- Sidebar Citations --- */
.citations-sidebar {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--wiki-border);
}

.citation-group {
    margin-bottom: 2rem;
}

.citation-title {
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--wiki-font-display);
    color: #334155;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.citation-list li {
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 3px solid #cbd5e1;
    font-size: 0.9rem;
    color: #475569;
}

.citation-text {
    font-style: italic;
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.citation-ref {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-align: right;
}

/* --- Categorized Views --- */
.categorized-views-container {
    margin: 3rem 0;
}

.view-category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .view-category-grid {
        grid-template-columns: 1fr;
    }
}

.view-category-card {
    background: #ffffff;
    border: 1px solid var(--wiki-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.view-category-card.traditional {
    border-top: 4px solid #d97706;
    /* Amber for Tradition */
}

.view-category-card.academic {
    border-top: 4px solid #2563eb;
    /* Blue for Academic */
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.category-header i {
    font-size: 1.25rem;
    color: #64748b;
}

.view-category-card.traditional .category-header i {
    color: #d97706;
}

.view-category-card.academic .category-header i {
    color: #2563eb;
}

.category-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #334155;
}

.view-item {
    margin-bottom: 1rem;
}

.view-item:last-child {
    margin-bottom: 0;
}

.scholar-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1e293b;
    margin-bottom: 0.2rem;
}

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

/* --- Video Cards --- */
.video-section {
    margin-top: 3rem;
    border-top: 1px solid var(--wiki-border);
    padding-top: 2rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.video-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--wiki-border);
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.video-thumbnail {
    position: relative;
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    border: 2px solid white;
}

.video-timestamp {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.video-info {
    padding: 1rem;
}

.video-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    line-height: 1.4;
}

.video-title a {
    color: #1e293b;
    text-decoration: none;
}

.video-title a:hover {
    color: #2563eb;
}

.video-summary {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.verse-box,
.hadith-box {
    position: relative;
    background: #ffffff;
    border-left: 4px solid var(--wiki-success);
    /* Green for Verse */
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    font-family: var(--wiki-font-display);
    font-size: 1.1rem;
    font-style: italic;
    color: #334155;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    border-radius: 0 8px 8px 0;
}

.hadith-box {
    border-left-color: #3b82f6;
    /* Blue for Hadith */
    background: #f8fafc;
}

.verse-box::before {
    content: "AYET";
    position: absolute;
    top: -10px;
    left: 10px;
    background: var(--wiki-success);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    font-style: normal;
    font-family: var(--wiki-font-body);
}

.hadith-box::before {
    content: "HADİS";
    position: absolute;
    top: -10px;
    left: 10px;
    background: #3b82f6;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    font-style: normal;
    font-family: var(--wiki-font-body);
}

/* --- References List --- */
.references-list {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #64748b;
    counter-reset: ref-counter;
    list-style: none;
    padding: 0;
}

.reference-item {
    counter-increment: ref-counter;
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.reference-item::before {
    content: "[" counter(ref-counter) "]";
    font-weight: 600;
    color: #94a3b8;
    min-width: 24px;
}

.reference-item a {
    color: #2563eb;
    font-weight: 600;
}

.reference-summary {
    color: #475569;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

.badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.badge.neutral {
    background: #f1f5f9;
    color: #475569;
}

/* --- Subtitle --- */
.site-sub {
    font-family: var(--wiki-font-body);
    font-size: 0.95rem !important;
    color: #64748b !important;
    margin-bottom: 2rem !important;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

/* --- Lead Paragraph --- */
.lead-paragraph {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #1e293b;
    margin-bottom: 2rem;
}

/* --- Related Topics List --- */
.related-topics-list {
    list-style-type: disc;
    margin-left: 1.5rem;
    color: #64748b;
}

.related-topics-list li {
    margin-bottom: 0.5rem;
}

/* --- Smart Fiqh Tooltip --- */
.fiqh-term {
    border-bottom: 2px dotted #94a3b8;
    cursor: help;
    position: relative;
    color: #334155;
    font-weight: 500;
}

.fiqh-term:hover {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.fiqh-term::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 400;
    width: 220px;
    text-align: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    line-height: 1.4;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 8px;
}

.fiqh-term::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    margin-bottom: -4px;
}

.fiqh-term:hover::after,
.fiqh-term:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Mobile tooltip adjustment */
@media (max-width: 600px) {
    .fiqh-term::after {
        width: 180px;
        left: 0;
        transform: none;
    }

    .fiqh-term::before {
        left: 10px;
        transform: none;
    }
}

/* =========================================
   Premium Footer Design (Wikipedia Inspired)
   ========================================= */

.footer-premium {
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 3rem 0;
    margin-top: 4rem;
    font-family: var(--wiki-font-body);
    font-size: 0.9rem;
    color: #475569;
}

.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-logo {
    font-family: var(--wiki-font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.footer-logo i {
    color: #d97706;
    /* Amber-600 */
}

.footer-desc {
    line-height: 1.6;
    max-width: 300px;
}

.footer-col h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-links a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #2563eb;
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid #e2e8f0;
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
}

.footer-disclaimer {
    max-width: 600px;
    line-height: 1.5;
    color: #94a3b8;
}

.footer-copyright {
    color: #1e293b;
    font-weight: 500;
}