/* 
  Darsgah.com Design System 
  Focus: Premium Urdu Typography & RTL Experience
*/

@font-face {
    font-family: 'Jameel Noori Nastaleeq';
    src: local('Jameel Noori Nastaleeq'),
        url('../fonts/JameelNooriNastaleeq.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Mehr_Nastaliq_Web';
    src: url('../fonts/Mehr_Nastaliq_Web v.2.0.woff') format('woff'),
         url('../fonts/Mehr_Nastaliq_Web v. 2.0.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'adwa-assalaf';
    src: url('../fonts/adwa-assalaf Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Noorehira';
    src: url('../fonts/Noorehira.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Irvin-Heading';
    src: url('../fonts/Irvin-Heading.woff2') format('woff2'),
         url('../fonts/Irvin-Heading.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'GAGALIN';
    src: url('../fonts/GAGALIN.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* --- Premium Custom Font Families (Editor & Article Pages) --- */
.ql-font-jameel-nastaleeq,
.font-jameel-nastaleeq,
span.ql-font-jameel-nastaleeq,
p.ql-font-jameel-nastaleeq,
div.ql-font-jameel-nastaleeq {
    font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif !important;
}
.ql-font-mehr-nastaleeq,
.font-mehr-nastaleeq,
span.ql-font-mehr-nastaleeq,
p.ql-font-mehr-nastaleeq,
div.ql-font-mehr-nastaleeq {
    font-family: 'Mehr_Nastaliq_Web', 'Noto Nastaliq Urdu', serif !important;
}
.ql-font-adwa-assalaf,
.font-adwa-assalaf,
span.ql-font-adwa-assalaf,
p.ql-font-adwa-assalaf,
div.ql-font-adwa-assalaf {
    font-family: 'adwa-assalaf', 'Amiri', serif !important;
}
.ql-font-amiri,
.font-amiri,
span.ql-font-amiri,
p.ql-font-amiri,
div.ql-font-amiri {
    font-family: 'Amiri', serif !important;
}
.ql-font-noorehira,
.font-noorehira,
span.ql-font-noorehira,
p.ql-font-noorehira,
div.ql-font-noorehira {
    font-family: 'Noorehira', 'Amiri', serif !important;
}
.ql-font-irvin-heading,
.font-irvin-heading,
span.ql-font-irvin-heading,
p.ql-font-irvin-heading,
div.ql-font-irvin-heading {
    font-family: 'Irvin-Heading', sans-serif !important;
}
.ql-font-gagalin,
.font-gagalin,
span.ql-font-gagalin,
p.ql-font-gagalin,
div.ql-font-gagalin {
    font-family: 'GAGALIN', sans-serif !important;
}


:root {
    /* Base Theme Variables (Light) */
    --bg-primary: #fdfcf8;
    --bg-secondary: #f9f6ef;
    --bg-card: #ffffff;
    --bg-header: #1a3a3a;
    --bg-header-secondary: #142e2e;
    --text-primary: #1a3a3a;
    --text-secondary: rgba(26, 58, 58, 0.8);
    --text-muted: rgba(26, 58, 58, 0.6);
    --text-on-dark: #fdfcf8;
    --accent: #c4a484;
    --accent-hover: #b39373;
    --accent-light: #e8d5b0;
    --border: #e5ddd0;
    --border-light: #f0ede6;
    --overlay: rgba(0, 0, 0, 0.5);

    --color-primary: #1a3a3a;
    --color-accent: #c4a484;
    --font-primary: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-premium: 0 20px 40px rgba(0, 0, 0, 0.08);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition: 0.3s ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1a1a1f;
    --bg-secondary: #222228;
    --bg-card: #2a2a32;
    --bg-header: #0f2a21;
    --bg-header-secondary: #0a1f18;
    --text-primary: #e8e4d8;
    --text-secondary: #c4bfb0;
    --text-muted: #9a9588;
    --text-on-dark: #e0d8c5;
    --accent: #d4a44a;
    --accent-hover: #e0b860;
    --accent-light: #3d3020;
    --border: #3a3830;
    --border-light: #333128;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.45);
    --tag-bg: #3a3025;
    --tag-text: #d4b878;
    --search-bg: #2a2a32;
    --input-bg: #222228;
    --card-hover-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    --divider: #3a3830;
    --overlay: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .dual-calendar {
    color: var(--accent-light) !important;
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .dual-calendar span {
    color: var(--accent-light) !important;
}

/* Sepia Theme */
[data-theme="sepia"] {
    --bg-primary: #f4ecd8;
    --bg-secondary: #ede3cc;
    --bg-card: #faf5e8;
    --bg-header: #5c3d1a;
    --bg-header-secondary: #3d2510;
    --text-primary: #3d2b14;
    --text-secondary: #5c4428;
    --text-muted: #7a6240;
    --text-on-dark: #f0e0c5;
    --accent: #8b5e2f;
    --accent-hover: #a0703a;
    --accent-light: #e8d5b0;
    --border: #d4c5a8;
    --border-light: #e2d6bf;
    --tag-bg: #e8d5b5;
    --tag-text: #5c3d1a;
    --search-bg: #faf5e8;
    --input-bg: #f4ecd8;
    --card-hover-shadow: 0 12px 32px rgba(60, 30, 10, 0.16);
    --divider: #d4c5a8;
    --overlay: rgba(40, 20, 5, 0.55);
    --bookmark-color: #8b5e2f;
    --bookmark-active: #a0703a;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: var(--line-height-urdu);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    transition: background-color 0.35s ease, color 0.35s ease;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Page Loading Progress Bar */
#page-progress {
    position: fixed;
    top: 0;
    right: 0;
    height: 4px;
    background: var(--accent);
    z-index: 2001;
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px var(--accent);
}

#progress-text {
    position: fixed;
    top: 10px;
    left: 20px;
    font-size: 0.8rem;
    color: var(--accent);
    z-index: 2001;
    font-weight: bold;
    display: none;
    /* Only show if needed */
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.4;
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
}

h3 {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
}

p {
    font-size: clamp(1.1rem, 1.5vw, 1.25rem);
    margin-bottom: 1.5rem;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Base Styles --- */

/* Mobile Menu & Overlay */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-card);
    z-index: 2002;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.mobile-menu a:hover {
    color: var(--accent);
}

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 2001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Article Grid */
.article-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2.5rem;
    padding: 3rem 0;
}

/* Ensure cards in horizontal scrolls have fixed width */
.rtl-scroll-container .article-card {
    min-width: 280px;
    max-width: 280px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .article-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .article-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.article-card {
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    transition: all 0.4s ease;
    border: none;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.article-card:hover {
    transform: none;
    box-shadow: none;
}

.article-image-wrap {
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 1.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
}

.article-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-card:hover .article-image {
    transform: scale(1.05);
}

.article-content {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-meta-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.article-tag {
    background: rgba(196, 164, 132, 0.1);
    color: var(--accent);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.read-time-meta {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(0, 0, 0, 0.4);
}

.article-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.article-card:hover .article-title {
    color: var(--accent);
}

/* Post/Article Title Styling & Hover Theme matching */
.recent-card h4,
.recent-content h4,
.article-card-compact h3 {
    color: var(--text-primary) !important;
    transition: color 0.3s ease;
}

.recent-card:hover h4,
.recent-card:hover .recent-content h4,
.article-card-compact:hover h3 {
    color: var(--accent) !important;
}

.featured-slide a h2 {
    color: var(--text-primary) !important;
    transition: color 0.3s ease;
}

.featured-slide a:hover h2,
.featured-slide:hover a h2 {
    color: var(--accent) !important;
}

.article-excerpt {
    font-size: 0.875rem;
    color: rgba(0, 0, 0, 0.5);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--divider);
    padding-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.bookmark-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color var(--transition);
}

.bookmark-btn.active {
    color: var(--accent);
}

/* Footer */
.site-footer {
    background: var(--bg-header);
    color: var(--text-on-dark);
    padding: 5rem 0 2rem;
    margin-top: 5rem;
    position: relative;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), transparent, var(--accent));
}

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

@media (max-width: 768px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }

    .footer-brand .social-links {
        justify-content: center;
    }
}

.footer-logo {
    width: 100px;
    height: auto;
    margin-bottom: 1rem;
    filter: brightness(0) invert(1);
    /* Make it white/accessible on dark footer */
}

.footer-links h4 {
    margin-bottom: 1.5rem;
    color: var(--accent);
    font-size: 1.25rem;
    position: relative;
    display: inline-block;
}

.footer-links h4::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 30px;
    height: 2px;
    background: var(--accent);
}

.footer-links ul {
    list-style: none;
}

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

.footer-links a {
    color: var(--text-on-dark);
    text-decoration: none;
    opacity: 0.7;
    transition: all var(--transition);
    display: inline-block;
}

.footer-links a:hover {
    opacity: 1;
    color: var(--accent-light);
    transform: translateX(-5px);
}

/* Slider Section */
.slider-section {
    position: relative;
    height: 420px;
    overflow: hidden;
}

.slider-container {
    height: 100%;
}

.slide {
    height: 100%;
    background-size: cover;
    background-position: center;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    position: relative;
    transition: opacity 1s ease-in-out;
    opacity: 0;
}

.slide.active {
    display: flex;
    opacity: 1;
}

.slider-controls {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 2rem;
    transform: translateY(-50%);
    z-index: 10;
}

.slider-controls button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.slider-controls button:hover {
    background: var(--accent);
}

.slide-content {
    max-width: 800px;
    z-index: 2;
    animation: fadeInUp 0.8s ease;
}

.slide-tag {
    background: var(--accent);
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-xl);
    font-size: 1rem;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.btn-premium {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: var(--radius-xl);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 2rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.btn-premium:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    background: var(--accent-hover);
}

/* Featured Post */
.featured-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

@media (max-width: 992px) {
    .featured-card {
        grid-template-columns: 1fr;
    }

    .featured-image {
        height: 300px;
    }
}

.featured-image {
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.featured-card:hover .featured-image {
    transform: scale(1.05);
}

.featured-info {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-meta {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Recent Posts Horizontal Scroll */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .slider-section {
        height: 350px;
    }

    .slide-content h1 {
        font-size: 1.8rem;
    }

    .slide-content p {
        font-size: 1rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .featured-info {
        padding: 1.5rem;
    }

    .featured-info h2 {
        font-size: 1.5rem;
    }

    .recent-card {
        min-width: 250px;
    }

    .recent-thumb {
        height: 140px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-meta {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .slider-section {
        height: 280px;
    }

    .slide-content {
        padding: 0 1rem;
    }

    .slide-content h1 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
        line-height: 1.4;
    }

    .slide-content p {
        font-size: 0.85rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 1rem;
    }

    .btn-premium {
        padding: 0.5rem 1.2rem;
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }

    .slide-tag {
        font-size: 0.75rem;
        padding: 0.3rem 1rem;
        margin-bottom: 0.75rem;
    }

    .slider-controls {
        padding: 0 0.25rem;
    }

    .slider-controls button {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }
}

.rtl-scroll-container {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0 2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.recent-scroll-container {
    display: flex;
    gap: 1.5rem;
    overflow-x: hidden;
    padding: 1rem 0 2rem;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
}

.recent-scroll-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.rtl-scroll-container::-webkit-scrollbar {
    height: 4px;
    display: block;
}

.rtl-scroll-container::-webkit-scrollbar-thumb {
    background: var(--accent-light);
    border-radius: 10px;
}

.recent-card,
.article-card-compact {
    min-width: 280px;
    max-width: 280px;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    border: none;
    flex-shrink: 0;
    cursor: pointer;
}

.recent-thumb {
    height: 170px;
    background-size: cover;
    background-position: center;
    border-radius: 1.25rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.recent-content {
    padding: 1.25rem;
}

.recent-content h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.recent-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Meta Section (Categories & Authors) */
.grid-meta {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

@media (max-width: 992px) {
    .grid-meta {
        grid-template-columns: 1fr;
    }
}

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

.cat-item {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.cat-item:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-3px);
}

/* Books Section */
.books-scroll-container {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding: 1.5rem 0 3rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.books-scroll-container::-webkit-scrollbar {
    height: 4px;
}

.books-scroll-container::-webkit-scrollbar-thumb {
    background: var(--accent-light);
    border-radius: 10px;
}

.book-card {
    min-width: 180px;
    max-width: 180px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.4s ease;
}

.book-cover-wrap {
    aspect-ratio: 2 / 3;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: all 0.4s ease;
}

.book-card:hover .book-cover-wrap {
    transform: translateY(-10px) rotate(-2deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
}

/* Premium Book Cover Overlays */
.book-category-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(196, 164, 132, 0.92); /* Elegant brand gold with transparency */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-weight: 700;
    z-index: 5;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    pointer-events: none;
    font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif !important;
}

.book-card:hover .book-category-tag {
    background: var(--accent);
    transform: scale(1.05);
}

.book-bookmark-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.book-bookmark-btn:hover {
    background: white;
    color: var(--accent);
    transform: scale(1.15);
}

.book-bookmark-btn.active {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
    box-shadow: 0 4px 12px rgba(196, 164, 132, 0.4) !important;
}

.book-bookmark-btn i {
    font-size: 0.85rem;
    pointer-events: none; /* Resolves event.target correctly on click */
}

/* Personal Library Tab Switchers in Bookmarks Modal */
.library-tabs-wrap {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
    padding-bottom: 0.25rem;
    width: 100%;
}

.library-tab-btn {
    flex: 1; /* Split row width equally */
    background: transparent;
    border: none;
    font-family: var(--font-primary);
    font-size: 1.05rem;
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center; /* Center icon and label horizontally */
    gap: 0.5rem;
}

.library-tab-btn:hover {
    color: var(--accent);
}

.library-tab-btn.active {
    color: var(--accent) !important;
    border-bottom-color: var(--accent) !important;
}

/* Personal Library Layout Overhaul */
.library-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.5rem 0;
    max-height: 55vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.library-list-container::-webkit-scrollbar {
    width: 6px;
}

.library-list-container::-webkit-scrollbar-thumb {
    background: var(--accent-light);
    border-radius: 10px;
}

.saved-library-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.2rem;
    padding: 0.85rem 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-sizing: border-box;
    width: 100%;
}

.saved-library-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(196, 164, 132, 0.08);
    border-color: var(--accent);
    background: var(--bg-card);
}

.btn-clear-library {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.45rem 1.2rem;
    border-radius: 100px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
    box-sizing: border-box;
}

.btn-clear-library:hover {
    background: #ff4d4d;
    color: white !important;
    border-color: #ff4d4d;
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.25);
}

.author-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--divider);
}

.author-mini-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid var(--accent-light);
}

/* Premium Responsive Author Cards Grid */
.author-cards-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
    align-items: start;
}

/* Tablet screens (max-width: 992px) */
@media (max-width: 992px) {
    .author-cards-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }
}

/* Mobile screens (max-width: 768px): show exactly 3 cards in a row (3 columns) */
@media (max-width: 768px) {
    .author-cards-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem;
        margin: 1rem 0;
    }
}

.author-card-new {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.author-card-new::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.author-card-new:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.author-card-new:hover::before {
    opacity: 1;
}

.author-card-new .author-avatar-new {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--accent);
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-light);
    margin-bottom: 0.5rem;
    transition: all 0.35s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.author-card-new:hover .author-avatar-new {
    border-color: var(--accent-light);
    background: var(--accent);
    color: white;
    transform: scale(1.05);
}

.author-card-new h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    margin-bottom: 0.25rem;
    transition: color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.author-card-new:hover h4 {
    color: var(--accent) !important;
}

.author-card-new span {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Infinite Scroll / All Articles */
.search-box-mini {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    padding: 0.4rem 1rem;
    border-radius: var(--radius-xl);
    gap: 0.75rem;
}

.search-box-mini input {
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-primary);
}

/* Center Loader Styles */
.loader-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loader-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.loader-dots span {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.3;
    animation: loaderDots 1.4s infinite ease-in-out both;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.1s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.2s;
}

@keyframes bounce {
    to {
        transform: translateY(-10px);
        opacity: 0.5;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    opacity: 0.6;
}

/* Utility Classes */
.urdu {
    font-family: var(--font-primary);
}

.text-accent {
    color: var(--accent);
}

.mt-2 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

/* Bookmarks Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(8px);
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 800px;
    max-height: 80vh;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    position: relative;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    animation: zoomIn 0.3s ease;
}

#bookmarks-list {
    grid-template-columns: 1fr;
    /* Always 1 column in modal for better fit */
    gap: 1rem;
    padding: 1rem 0;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    background: var(--bg-secondary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
}

/* CMS Dashboard Styles */
:root {
    --sidebar-width: 280px;
}

.cms-layout {
    display: flex;
    background: var(--bg-secondary);
    min-height: 100vh;
}

.cms-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-header);
    color: white;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    position: sticky;
    top: 0;
}

.cms-brand {
    padding: 0 2rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 2rem;
}

.cms-nav {
    list-style: none;
    flex: 1;
}

.cms-nav-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
}

.cms-nav-item.active a,
.cms-nav-item a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-right: 4px solid var(--accent);
}

.cms-main {
    flex: 1;
    padding: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: var(--bg-secondary);
    color: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.cms-form-container {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: var(--font-primary);
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
}

/* CMS Dashboard Responsiveness */
@media (max-width: 992px) {
    .cms-layout {
        flex-direction: column;
    }

    .cms-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem 0;
    }

    .cms-nav {
        display: flex;
        overflow-x: auto;
        padding: 0 1rem;
    }

    .cms-nav-item a {
        padding: 0.75rem 1rem;
        white-space: nowrap;
        border-right: none !important;
        border-bottom: 2px solid transparent;
    }

    .cms-nav-item.active a {
        border-bottom: 2px solid var(--accent);
        background: transparent;
    }

    .cms-main {
        padding: 1.5rem;
    }

    .cms-brand {
        display: none;
    }
}

/* Global Responsive Refinements */
@media (max-width: 576px) {
    .container {
        padding: 0 1rem;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
        max-height: 90vh;
    }

    .cms-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Fix for small article grid on narrow screens */
@media (max-width: 400px) {
    .article-grid {
        grid-template-columns: 1fr;
    }
}

/* Categorical RTL Scroll Sections */
.rtl-scroll-container {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 2rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.5rem;
}

.rtl-scroll-container::-webkit-scrollbar {
    display: none;
}

.category-scroll-section {
    padding: 1.25rem 0;
}

.scroll-controls {
    display: flex;
    gap: 0.5rem;
}

.scroll-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.scroll-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.rtl-scroll-container .article-card {
    min-width: 280px;
    flex-shrink: 0;
}

.rtl-scroll-container .article-title {
    font-size: 1.15rem;
    line-height: 1.3;
}

.rtl-scroll-container .article-image {
    aspect-ratio: 16 / 8;
}

@media (max-width: 768px) {
    .rtl-scroll-container .article-card {
        min-width: 220px;
    }

    .rtl-scroll-container .article-title {
        font-size: 1rem;
    }
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    /* Left for RTL context, often stays left or moves right */
    width: 45px;
    height: 45px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

#back-to-top.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    background: var(--accent-hover);
    transform: translateY(-5px);
}

/* --- Slim Header & New Brand --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-main-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    height: 100%;
}

.header-start {
    justify-content: flex-start;
}

.header-center {
    justify-content: center;
}

.header-end {
    justify-content: flex-end;
}

.site-header.scrolled {
    height: 70px;
    background: var(--bg-primary) !important;
    opacity: 0.98;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .site-header.scrolled {
    background: var(--bg-primary) !important;
}

.logo-new-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.text-logo {
    font-size: 2.2rem;
    color: var(--text-primary);
    text-align: center;
    font-weight: 700;
}

.text-sublogo {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    opacity: 0.8;
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--text-muted);
}

.nav-links-new a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 0.5rem 0.5rem;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.nav-links-new a:hover,
.nav-links-new a.active {
    color: var(--accent);
    opacity: 1;
}

.icon-btn-minimal {
    padding: 0.5rem;
    transition: color var(--transition);
    color: var(--text-primary);
    cursor: pointer;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    opacity: 0.8;
}

.icon-btn-minimal:hover {
    color: var(--accent);
    opacity: 1;
}

.icon-btn-new {
    padding: 0.6rem;
    border-radius: 50%;
    transition: var(--transition);
    color: var(--text-primary);
    cursor: pointer;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn-new:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent);
}

.badge-new {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    padding: 0;
    font-family: var(--font-sans);
    transform: translate(25%, -25%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-light);
    width: 100%;
    margin-bottom: 0.75rem;
}

.stat-card h5 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.text-accent {
    color: #c4a484 !important;
}

/* --- New Hero Section --- */
.hero-new {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    padding: 120px 0 60px;
    background: var(--bg-primary);
    overflow: hidden;
}

.hero-new-inner {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 10;
}

@media (max-width: 992px) {
    .hero-new-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
    }
}

.hero-bg-overlay {
    position: absolute;
    inset: 0;
    background-image: url('https://images.unsplash.com/photo-1519791883288-dc8bd696e667?auto=format&fit=crop&q=80&w=2070');
    background-size: cover;
    opacity: 0.05;
    filter: grayscale(1);
}

.badge-new {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    background: rgba(196, 164, 132, 0.1);
    color: var(--color-accent);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    font-family: var(--font-sans);
    /* Latin font for English text */
    white-space: nowrap;
    /* prevent mid-word break */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .badge-new {
        font-size: 0.6rem;
        letter-spacing: 0.05em;
        padding: 0.2rem 0.6rem;
    }
}

@media (max-width: 420px) {
    .badge-new {
        font-size: 0.55rem;
        letter-spacing: 0.03em;
        padding: 0.15rem 0.5rem;
    }
}

.hero-title {
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: var(--color-primary);
    margin-bottom: 2rem;
}

.text-accent {
    color: var(--color-accent);
}

.hero-desc {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    max-width: 600px;
    margin-bottom: 3rem;
}

/* --- Smart Search Card --- */
.search-card-new {
    background: white;
    box-shadow: var(--shadow-premium);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 650px;
    margin-bottom: 2rem;
}

.search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.search-input-wrap input {
    width: 100%;
    border: none;
    outline: none;
    padding: 1rem;
    font-size: 1.1rem;
    background: transparent;
}

.btn-search-new {
    background: var(--color-primary);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-search-new:hover {
    background: #000;
}

.divider {
    width: 1px;
    height: 30px;
    background: rgba(0, 0, 0, 0.1);
}

/* --- Category Pill Grid --- */
.category-pill-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.category-card-new {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    padding: 1rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

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

.icon-wrap {
    width: 45px;
    height: 45px;
    background: rgba(196, 164, 132, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
    font-size: 1.2rem;
}

/* --- Article Cards with Read Time --- */
.card-badge-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.badge-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-accent);
    padding: 0.2rem 0.5rem;
    background: rgba(196, 164, 132, 0.1);
    border-radius: 4px;
}

.badge-read {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.4);
}

.hero-new .grid-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    gap: 4rem;
}

@media (max-width: 992px) {
    .category-pill-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-new .grid-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .search-card-new {
        flex-direction: column;
        padding: 1rem;
    }

    .divider {
        display: none;
    }

    .btn-search-new {
        width: 100%;
    }
}

/* --- Smart Search Overlay --- */
.search-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 5000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    animation: fadeIn 0.3s ease;
}

.search-overlay.active {
    display: flex;
}

.search-modal {
    width: 100%;
    max-width: 700px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-header-modal {
    padding: 1.5rem;
    border-bottom: 1px solid var(--divider);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-input-modal {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    font-family: var(--font-primary);
    color: var(--text-primary);
    outline: none;
}

.search-results-modal {
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    background: var(--bg-secondary);
}

.suggestion-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- Premium Article Card Refinements --- */
.article-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.read-time-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-secondary);
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    margin-right: auto;
}

.premium-border {
    border-bottom: 2px solid var(--accent);
    width: 40px;
    margin-bottom: 1rem;
}

/* --- Global Utility Classes --- */
.flex {
    display: flex !important;
}

.flex-col {
    flex-direction: column !important;
}

.items-center {
    align-items: center !important;
}

.items-end {
    align-items: flex-end !important;
}

.justify-between {
    justify-content: space-between !important;
}

.justify-center {
    justify-content: center !important;
}

.h-full {
    height: 100% !important;
}

.w-full {
    width: 100% !important;
}

.mx-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

.max-w-7xl {
    max-width: 80rem !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.gap-3 {
    gap: 0.75rem !important;
}

.gap-4 {
    gap: 1rem !important;
}

.gap-6 {
    gap: 1.5rem !important;
}

.gap-8 {
    gap: 2rem !important;
}

.gap-10 {
    gap: 2.5rem !important;
}

.relative {
    position: relative !important;
}

.z-10 {
    z-index: 10 !important;
}

.py-12 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

.py-24 {
    padding-top: 6rem !important;
    padding-bottom: 6rem !important;
}

.px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.hidden {
    display: none !important;
}

/* --- Responsive Utilities --- */
@media (min-width: 768px) {
    .md\:hidden {
        display: none !important;
    }

    .md\:flex {
        display: flex !important;
    }

    .md\:px-8 {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }

    .md\:py-24 {
        padding-top: 6rem !important;
        padding-bottom: 6rem !important;
    }

    .md\:block {
        display: block !important;
    }
}

@media (min-width: 1024px) {
    .lg\:flex {
        display: flex !important;
    }

    .lg\:hidden {
        display: none !important;
    }
}

.urdu-text {
    font-family: var(--font-primary);
    line-height: 1.8;
}

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

.aspect-\[16\/9\] {
    aspect-ratio: 16 / 9 !important;
}

.rounded-2xl {
    border-radius: 1rem !important;
}

.leading-none {
    line-height: 1 !important;
}

.text-sm {
    font-size: 0.875rem !important;
}

.font-bold {
    font-weight: 700 !important;
}

.tracking-tight {
    letter-spacing: -0.025em !important;
}

.tracking-wide {
    letter-spacing: 0.025em !important;
}

.tracking-widest {
    letter-spacing: 0.1em !important;
}

.border-r {
    border-right-width: 1px !important;
}

.border-black\/10 {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

.pr-4 {
    padding-right: 1rem !important;
}

.mr-2 {
    margin-right: 0.5rem !important;
}

.opacity-30 {
    opacity: 0.3 !important;
}

.opacity-50 {
    opacity: 0.5 !important;
}

.opacity-60 {
    opacity: 0.6 !important;
}

.opacity-70 {
    opacity: 0.7 !important;
}

/* Back to Top */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 45px;
    height: 45px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

#back-to-top.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    background: var(--accent-hover);
    transform: translateY(-5px);
}

/* --- Premium CMS Layout --- */
.cms-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-secondary);
}

.cms-sidebar {
    width: 280px;
    background: var(--bg-header);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.cms-brand {
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cms-nav {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.cms-nav-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
}

.cms-nav-item.active a,
.cms-nav-item a:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    border-right: 4px solid var(--accent);
}

.cms-main {
    flex: 1;
    margin-right: 280px;
    padding: 2rem 4rem;
    max-width: 1200px;
}

.cms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.cms-editor-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 3rem;
    margin-top: 2rem;
    border: 1px solid var(--border-light);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-primary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(196, 164, 132, 0.2);
}

.btn-submit {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    transition: var(--transition);
}

.btn-submit:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* =============================================
   RESPONSIVE CMS OVERRIDES
   Ensures the entire Admin CMS Dashboard is 
   fully responsive and looks beautiful on mobile.
   ============================================= */

@media (max-width: 992px) {
    .cms-layout {
        flex-direction: column !important;
    }
    
    .cms-sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        padding: 1rem 0 !important;
        box-shadow: var(--shadow-sm) !important;
    }
    
    .cms-brand {
        padding: 0.75rem 1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .cms-nav {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        padding: 0 1rem !important;
        margin: 0 !important;
        scrollbar-width: none !important;
    }
    
    .cms-nav::-webkit-scrollbar {
        display: none !important;
    }
    
    .cms-nav-item a {
        padding: 0.75rem 1rem !important;
        white-space: nowrap !important;
        border-right: none !important;
        border-bottom: 2px solid transparent !important;
    }
    
    .cms-nav-item.active a,
    .cms-nav-item a:hover {
        border-bottom: 2px solid var(--accent) !important;
        border-right: none !important;
        background: transparent !important;
    }
    
    .cms-main {
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding: 1.5rem 1rem !important;
        max-width: 100% !important;
    }
    
    .cms-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        text-align: right !important;
    }
    
    .cms-header h1 {
        font-size: 1.8rem !important;
    }
    
    .cms-editor-wrapper {
        padding: 1.5rem 1rem !important;
        margin-top: 1.5rem !important;
    }
    
    .cms-form-container {
        padding: 1.5rem 1rem !important;
    }
    
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

.cms-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .cms-grid-2col {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        margin-bottom: 1rem !important;
    }
}

/* =============================================
   JAMEEL NOORI NASTALEEQ — MOBILE FONT FIX
   Ensures the Urdu font loads and renders
   correctly on all mobile browsers.
   ============================================= */

/* Force Jameel on all key Urdu text elements */
body,
p,
h1,
h2,
h3,
h4,
h5,
h6,
span,
a,
li,
.urdu,
.urdu-text,
.hero-title,
.hero-desc,
.article-title,
.recent-content h4,
.featured-info h2,
.featured-info p,
.article-tag,
.read-more,
.author span,
.recent-date,
.nav-link,
.cat-item,
.section-header h3 {
    font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Mobile-specific tuning */
@media (max-width: 768px) {

    /* Larger base size — Nastaleeq needs more space on small screens */
    body {
        font-size: 18px;
        line-height: 2.2;
    }

    h1,
    h2 {
        font-size: clamp(1.6rem, 6vw, 2.4rem);
        line-height: 2;
    }

    h3,
    h4 {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
        line-height: 2;
    }

    p,
    span,
    a,
    li {
        font-size: clamp(1rem, 4.5vw, 1.3rem);
        line-height: 2.2;
    }

    .hero-title {
        font-size: clamp(1.8rem, 7vw, 2.6rem);
        line-height: 2.1;
    }

    .hero-desc {
        font-size: clamp(1rem, 4.5vw, 1.2rem);
        line-height: 2.4;
    }

    .recent-content h4 {
        font-size: clamp(1rem, 4.5vw, 1.3rem);
        line-height: 2;
    }

    .featured-info h2 {
        font-size: clamp(1.4rem, 5.5vw, 2rem);
        line-height: 2;
    }

    .featured-info p {
        font-size: clamp(1rem, 4vw, 1.2rem);
        line-height: 2.2;
    }
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 380px) {
    body {
        font-size: 16px;
        line-height: 2;
    }

    h1,
    h2 {
        font-size: 1.5rem;
    }

    .hero-title {
        font-size: 1.5rem;
    }
}

/* Redesigned Hero Badge */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(196, 164, 132, 0.1);
    border: 1px solid rgba(196, 164, 132, 0.2);
    padding: 0.5rem 1.25rem;
    border-radius: 100px;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.badge-text {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Category Grid Improvements */
.hero-categories-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.category-pill-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    width: 100%;
}

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

.category-card-new {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    color: var(--text-primary);
}

.category-card-new:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 15px 30px rgba(196, 164, 132, 0.15);
}

.category-card-new .icon-wrap {
    width: 45px;
    height: 45px;
    background: rgba(196, 164, 132, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.category-card-new:hover .icon-wrap {
    background: var(--accent);
    color: white;
}

.category-card-new span {
    font-size: 1.1rem;
    font-weight: 600;
}

/* All Categories Button */
.btn-all-categories {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--divider);
    padding: 0.6rem 1.5rem;
    border-radius: 100px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 2.5rem; /* Generous top margin to prevent grid overlaps */
}

.btn-all-categories:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
    opacity: 1;
}

/* Categories Page Specifics */
.cat-page-header {
    padding: 6rem 0 4rem;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, transparent 100%);
}

.category-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
    padding: 2rem 0;
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 400px; /* Ensure consistent height to prevent overlap */
    position: relative;
    box-sizing: border-box;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    width: 100%;
}

.stat-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.3;
}

.stat-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
    flex: 1; /* Pushes meta to bottom */
}

.stat-meta {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.meta-item span:first-child {
    font-weight: 500;
}

.meta-item span:last-child {
    color: var(--text-primary);
    font-weight: 700;
}

.stat-icon {
    font-size: 2.5rem;
    color: var(--accent);
    opacity: 0.8;
}

.stat-count {
    background: var(--accent);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.8rem;
}

.btn-view-cat {
    margin-top: 1.5rem;
    width: 100%;
    display: block;
    text-align: center;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.8rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
}

.stat-card:hover .btn-view-cat {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Featured Slider Styles */
.slider-wrapper {
    position: relative;
    overflow: visible;
    padding: 2rem 0;
}

.featured-slider-container {
    position: relative;
    height: 450px;
    overflow: visible; /* Allow shadows to show */
    background: transparent;
    border: none;
    box-shadow: none;
}

.featured-slide {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    opacity: 0;
    visibility: hidden;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(50px);
    background: var(--bg-card); /* Shadow and BG on the slide itself */
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.featured-slide.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.featured-slide .featured-image {
    height: 100%;
    background-size: cover;
    background-position: center;
}

.featured-slide .featured-info {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-slide h2 {
    font-size: 2.2rem;
    line-height: 1.3;
    margin: 1rem 0;
    color: var(--text-primary);
}

/* Featured Controls */
.featured-controls {
    position: absolute;
    top: 50%;
    width: 100%;
    left: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 -2rem; /* Pull arrows out slightly */
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
}

.feat-control-btn {
    width: 50px;
    height: 50px;
    background: white;
    border: 1px solid var(--divider);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    pointer-events: auto;
    margin: 0 -25px; /* Half out of container */
}

.feat-control-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(196, 164, 132, 0.3);
}

/* Pagination Dots */
.featured-dots {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.dot {
    width: 10px;
    height: 10px;
    background: var(--divider);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--accent);
    width: 25px;
    border-radius: 100px;
}

@media (max-width: 992px) {
    .featured-slider-container {
        height: auto;
    }
    .featured-slide {
        grid-template-columns: 1fr;
        position: relative;
        display: none;
        transform: none;
    }
    .featured-slide.active {
        display: block;
    }
    .featured-slide .featured-image {
        height: 250px;
    }
    .featured-slide .featured-info {
        padding: 2rem;
    }
    .featured-slide h2 {
        font-size: 1.6rem;
    }
    .featured-controls {
        display: none; /* Hide arrows on mobile for cleaner look */
    }
}

/* ══════════════════════════════════════════════════════════
   TABLE OF CONTENTS  (article.html)
══════════════════════════════════════════════════════════ */

/* ── Floating trigger button ── */
#toc-trigger-btn {
    position: fixed;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border-light);
    color: var(--text-muted);
    border-radius: var(--radius-xl);
    padding: 0.85rem 0.7rem;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    line-height: 1;
}
#toc-trigger-btn span {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    opacity: 0.7;
}
#toc-trigger-btn:hover,
#toc-trigger-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 6px 24px rgba(196,164,132,0.45);
    transform: translateY(-50%) scale(1.08);
}

/* ── Slide-in panel ── */
.toc-panel {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 300px;
    max-width: 85vw;
    background: var(--bg-card);
    border-right: 1.5px solid var(--border-light);
    box-shadow: 4px 0 32px rgba(0,0,0,0.13);
    z-index: 1600;
    display: flex;
    flex-direction: column;
    transform: translateX(-110%);
    transition: transform 0.38s cubic-bezier(0.4,0,0.2,1);
    padding: 0;
    overflow: hidden;
}
.toc-panel.open {
    transform: translateX(0);
}

/* ── Panel header ── */
.toc-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    flex-shrink: 0;
}
.toc-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.toc-close-btn {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.toc-close-btn:hover {
    background: rgba(196,164,132,0.12);
    color: var(--accent);
}

/* ── TOC list ── */
.toc-list {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}
.toc-list::-webkit-scrollbar { width: 4px; }
.toc-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.toc-item { padding: 0; margin: 0; }

.toc-item.toc-h2 { }
.toc-item.toc-h3 { padding-right: 1.25rem; }

.toc-link {
    display: block;
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    line-height: 1.5;
    border-right: 3px solid transparent;
    transition: all 0.22s ease;
    font-family: var(--font-primary);
    text-align: right;
}
.toc-item.toc-h3 .toc-link {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding-right: 2rem;
    border-right-color: transparent !important;
    position: relative;
}
.toc-item.toc-h3 .toc-link::before {
    content: '◦';
    position: absolute;
    right: 1.35rem;
    color: var(--accent);
    opacity: 0.5;
}
.toc-link:hover {
    color: var(--accent);
    background: rgba(196,164,132,0.07);
    border-right-color: rgba(196,164,132,0.4);
}
.toc-link.active {
    color: var(--accent) !important;
    font-weight: 700;
    background: rgba(196,164,132,0.1);
    border-right-color: var(--accent) !important;
}

/* ── Backdrop (mobile only) ── */
.toc-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 1599;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}
.toc-backdrop.open {
    display: block;
    opacity: 1;
}

/* ── Article heading anchors ── */
#article-body h2,
#article-body h3 {
    scroll-margin-top: 100px;
}

/* ── Responsive ── */
@media (min-width: 1100px) {
    /* On large screens, don't need backdrop */
    .toc-backdrop { display: none !important; }
}
@media (max-width: 767px) {
    #toc-trigger-btn {
        left: 0.75rem;
        padding: 0.65rem 0.55rem;
        font-size: 0.95rem;
    }
    .toc-panel { width: 80vw; }
}

/* ══════════════════════════════════════════════════════════
   FLOATING BACK BUTTON (site-wide)
══════════════════════════════════════════════════════════ */
#go-back-btn {
    position: fixed;
    bottom: 5.5rem;        /* sits just above the back-to-top button */
    left: 1.5rem;
    z-index: 1400;
    display: none;         /* shown via JS on non-homepage pages */
    align-items: center;
    gap: 0.45rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border-light);
    color: var(--text-muted);
    border-radius: var(--radius-xl);
    padding: 0.65rem 1rem 0.65rem 0.85rem;
    font-size: 0.95rem;
    font-family: var(--font-primary);
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0,0,0,0.10);
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    animation: backBtnEntrance 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes backBtnEntrance {
    from { opacity: 0; transform: translateY(20px) scale(0.85); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

#go-back-btn .go-back-label {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
}

#go-back-btn i {
    font-size: 0.85rem;
    transition: transform 0.25s ease;
}

#go-back-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 6px 24px rgba(196,164,132,0.4);
    transform: scale(1.06);
}

#go-back-btn:hover i {
    transform: translateX(-3px);
}

#go-back-btn:active {
    transform: scale(0.96);
}

@media (max-width: 767px) {
    #go-back-btn {
        bottom: 5rem;
        left: 0.75rem;
        padding: 0.55rem 0.8rem 0.55rem 0.65rem;
        font-size: 0.85rem;
    }
    #go-back-btn .go-back-label {
        font-size: 0.78rem;
    }
}

/* ══════════════════════════════════════════════════════════
   SAVED LIBRARY ITEMS — Clickable rows
══════════════════════════════════════════════════════════ */
.saved-library-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: background 0.22s ease, border-color 0.22s ease, transform 0.15s ease;
    position: relative;
}

.saved-library-item:hover {
    background: rgba(196, 164, 132, 0.08);
    border-color: rgba(196, 164, 132, 0.25);
    transform: translateX(-3px); /* subtle RTL nudge toward content */
}

.saved-library-item:active {
    transform: scale(0.98);
    background: rgba(196, 164, 132, 0.14);
}

/* =============================================
   CMS COMPACT STATS CARDS (Clickable & Sleek)
   ============================================= */
.cms-stat-card {
    background: var(--bg-card) !important;
    border-radius: var(--radius-md) !important;
    padding: 1.25rem 1.5rem !important;
    border: 1px solid var(--border-light) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 1.25rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: var(--shadow-sm) !important;
    min-height: auto !important; /* Overrides categories page card height */
    box-sizing: border-box !important;
    text-align: right !important;
}
.cms-stat-card:hover {
    transform: translateY(-3px) !important;
    border-color: var(--accent) !important;
    box-shadow: var(--shadow-md) !important;
    background: rgba(196, 164, 132, 0.05) !important;
}
.cms-stat-card.active {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
    box-shadow: 0 8px 24px rgba(196, 164, 132, 0.25) !important;
}
.cms-stat-card.active .stat-icon i {
    color: white !important;
}
.cms-stat-card.active h3,
.cms-stat-card.active span {
    color: white !important;
}
.cms-data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.cms-data-table th,
.cms-data-table td {
    padding: 0.75rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}
.cms-data-table th {
    background: var(--bg-secondary);
    font-weight: 700;
    color: var(--accent);
}
.cms-data-table tr:hover {
    background: rgba(0,0,0,0.02);
}

/* Customize Quill Font Dropdown Options & Previews */
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="jameel-nastaleeq"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="jameel-nastaleeq"]::before {
    content: 'Jameel Nastaleeq' !important;
    font-family: 'Jameel Noori Nastaleeq', sans-serif !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="mehr-nastaleeq"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="mehr-nastaleeq"]::before {
    content: 'Mehr Nastaleeq' !important;
    font-family: 'Mehr_Nastaliq_Web', sans-serif !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="adwa-assalaf"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="adwa-assalaf"]::before {
    content: 'Adwa Assalaf' !important;
    font-family: 'adwa-assalaf', sans-serif !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="amiri"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="amiri"]::before {
    content: 'Amiri (Arabic)' !important;
    font-family: 'Amiri', serif !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="noorehira"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="noorehira"]::before {
    content: 'Noorehira' !important;
    font-family: 'Noorehira', sans-serif !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="irvin-heading"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="irvin-heading"]::before {
    content: 'Irvin Heading' !important;
    font-family: 'Irvin-Heading', sans-serif !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="gagalin"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="gagalin"]::before {
    content: 'Gagalin' !important;
    font-family: 'GAGALIN', sans-serif !important;
}