@font-face {
    font-family: "Jameel Noori Nastaleeq";
    src: local("Jameel Noori Nastaleeq"),
         local("Jameel Noori Nastaleeq Kasheeda"),
         url("https://fonts.cdnfonts.com/s/16086/JameelNooriNastaleeq.woff") format("woff");
    font-display: swap;
}

/* Islamic Theme Colors */
:root {
    --islamic-green: #0f7a53;
    --islamic-dark-green: #0b5a3f;
    --islamic-gold: #f59e0b;
    --islamic-cream: #f8fafc;
    --islamic-white: #ffffff;
    --islamic-text: #0f172a;
    --islamic-light-bg: #f4f7fb;
    --islamic-border: #dbe4ee;
    --surface-elevated: #ffffff;
    --surface-muted: #eef3f9;
    --text-muted: #475569;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.18);
    --transition-fast: 160ms ease;
    --transition-base: 240ms ease;
    --transition-slow: 340ms ease;
    --font-urdu: "Jameel Noori Nastaleeq", "Jameel Noori Nastaleeq Kasheeda", "Noto Nastaliq Urdu", serif;
    --font-arabic: "Al Mushaf", "AlMushaf", "Mushaf", "Arabic Typesetting", "KFGQPC Uthman Taha Naskh", "Traditional Arabic", "Amiri", serif;
}

html, body {
    font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--islamic-light-bg);
    color: var(--islamic-text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* Core layout fallbacks: keep critical navigation/widget geometry independent of
   Bootstrap or any utility stylesheet load order. */
.top-navbar,
.navbar-container {
    width: 100%;
}

.top-navbar {
    background: linear-gradient(110deg, var(--islamic-dark-green) 0%, #0f7a53 45%, #14956a 100%);
    color: #fff;
    padding: .9rem 1.4rem;
    box-shadow: 0 10px 30px rgba(2,26,18,.35);
    position: sticky;
    top: 0;
    z-index: 20000;
    isolation: isolate;
    overflow: visible;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-nav {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: .85rem;
    margin-left: auto;
    flex-wrap: wrap;
    position: relative;
    z-index: 20002;
}

.navbar-brand,
.navbar-nav .nav-link {
    color: #fff !important;
    text-decoration: none;
}

.navbar-nav .nav-link {
    display: inline-flex;
    align-items: center;
    padding: .55rem .9rem;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--islamic-gold) !important;
    background: rgba(255,255,255,.12);
}

/* Critical mobile fallback (kept outside CSS isolation so it also works when
   a host serves the generated .Web.styles.css late or from cache). */
@media (max-width: 768px) {
    .top-navbar { padding: .7rem .75rem; }
    .navbar-container { flex-direction: column; align-items: stretch; gap: .65rem; }
    .navbar-brand { justify-content: center; align-self: center; }
    .navbar-nav { width: 100%; margin-left: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
    .navbar-nav .nav-link { justify-content: center; min-width: 0; padding: .55rem .3rem; font-size: .84rem; overflow-wrap: anywhere; text-align: center; }
    .language-picker-wrap { grid-column: 1 / -1; width: 100%; justify-content: center; }
}

@media (max-width: 420px) {
    .navbar-nav { grid-template-columns: 1fr; }
    .navbar-nav .nav-link { padding-block: .48rem; }
}

.wa-float {
    position: fixed;
    z-index: 9999;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(3.375rem, 6vw, 3.75rem);
    height: clamp(3.375rem, 6vw, 3.75rem);
    color: #fff;
    text-decoration: none;
    isolation: isolate;
}

.wa-float__ring,
.wa-float__btn {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.wa-float__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #25d366;
}

.wa-float > svg,
.wa-float img,
.wa-float__icon {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Keep browser/Google-Translate dropdown surfaces above banners and widgets. */
.goog-te-menu-frame,
.VIpgJd-ZVi9od-xl07Ob-OEVmcd,
.VIpgJd-ZVi9od-vH1Gmf,
body > .skiptranslate {
    z-index: 2147483647 !important;
}

/* Script-specific typography. Add lang="ur" or lang="ar" to future content blocks. */
[lang="ur"],
.urdu-text,
.font-urdu {
    font-family: var(--font-urdu);
    line-height: 2;
}

[lang="ar"],
.arabic-text,
.quran-text,
.font-arabic {
    font-family: var(--font-arabic);
    line-height: 1.9;
}

/* Urdu articles use Nastaliq throughout, without changing English UI typography. */
.urdu-article,
.urdu-article .article-title,
.urdu-article .article-category,
.urdu-article .article-summary,
.urdu-article .article-content,
.urdu-article .article-author,
.urdu-article .category-header,
.urdu-article .category-subtitle,
.urdu-article .category-link,
.urdu-article-admin,
.urdu-article-admin h1,
.urdu-article-admin h2,
.urdu-article-admin h3,
.urdu-article-admin label,
.urdu-article-admin th,
.urdu-article-admin td,
.urdu-article-admin button,
.urdu-article-admin input,
.urdu-article-admin textarea,
.urdu-article-admin select {
    font-family: var(--font-urdu) !important;
}

.urdu-article .article-content * {
    font-family: inherit !important;
}

/* Arabic quotations inside an Urdu article retain their own Mushaf typography. */
.urdu-article [lang="ar"],
.urdu-article .arabic-text,
.urdu-article .quran-text,
.urdu-article .font-arabic {
    font-family: var(--font-arabic) !important;
}

.urdu-article {
    direction: rtl;
    text-align: right;
    line-height: 2;
}

.urdu-article .article-title,
.urdu-article .article-summary,
.urdu-article .article-content,
.urdu-article-admin textarea {
    line-height: 2.15;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

h1, h2, h3, h4, h5 {
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin-top: 0;
}

p {
    margin-top: 0;
}

img {
    max-width: 100%;
    height: auto;
}

.container-fluid {
    width: min(1400px, 100%);
    margin-inline: auto;
}

.surface-card {
    background: var(--surface-elevated);
    border: 1px solid var(--islamic-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.surface-card--interactive {
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.surface-card--interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(15, 122, 83, 0.35);
}

.responsive-table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.loading-shimmer {
    position: relative;
    overflow: hidden;
    background: #e8edf5;
}

.loading-shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Keep the Google gadget off-screen (not display:none), otherwise the Google
   widget can fail to initialize and no language conversion occurs. */
#google_translate_element {
    display: block !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    overflow: hidden !important;
}

.goog-te-banner-frame.skiptranslate {
    display: none !important;
}

body {
    top: 0 !important;
}

/* Brand logo in navbar */
.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    height: 46px;
    max-width: 210px;
    object-fit: contain;
}

.brand-text {
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--islamic-white);
    font-size: 1.25rem;
    line-height: 1;
    text-transform: none;
}

@media (max-width: 480px) {
    .brand-logo {
        height: 40px;
        max-width: 180px;
    }

    .brand-text {
        font-size: 1.05rem;
    }
}

a, .btn-link {
    color: var(--islamic-green);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover, .btn-link:hover {
    color: var(--islamic-dark-green);
}

.btn-primary {
    color: var(--islamic-white);
    background: linear-gradient(135deg, var(--islamic-green), var(--islamic-dark-green));
    border-color: transparent;
    padding: 0.62rem 1.2rem;
    border-radius: 999px;
    font-weight: 600;
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #14956a, var(--islamic-dark-green));
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 122, 83, 0.35);
}

.btn-secondary {
    background-color: #475569;
    color: white;
    border: none;
    padding: 0.62rem 1.2rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 600;
}

.btn-secondary:hover {
    background-color: #334155;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: #dc2626;
    color: white;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 600;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(0, 107, 60, 0.5);
}

.content {
    padding-top: 0;
    min-height: calc(100vh - 60px);
    width: 100%;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #b91c1c;
    font-size: 0.82rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--islamic-green) 0%, var(--islamic-dark-green) 100%);
    padding: 2rem;
}

.login-card {
    background: var(--islamic-white);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: var(--islamic-green);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.login-header p {
    color: #6c757d;
    margin: 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--islamic-text);
    font-weight: 600;
    font-size: 0.92rem;
}

.form-control {
    width: 100%;
    padding: 0.72rem 0.86rem;
    border: 1px solid var(--islamic-border);
    border-radius: var(--radius-sm);
    font-size: 0.96rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base);
    background: #fff;
}

.form-control:focus {
    border-color: var(--islamic-green);
    outline: none;
    box-shadow: 0 0 0 4px rgba(20, 149, 106, 0.14);
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Home Page */
.home-container {
    display: flex;
    flex-direction: column;
}

/* Keep the calculator tools visible before the article feed on the homepage. */
.home-container > .main-content { order: 3; }
.home-container > .home-calculators-section { order: 2; }
.home-container > .home-quiz-section { order: 4; }
.home-container > .home-featured-video { order: 5; }

.home-container > .main-content {
    width: 100%;
}

.banner-section {
    background-image: url('/images/banner-top.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    color: var(--islamic-white);
    min-height: 500px;      /* slightly taller banner */
    padding: 5.5rem 3.5rem; /* balanced padding */
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;         /* vertically center text block */
    justify-content: center;     /* horizontally center text block */
}

.banner-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="50" fill="rgba(255,255,255,0.05)">☪</text></svg>') repeat;
    opacity: 0.3;
}

.banner-overlay {
    position: relative;
    z-index: 1;
}

.banner-content {
    max-width: 800px;
    margin: -4rem auto 0;  /* move text upward but keep below navbar */
    text-align: center;
}

@media (min-width: 1201px) {
    .banner-content { max-width: 800px; margin-left: 2rem; margin-right: 420px; }
}

.banner-widget-container {
    position: absolute;
    top: 50%;
    right: 1.5rem;
    transform: translateY(-50%);
    width: min(380px, 34vw);
    max-width: calc(100% - 3rem);
    min-width: 280px;
    z-index: 2;
}

.banner-widget-iframe {
    width: 100%;
    height: 520px;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.6);
}

@media (max-width: 1200px) {
    .banner-widget-container {
        position: static;
        transform: none;
        margin: 1.5rem auto 0;
        width: min(100%, 380px);
        max-width: calc(100vw - 2rem);
        min-width: 0;
        box-sizing: border-box;
    }

    .banner-widget-iframe {
        display: block;
        height: 520px;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* At tablet/small-desktop widths, keep the brand and the complete navigation
   rows visually balanced instead of allowing only the last links to drop. */
@media (min-width: 769px) and (max-width: 1300px) {
    .top-navbar { padding-block: .7rem; }
    .navbar-container { flex-direction: column; gap: .55rem; }
    .navbar-brand { align-self: center; }
    .navbar-nav { width: 100%; margin-left: 0; justify-content: center; gap: .4rem; }
    .navbar-nav .nav-link { padding: .45rem .65rem; font-size: .88rem; }
}

@media (max-width: 600px) {
    .banner-section { padding: 2.5rem .75rem 1.5rem; overflow: hidden; }
    .banner-overlay { width: 100%; max-width: 100%; }
    .banner-widget-container { width: 100%; max-width: 100%; margin-top: 1rem; }
    .banner-widget-iframe { width: 100%; height: 500px; border-radius: 12px; }
}

.banner-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.banner-subtitle {
    font-size: 1.05rem;
    opacity: 0.95;
    line-height: 1.7;
}

.daily-inspiration {
    margin-top: 1.75rem;
    display: inline-block;
    padding: 0.9rem 1.25rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.7);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(248, 250, 252, 0.25);
}

.daily-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #facc15;
    margin-bottom: 0.15rem;
    text-align: center;
}

.daily-arabic {
    font-family: var(--font-arabic);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.2rem;
}

.daily-translation {
    font-size: 0.9rem;
    color: #e5e7eb;
    text-align: center;
}

.daily-reference {
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 0.15rem;
}

.banner-cta {
    margin-top: 1.5rem;
}

.main-content {
    padding: 2.5rem 1.5rem 2.5rem;
}

/* Home — Online Academy strip (between hero banner and main content) */
.home-academy-strip {
    padding: 0 1rem 0;
    margin-top: -1.25rem;
    position: relative;
    z-index: 3;
}

@media (min-width: 769px) {
    .home-academy-strip {
        padding: 0 2rem 0;
        margin-top: -2rem;
    }
}

.home-academy-strip__btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 1.15rem 1.5rem 1.15rem 1.75rem;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    color: var(--islamic-white);
    background: linear-gradient(120deg, var(--islamic-dark-green) 0%, var(--islamic-green) 42%, #0a5c36 100%);
    box-shadow:
        0 12px 40px rgba(0, 34, 20, 0.35),
        0 0 0 1px rgba(212, 175, 55, 0.35);
    overflow: hidden;
    transition:
        transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1),
        box-shadow 0.28s ease,
        filter 0.2s ease;
}

.home-academy-strip__btn:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow:
        0 18px 48px rgba(0, 34, 20, 0.45),
        0 0 0 1px rgba(212, 175, 55, 0.55);
    filter: brightness(1.05);
}

.home-academy-strip__btn:active {
    transform: translateY(-1px) scale(1.005);
}

.home-academy-strip__btn:focus-visible {
    outline: 3px solid var(--islamic-gold);
    outline-offset: 3px;
}

.home-academy-strip__glow {
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle at 30% 20%, rgba(212, 175, 55, 0.25), transparent 45%);
    pointer-events: none;
    animation: home-academy-shimmer 8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .home-academy-strip__glow {
        animation: none;
        opacity: 0.9;
    }
}

.home-academy-strip__inner {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.home-academy-strip__badge {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--islamic-dark-green);
    background: linear-gradient(90deg, #f5e6a8, var(--islamic-gold));
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
}

.home-academy-strip__headline {
    font-size: clamp(1rem, 2.8vw, 1.35rem);
    font-weight: 700;
    line-height: 1.35;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.home-academy-strip__hint {
    font-size: 0.82rem;
    opacity: 0.88;
    font-weight: 500;
}

.home-academy-strip__chevron {
    flex-shrink: 0;
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    opacity: 0.85;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.home-academy-strip__btn:hover .home-academy-strip__chevron {
    transform: translateX(4px);
    opacity: 1;
}

@keyframes home-academy-shimmer {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(4%, 2%) rotate(2deg); }
}

/* Home — Online Academy intro modal */
.academy-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(0, 26, 15, 0.62);
    backdrop-filter: blur(4px);
    animation: academy-modal-fade-in 0.28s ease-out;
}

.academy-modal-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: min(90vh, 640px);
    overflow-y: auto;
    background: var(--islamic-white);
    border-radius: 18px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(212, 175, 55, 0.25);
    animation: academy-modal-pop 0.32s cubic-bezier(0.34, 1.35, 0.64, 1);
}

.academy-modal-close {
    position: absolute;
    top: 0.65rem;
    right: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: #4b5563;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    z-index: 2;
}

.academy-modal-close:hover {
    background: rgba(0, 107, 60, 0.12);
    color: var(--islamic-dark-green);
    transform: rotate(90deg);
}

.academy-modal-header {
    padding: 1.75rem 1.75rem 1rem;
    border-bottom: 1px solid var(--islamic-border);
    background: linear-gradient(180deg, rgba(0, 107, 60, 0.06) 0%, transparent 100%);
}

.academy-modal-kicker {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--islamic-green);
    margin-bottom: 0.35rem;
}

.academy-modal-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.65rem;
    color: var(--islamic-dark-green);
}

.academy-modal-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.5;
}

.academy-modal-body {
    padding: 1.25rem 1.75rem 0.5rem;
    color: var(--islamic-text);
    font-size: 0.95rem;
    line-height: 1.65;
}

.academy-modal-body p {
    margin: 0 0 1rem 0;
}

.academy-modal-list {
    margin: 0;
    padding-left: 1.2rem;
    color: #374151;
}

.academy-modal-list li {
    margin-bottom: 0.45rem;
}

.academy-modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem 1.5rem;
}

.academy-modal-cta {
    box-shadow: 0 4px 14px rgba(0, 107, 60, 0.35);
}

.hajj-notice-overlay { background: rgba(2, 31, 26, .78); backdrop-filter: blur(5px); }
.hajj-notice-card[dir="rtl"] { font-family: var(--font-urdu); line-height: 2; }
.hajj-notice-card { max-width: 620px; border: 1px solid rgba(232, 189, 79, .55); overflow: hidden; }
.hajj-notice-header { background: radial-gradient(circle at 12% 20%, rgba(232,189,79,.3), transparent 30%), linear-gradient(135deg,#063f35,#08775b); padding: 2.2rem 2rem 1.7rem; }
.hajj-notice-header .academy-modal-kicker { color: #efd077; }
.hajj-notice-header .academy-modal-title { color: #fff; line-height: 1.55; margin-top: .35rem; }
.hajj-notice-header .academy-modal-subtitle { color: #d9eee7; line-height: 1.9; }
.hajj-notice-card .academy-modal-close { color: #fff; z-index: 2; }
.hajj-notice-points { display: grid; grid-template-columns: repeat(3,1fr); gap: .55rem; }
.hajj-notice-points span { text-align: center; padding: .7rem .5rem; background: #eef8f3; color: #07634d; border-radius: 10px; font-weight: 700; font-size: .83rem; }
.hajj-notice-actions { direction: rtl; }
.hajj-nav-link { color: #9a6807 !important; font-weight: 800 !important; }

.home-hajj-entry {
    position: relative;
    max-width: 1180px;
    margin: 1rem auto 2rem;
    padding: 1.5rem 1.7rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.25rem;
    overflow: hidden;
    border: 1px solid rgba(232, 189, 79, .5);
    border-radius: 20px;
    background: radial-gradient(circle at 8% 20%, rgba(232,189,79,.24), transparent 24%), linear-gradient(135deg,#063f35,#08775b);
    color: #fff;
    box-shadow: 0 14px 34px rgba(6,63,53,.16);
    font-family: var(--font-urdu);
}
.home-hajj-entry__ornament { width: 68px; height: 68px; display: grid; place-items: center; border: 1px solid rgba(239,208,119,.45); border-radius: 50%; background: rgba(255,255,255,.08); color: #efd077; font-size: 1.65rem; }
.home-hajj-entry__kicker { color: #efd077; font-size: .72rem; font-weight: 800; letter-spacing: .09em; }
.home-hajj-entry__copy h2 { margin: .25rem 0 .35rem; color: #fff; font-size: clamp(1.25rem,3vw,1.75rem); line-height: 1.5; }
.home-hajj-entry__copy p { margin: 0; color: #d9eee7; line-height: 1.75; font-size: .9rem; }
.home-hajj-entry__features { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .55rem; color: #f2dc9e; font-size: .78rem; font-weight: 700; }
.home-hajj-entry__button { display: inline-flex; align-items: center; gap: .55rem; white-space: nowrap; padding: .78rem 1.1rem; border: 0; border-radius: 11px; background: #e8bd4f; color: #173b30; font-weight: 800; cursor: pointer; box-shadow: 0 7px 18px rgba(0,0,0,.14); }
.home-hajj-entry__button:hover { background: #f0cc70; transform: translateY(-1px); }

@media (max-width: 600px) {
    .hajj-notice-header { padding: 1.8rem 1.2rem 1.3rem; }
    .hajj-notice-points { grid-template-columns: 1fr; }
    .home-hajj-entry { grid-template-columns: 1fr; margin: .8rem .75rem 1.5rem; padding: 1.25rem; text-align: right; }
    .home-hajj-entry__ornament { display: none; }
    .home-hajj-entry__button { width: 100%; }
}

@keyframes academy-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes academy-modal-pop {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .academy-modal-overlay,
    .academy-modal-card {
        animation: none;
    }
}

/* Sidebar row: relative for toggle positioning */
.sidebar-row {
    position: relative;
}

/* Sidebar */
.sidebar {
    background: var(--islamic-white);
    border-right: 1px solid var(--islamic-border);
    padding: 1.5rem;
    transition: flex 0.3s ease, min-width 0.3s ease, max-width 0.3s ease, padding 0.3s ease;
    overflow: hidden;
    position: relative;
}

.sidebar .sidebar-inner {
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* Sidebar toggle button - top right of sidebar */
.sidebar-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 25;
    width: 36px;
    height: 36px;
    border: 2px solid var(--islamic-border);
    border-radius: 8px;
    background: var(--islamic-white);
    color: var(--islamic-green);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: background 0.2s, color 0.2s;
}

.sidebar-toggle:hover {
    background: var(--islamic-green);
    color: var(--islamic-white);
}

.sidebar-toggle-icon {
    line-height: 1;
}

/* Collapsed state: narrow strip, only toggle visible */
.sidebar.sidebar-collapsed {
    flex: 0 0 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
    padding: 1rem 0.5rem !important;
}

.sidebar.sidebar-collapsed .sidebar-inner {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: absolute;
}

.sidebar.sidebar-collapsed .sidebar-toggle {
    right: 50%;
    left: 50%;
    transform: translate(-50%, 0);
    top: 1rem;
}

/* Main content expands when sidebar is collapsed */
.articles-section-expanded {
    flex: 1 1 0% !important;
    max-width: none !important;
    width: auto !important;
}

.sidebar-card {
    background: var(--surface-elevated);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--islamic-border);
}

/* Slight spacing for calculators card under categories */
.calculators-sidebar-card {
    margin-top: 1.5rem;
}

.calculators-sidebar-card .sidebar-text {
    font-size: 0.9rem;
    color: #4b5563;
    margin-bottom: 0.75rem;
}

.calculators-sidebar-link {
    margin-top: 0.25rem;
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(15, 118, 110, 0.25);
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--islamic-dark-green);
    font-weight: 600;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.calculators-sidebar-link:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

/* Scholar profile card in sidebar */
.profile-sidebar-card {
    margin-top: 1.5rem;
}

.profile-sidebar-link {
    margin-top: 0.25rem;
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(15, 118, 110, 0.25);
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--islamic-dark-green);
    font-weight: 600;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.profile-sidebar-link:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

/* Profile page layout */
.profile-page {
    max-width: 1100px;
    margin: 2.5rem auto 3.5rem;
    padding: 0 1.5rem;
}

.profile-card {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 2.5rem;
    background: #ffffff;
    border-radius: 20px;
    padding: 2.5rem 2.25rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(15, 118, 110, 0.12);
}

.profile-photo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-photo {
    width: 220px;
    height: 220px;
    max-width: 100%;
    border-radius: 999px;
    object-fit: cover;
    border: 4px solid rgba(16, 185, 129, 0.7);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25);
}

.profile-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.profile-name {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--islamic-dark-green);
    margin-bottom: 0.25rem;
}

.profile-role {
    font-size: 1rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.profile-section {
    margin-top: 0.5rem;
}

.profile-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.profile-section p {
    font-size: 0.96rem;
    color: #4b5563;
    line-height: 1.7;
}

.profile-section ul {
    margin: 0;
    padding-left: 1.25rem;
    color: #4b5563;
    font-size: 0.96rem;
}

.profile-section li {
    margin-bottom: 0.4rem;
}

@media (max-width: 900px) {
    .profile-card {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .profile-main {
        align-items: center;
    }

    .profile-section {
        text-align: left;
    }

    .profile-photo {
        width: 200px;
        height: 200px;
        margin-bottom: 1rem;
    }
}

.sidebar-title {
    color: var(--islamic-green);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--islamic-green);
}

/* Calendar page panels */
.calendar-panel {
    background: #ffffff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 118, 110, 0.15);
}

.calendar-panel h2 {
    font-size: 1.6rem;
    color: var(--islamic-dark-green);
    margin-bottom: 0.75rem;
}

.calendar-panel p {
    color: #4b5563;
}

/* Contact page */
.contact-page {
    max-width: 800px;
    margin: 2.5rem auto 3.5rem;
    padding: 0 1.5rem;
}

.contact-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 2.25rem 2rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(15, 118, 110, 0.12);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.contact-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--islamic-dark-green);
    margin-bottom: 0.5rem;
}

.contact-section p {
    margin: 0;
    font-size: 0.98rem;
    color: #4b5563;
}

.contact-link {
    color: var(--islamic-green);
    font-weight: 600;
    text-decoration: none;
}

.contact-link:hover {
    color: var(--islamic-dark-green);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .contact-page {
        padding: 0 1rem;
    }

    .contact-card {
        padding: 1.75rem 1.5rem;
    }
}

.calendar-widget {
    margin-top: 1.25rem;
    padding: 1.25rem;
    border-radius: 12px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    overflow-x: auto;
}

.calendar-widget .table {
    margin-bottom: 0;
}

.calendar-widget .table th {
    background: #eaf2fb;
    color: #0f172a;
    white-space: nowrap;
}

.calendar-widget .table td {
    white-space: nowrap;
}

/* Home page calculators section above footer */
.home-calculators-section {
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    padding: 3rem 1.5rem 3.5rem;
}

.home-calculators-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.home-calculators-header {
    text-align: center;
    margin-bottom: 2rem;
}

.home-calculators-header h2 {
    font-size: 1.9rem;
    color: var(--islamic-dark-green);
    margin-bottom: 0.5rem;
}

.home-calculators-header p {
    color: #4b5563;
    max-width: 700px;
    margin: 0 auto;
}

.home-calculators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.75rem;
    margin-top: 1.5rem;
}

.home-calculator-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 2.25rem 1.75rem 2rem;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 118, 110, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.home-calculator-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    border-color: rgba(15, 118, 110, 0.35);
}

.home-calculator-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    color: #111827;
    margin: 0 0 0.75rem;
}

.home-calculator-card p {
    color: #4b5563;
    font-size: 0.93rem;
    line-height: 1.6;
    margin: 0 0 1.4rem;
    flex: 1;
}

.home-calculator-card .calculator-icon {
    margin-bottom: 1.25rem;
}

.home-calculator-card .calculator-btn {
    align-self: center;
    margin-top: auto;
    width: 100%;
    min-width: 0;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
    white-space: nowrap;
    font-size: .88rem;
}

/* Homepage featured video (admin-configured YouTube) */
.home-featured-video {
    background: #f3f4f9;
    border-top: 1px solid #e2e8f0;
    padding: 3rem 1.5rem 3.75rem;
}

.home-featured-video__inner {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: clamp(1.75rem, 4vw, 3rem);
    align-items: center;
}

.home-featured-video__title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.65rem, 3vw, 2.05rem);
    font-weight: 700;
    color: #1a237e;
    margin: 0 0 1rem;
    line-height: 1.25;
}

.home-featured-video__text {
    margin: 0 0 1.35rem;
    color: #475569;
    font-size: 1rem;
    line-height: 1.65;
    max-width: 38ch;
}

.home-featured-video__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.72rem 1.6rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.98rem;
    background: #a67c00;
    color: #ffffff !important;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(166, 124, 0, 0.35);
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.home-featured-video__cta:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.home-featured-video__media {
    min-width: 0;
}

.home-featured-video__frame {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(26, 35, 126, 0.12);
    border: 1px solid rgba(26, 35, 126, 0.12);
    aspect-ratio: 16 / 9;
    background: #0f172a;
}

.home-featured-video__frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.home-featured-video__frame > .home-featured-video__link { display: none; }

@media (max-width: 900px) {
    .home-featured-video__inner {
        grid-template-columns: 1fr;
    }

    .home-featured-video__copy {
        order: 1;
    }

    .home-featured-video__media {
        order: 2;
    }
}

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

.category-list .category-link {
    width: 100%;
    justify-content: flex-start;
}

/* Parent "All Articles" toggle */
.category-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    text-align: left;
}

.category-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
}

.category-toggle-icon {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-left: auto; /* push arrow to the far right */
}

/* Child items under All Articles */
.category-sub-item {
    margin-left: 1.75rem;
}

.category-sub-item .category-link {
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
}

.category-sub-item .category-icon {
    font-size: 0.95rem;
}

/* Islamic Calculators section on Home page */
.calculators-section {
    margin: 3rem auto 0;
    max-width: 1200px;
    padding: 2.5rem 1.5rem 3rem;
}

.calculators-header {
    text-align: center;
    margin-bottom: 2rem;
}

.calculators-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--islamic-dark-green);
    margin-bottom: 0.5rem;
}

.calculators-header p {
    color: #4b5563;
    max-width: 640px;
    margin: 0.25rem auto 0;
    font-size: 0.98rem;
}

.calculators-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.75rem;
}

.calculator-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 2.25rem 1.75rem 2rem;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 118, 110, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.calculator-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    border-color: rgba(15, 118, 110, 0.35);
}

.calculator-icon {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    border: 2px solid #d1b26b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.25rem;
    background: radial-gradient(circle, #fff 0%, #fefce8 40%, #fef9c3 100%);
}

.calculator-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #111827;
}

.calculator-card p {
    font-size: 0.93rem;
    color: #4b5563;
    margin-bottom: 1.4rem;
}

.calculator-btn {
    padding: 0.65rem 1.8rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #b8860b, #d97706);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(180, 83, 9, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.calculator-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(180, 83, 9, 0.45);
    filter: brightness(1.03);
}

.calculator-btn:active {
    transform: translateY(1px);
    box-shadow: 0 6px 14px rgba(180, 83, 9, 0.35);
}

/* Individual calculator pages */
.calculator-page {
    max-width: 900px;
    margin: 2.5rem auto 3.5rem;
    padding: 2.5rem 2rem;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(15, 118, 110, 0.12);
}

.calculator-page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--islamic-dark-green);
    margin-bottom: 0.75rem;
}

.calculator-page-header p {
    color: #4b5563;
    font-size: 0.98rem;
    max-width: 640px;
}

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

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

    .calculators-section {
        padding-inline: 1.25rem;
    }

    /* Center calculator buttons on mobile */
    .home-calculator-card .calculator-btn,
    .calculator-card .calculator-btn {
        align-self: center;
        text-align: center;
    }

    /* Compact 2x2 homepage calculator layout for phones. */
    .home-calculators-section { padding: 1.6rem .7rem 2rem; }
    .home-calculators-header { margin-bottom: 1rem; }
    .home-calculators-header h2 { font-size: 1.45rem; }
    .home-calculators-header p { font-size: .85rem; line-height: 1.45; }
    .home-calculators-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .8rem; }
    .home-calculator-card { padding: 1rem .55rem .85rem; border-radius: 12px; }
    .home-calculator-card .calculator-icon { margin-bottom: .45rem; font-size: 1.55rem; }
    .home-calculator-card h3 { font-size: .88rem; line-height: 1.25; margin-bottom: .35rem; }
    .home-calculator-card p { font-size: .72rem; line-height: 1.35; margin-bottom: .7rem; }
    .home-calculator-card .calculator-btn { min-width: 0; width: 100%; padding: .45rem .25rem; font-size: .7rem; white-space: normal; }
}

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

.category-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--islamic-text);
    border-radius: 5px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.category-link:hover {
    background-color: var(--islamic-green);
    color: var(--islamic-white);
    transform: translateX(5px);
}

.category-link.active {
    background-color: var(--islamic-green);
    color: var(--islamic-white);
    font-weight: 600;
}

.category-icon {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

.article-count {
    margin-left: auto;
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Articles Grid */
.articles-section {
    padding: 0 1.5rem;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
    align-items: stretch;
}

.article-card {
    background: var(--islamic-white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 107, 60, 0.2);
}

.article-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--islamic-light-bg);
}

.article-image.article-image--thumb {
    height: auto;
    aspect-ratio: 16 / 10;
    min-height: 180px;
    max-height: 240px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

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

.admin-thumb-cell {
    width: 72px;
}

.admin-thumb-img {
    width: 64px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--islamic-border);
    vertical-align: middle;
}

.thumbnail-preview-wrap {
    margin-top: 0.5rem;
    max-width: 320px;
}

.thumbnail-preview-wrap img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--islamic-border);
    background: var(--islamic-light-bg);
}

.thumbnail-upload-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    align-items: center;
}

.article-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.article-category {
    background: var(--islamic-green);
    color: var(--islamic-white);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-weight: 500;
}

.article-date {
    color: #6c757d;
}

.article-title {
    color: var(--islamic-text);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.article-summary-block {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.article-summary {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 0;
}

/* ~6 lines max on article cards when summary is long */
.article-summary.article-summary--clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
    line-clamp: 6;
    overflow: hidden;
}

.article-summary-cta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin: 0;
    padding: 0;
}

.article-summary-ellipsis {
    color: #94a3b8;
    font-size: 1rem;
    letter-spacing: 0.02em;
    user-select: none;
}

.article-read-more-inline {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--islamic-green);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-read-more-inline:hover {
    color: var(--islamic-dark-green);
}

.article-footer.article-footer--author-only {
    justify-content: flex-start;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--islamic-border);
}

.article-author {
    color: #6c757d;
    font-size: 0.875rem;
}

.btn-read-more {
    background: none;
    border: none;
    color: var(--islamic-green);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    transition: color 0.3s ease;
}

.btn-read-more:hover {
    color: var(--islamic-dark-green);
}

/* Homepage Urdu article cards: keep every textual element in Nastaleeq. */
.articles-grid .article-card.urdu-article,
.articles-grid .article-card.urdu-article .article-content,
.articles-grid .article-card.urdu-article .article-meta,
.articles-grid .article-card.urdu-article .article-category,
.articles-grid .article-card.urdu-article .article-date,
.articles-grid .article-card.urdu-article .article-title,
.articles-grid .article-card.urdu-article .article-summary,
.articles-grid .article-card.urdu-article .article-summary-cta,
.articles-grid .article-card.urdu-article .article-author,
.articles-grid .article-card.urdu-article button {
    font-family: var(--font-urdu) !important;
}

.articles-grid .article-card.urdu-article .article-title,
.articles-grid .article-card.urdu-article .article-summary {
    line-height: 2.15;
}

/* Article Detail */
.article-detail-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.article-header {
    margin-bottom: 2rem;
}

.btn-back {
    background: none;
    border: 2px solid var(--islamic-green);
    color: var(--islamic-green);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--islamic-green);
    color: var(--islamic-white);
}

.article-featured-image {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.article-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-body {
    background: var(--islamic-white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.article-content {
    line-height: 1.8;
    font-size: 1.1rem;
    color: var(--islamic-text);
}

/* Long-form article reading typography */
.article-detail-container:not(.urdu-article) .article-title,
.article-detail-container:not(.urdu-article) .article-content {
    font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
}

.article-detail-container:not(.urdu-article) .article-title {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.18;
    font-weight: 700;
}

.article-detail-container:not(.urdu-article) .article-content {
    font-size: 1.125rem;
    line-height: 1.85;
    letter-spacing: 0.002em;
}

.article-detail-container:not(.urdu-article) .article-meta,
.article-detail-container:not(.urdu-article) .article-author-info,
.article-detail-container:not(.urdu-article) .btn-back {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

.article-detail-container.urdu-article .article-title {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.9;
    font-weight: 600;
    margin-bottom: 1rem;
}

.article-detail-container.urdu-article .article-content {
    font-family: var(--font-urdu) !important;
    font-size: clamp(1.2rem, 1.8vw, 1.38rem);
    line-height: 2.45;
    word-spacing: 0.06em;
    text-align: right;
}

.article-detail-container .article-content p {
    margin: 0 0 1.15em;
}

.article-detail-container .article-content h2,
.article-detail-container .article-content h3,
.article-detail-container .article-content h4 {
    margin-top: 1.5em;
    margin-bottom: 0.65em;
}

.article-detail-container .article-content ul,
.article-detail-container .article-content ol {
    margin-bottom: 1.15em;
}

.article-detail-container.urdu-article .article-content li {
    margin-bottom: 0.35em;
    padding-inline-start: 0.2em;
}

@media (max-width: 640px) {
    .article-detail-container {
        padding: 1rem;
    }

    .article-body {
        padding: 1.35rem 1.15rem;
    }

    .article-detail-container.urdu-article .article-content {
        font-size: 1.16rem;
        line-height: 2.3;
    }
}

/* Global user-friendly exception fallback */
.global-error-card {
    max-width: 620px;
    margin: 4rem auto;
    padding: 2.25rem;
    text-align: center;
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.global-error-card__icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 1.7rem;
    font-weight: 700;
}

.global-error-card h1 { color: var(--islamic-dark-green); margin-bottom: .75rem; }
.global-error-card p { color: var(--text-muted); }
.global-error-card__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }

/* Admin Dashboard */
.admin-container {
    padding: 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--islamic-border);
}

.admin-header h1 {
    color: var(--islamic-green);
    margin: 0;
}

.admin-actions {
    display: flex;
    gap: 1rem;
}

.admin-content {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.admin-card,
.article-editor-card {
    background: #fff;
    border: 1px solid var(--islamic-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.2rem;
}

.admin-card h2,
.article-editor-card h2 {
    font-size: 1.15rem;
    margin-bottom: 0.65rem;
    color: var(--islamic-dark-green);
}

.admin-subtle-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.admin-message {
    margin-top: 0.75rem;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
}

.form-inline-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

.form-inline-field {
    min-width: 0;
}

.editor-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.quiz-admin-page {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1rem;
}

.admin-panel-nav {
    padding: 0.9rem;
    margin-bottom: 1rem;
}

.admin-panel-nav__header h2 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--islamic-dark-green);
}

.admin-panel-nav__header p {
    margin: 0.2rem 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.admin-panel-nav__menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.admin-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--islamic-border);
    background: #fff;
    color: var(--islamic-dark-green);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition-base);
}

.admin-nav-link:hover {
    background: #ecfdf5;
    border-color: rgba(20, 149, 106, 0.45);
    transform: translateY(-1px);
}

.admin-nav-link.active {
    background: linear-gradient(135deg, var(--islamic-green), var(--islamic-dark-green));
    color: #fff;
    border-color: transparent;
}

.admin-nav-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.admin-panel-nav__footer {
    margin-top: 0.8rem;
    display: flex;
    justify-content: flex-end;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--islamic-white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    color: var(--islamic-green);
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
}

.stat-card p {
    color: #6c757d;
    margin: 0;
}

.articles-table-container {
    background: var(--islamic-white);
    padding: 1.15rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--islamic-border);
    overflow-x: auto;
}

.articles-table {
    width: 100%;
    border-collapse: collapse;
}

.articles-table th {
    background: linear-gradient(135deg, var(--islamic-dark-green), var(--islamic-green));
    color: var(--islamic-white);
    padding: 0.82rem 0.72rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.articles-table td {
    padding: 0.8rem 0.72rem;
    border-bottom: 1px solid var(--islamic-border);
    white-space: nowrap;
}

.articles-table tr:hover {
    background: var(--islamic-light-bg);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-content {
    background: var(--islamic-white);
    border-radius: 15px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--islamic-border);
}

.modal-header h2 {
    color: var(--islamic-green);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--islamic-text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 0.8rem;
}

.spinner {
    border: 4px solid #dbe4ee;
    border-top: 4px solid #14956a;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

.loading-spinner p {
    color: var(--text-muted);
    font-weight: 600;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error UI */
.error-message {
    text-align: center;
    padding: 3rem;
}

.no-articles {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

/* Footer */
footer {
    background: var(--islamic-dark-green);
    color: var(--islamic-white);
    padding: 2rem;
    margin-top: 3rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .banner-title {
        font-size: 2rem;
    }

    /* Ensure banner text is not hidden under navbar on mobile */
    .banner-section {
        padding-top: 6.5rem;           /* extra space below navbar */
        padding-inline: 1.5rem;
        align-items: flex-start;
    }

    .banner-content {
        margin: 0 auto;               /* remove large negative margin */
        text-align: center;
    }

    .home-academy-strip {
        margin-top: -0.5rem;
        padding: 0 0.75rem 0;
    }

    .home-academy-strip__btn {
        padding: 1rem 1.1rem;
        border-radius: 14px;
    }

    .home-academy-strip__chevron {
        display: none;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    /* Admin page: make layout mobile-friendly */
    .admin-container {
        padding: 1.25rem 1rem;
    }

    .article-editor-card,
    .articles-table-container {
        padding: 1.25rem;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    }

    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .form-inline-row {
        grid-template-columns: 1fr;
    }

    .form-group {
        width: 100%;
    }

    .articles-table th,
    .articles-table td {
        padding: 0.6rem 0.4rem;
        font-size: 0.85rem;
        white-space: normal;
    }

    .articles-table {
        display: block;
        overflow-x: auto;
    }
}

/* Blazor Error UI */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Islamic Calculators: embedded advanced HTML calculators */
.calculator-page {
    max-width: 1200px;
    margin: 2.5rem auto;
    padding: 1.5rem;
}

.calculator-page-header {
    background: linear-gradient(135deg, var(--islamic-dark-green), #065f46);
    color: var(--islamic-white);
    padding: 1.75rem 2rem;
    border-radius: 1.25rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 1.5rem;
}

.calculator-page-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.calculator-page-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.calculator-iframe-wrapper {
    position: relative;
    width: 100%;
    min-height: 80vh;
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(15, 118, 110, 0.25);
    background: radial-gradient(circle at top, #022c22 0, #020617 55%);
}

.calculator-iframe-wrapper iframe {
    width: 100%;
    height: 80vh;
    border: none;
    display: block;
    background: transparent;
}

@media (max-width: 768px) {
    .calculator-page {
        padding: 1rem;
        margin-top: 1.5rem;
    }

    .calculator-page-header {
        padding: 1.25rem 1.35rem;
    }

    .calculator-page-header h1 {
        font-size: 1.4rem;
    }

    .calculator-iframe-wrapper {
        min-height: 75vh;
    }

    .calculator-iframe-wrapper iframe {
        height: 75vh;
    }
}
