/* =========================================================
   layout.css — Global Layout + Brand System (No Vite)
   Colors come from variables.css (single source of truth)
   ========================================================= */

@import url("variables.css");

/* ---------- Layout-specific sizing ---------- */
:root {
    --nav-h: clamp(66px, 7.5vw, 88px);
    --nav-pad-y: clamp(8px, 1.2vw, 14px);
    --nav-pad-x: clamp(10px, 1.6vw, 18px);

    /* Typography (responsive) */
    --nav-fz: clamp(0.92rem, 1.15vw, 1.02rem);
    --brand-title-fz: clamp(1.02rem, 1.55vw, 1.25rem);
    --brand-sub-fz: clamp(0.72rem, 1.05vw, 0.9rem);
}

/* ---------- Base ---------- */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--page-bg);
    font-family:
        system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Arial,
        "Noto Sans",
        "Helvetica Neue",
        sans-serif;
    transition:
        background 0.3s ease,
        color 0.3s ease;

    /* Helps reduce the "section lines" feeling while scrolling */
    background-attachment: fixed;
}

/* Anti-banding noise layer (removes visible gradient lines) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.035; /* very subtle */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

/* Ensure the app content is above the noise layer */
.app-shell {
    position: relative;
    z-index: 1;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    opacity: 0.92;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

::selection {
    background: var(--selection-bg);
}

/* ---------- Shell (Sticky footer pattern) ---------- */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mainx {
    flex: 1 0 auto;
    padding-top: var(--nav-h);
}

/* ---------- Small helpers ---------- */
.text-muted {
    color: var(--muted) !important;
}

.cardx {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition:
        background 0.3s ease,
        border-color 0.3s ease;
}

/* Highlight ring (premium mosque vibe) */
.brand-ring {
    border: 1px solid rgba(180, 142, 99, 0.28);
    box-shadow:
        0 0 0 6px var(--ring-green),
        0 0 0 12px rgba(180, 142, 99, 0.1);
}

/* ---------- Buttons ---------- */
.btn-ghost {
    background: var(--btn-ghost-bg);
    border: 1px solid var(--btn-ghost-bd);
    color: var(--ink);
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.btn-ghost:hover {
    background: var(--ring-green);
    border-color: var(--btn-ghost-bd);
    transform: translateY(-1px);
}

.btn-green {
    background: linear-gradient(
        135deg,
        var(--brand-green),
        var(--brand-green-2)
    );
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 0.65rem 1.1rem;
    box-shadow: 0 14px 32px rgba(39, 114, 69, 0.2);
    transition:
        transform 0.15s ease,
        filter 0.15s ease,
        box-shadow 0.15s ease;
}

.btn-green:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(39, 114, 69, 0.22);
}

.btn-gold {
    background: linear-gradient(135deg, var(--brand-gold), #c9a57f);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 0.65rem 1.1rem;
    box-shadow: 0 14px 32px rgba(180, 142, 99, 0.22);
    transition:
        transform 0.15s ease,
        filter 0.15s ease,
        box-shadow 0.15s ease;
}

.btn-gold:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(180, 142, 99, 0.24);
}

/* ---------- Navbar ---------- */

.navx {
    position: sticky;
    top: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: var(--nav-shadow);
    z-index: 1030;
    transition:
        background 0.3s ease,
        border-color 0.3s ease;
}

.navx::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(
        90deg,
        rgba(39, 114, 69, 0),
        rgba(39, 114, 69, 0.55),
        rgba(180, 142, 99, 0.55),
        rgba(180, 142, 99, 0)
    );
}

.navx-inner {
    min-height: var(--nav-h);
    padding: var(--nav-pad-y) var(--nav-pad-x);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(10px, 1.4vw, 16px);
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.2vw, 12px);
    min-width: 0; /* مهم للموبايل */
    flex: 1 1 auto; /* يسمح يتمدد ويضيق */
}

.brand-mark {
    width: calc(var(--nav-h) - (var(--nav-pad-y) * 2));
    height: calc(var(--nav-h) - (var(--nav-pad-y) * 2));
    max-width: 88px;
    max-height: 88px;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1%; /* يعطي وضوح + لا يلصق على الإطار*/
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
}

.brand-title {
    font-weight: 900;
    letter-spacing: 0.7px;
    color: var(--brand-green-2);
    font-size: var(--brand-title-fz);

    /* يمنع كسر التصميم */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    font-size: var(--brand-sub-fz);
    color: var(--muted);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Links */
.nav-links {
    gap: 8px;
    align-items: center;
}

.nav-linkx {
    font-size: var(--nav-fz);
    padding: 0.52rem 0.82rem;
    border-radius: 999px;
    color: var(--ink);
    border: 1px solid transparent;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
    white-space: nowrap;
}

.nav-linkx:hover {
    background: var(--btn-ghost-bg);
    color: var(--brand-green);
}

.nav-linkx.is-active {
    background: var(--ring-gold);
    border-color: var(--ring-gold);
    color: var(--brand-green);
}

/* Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.1vw, 12px);
    flex: 0 0 auto;
}

/* Make buttons responsive too (Bootstrap buttons will inherit) */
.navx .btn {
    font-size: clamp(0.86rem, 1.05vw, 0.95rem);
    padding: 0.5rem 0.72rem;
    border-radius: 999px;
}

/* Active link */
.nav-linkx.is-active {
    color: var(--brand-green-2);
    background: rgba(39, 114, 69, 0.1);
    border: 1px solid rgba(39, 114, 69, 0.18);
}

/* Optional: active style for buttons (dashboard / admin login) */
.is-active-btn {
    background: rgba(180, 142, 99, 0.14) !important;
    border-color: rgba(180, 142, 99, 0.28) !important;
}

/* Mobile tweaks (Bootstrap lg breakpoint) */
@media (max-width: 991.98px) {
    .navx-inner {
        gap: 10px;
    }

    .brand-sub {
        display: none; /* على الموبايل يخلي الهيدر نظيف */
    }

    .brand-title {
        letter-spacing: 0.4px;
        font-size: x-small;
    }

    .nav-actions {
        gap: 8px;
    }
}

/* Extra small devices */
@media (max-width: 380px) {
    .navx .btn {
        padding: 0.46rem 0.62rem;
    }

    .brand-mark {
        border-radius: 14px;
    }
    .brand-title {
        display: none; /* على الموبايل يخلي الهيدر نظيف */
    }
}
/* ---------- Footer ---------- */
.footerx {
    background:
        radial-gradient(
            900px 240px at 12% -20%,
            rgba(36, 116, 68, 0.14),
            transparent 60%
        ),
        radial-gradient(
            900px 240px at 86% -20%,
            rgba(180, 140, 100, 0.18),
            transparent 60%
        ),
        linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.96));
    color: rgba(255, 255, 255, 0.88);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footerx-inner {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
    gap: 18px;
    padding: 26px 0;
    align-items: start;
}

.footer-col {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px);
}

.footer-brand {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.footer-logo {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    overflow: hidden;
    flex: 0 0 auto;
    border: 1px solid rgba(180, 140, 100, 0.35);
    box-shadow: 0 14px 34px rgba(180, 140, 100, 0.12);
    background: rgba(255, 255, 255, 0.06);
}
.footer-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.footer-title {
    font-weight: 1000;
    letter-spacing: 0.2px;
    color: #fff;
    line-height: 1.1;
    font-size: 16px;
}
.footer-sub {
    margin-top: 6px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.45;
    font-size: 13px;
}

.footer-head {
    font-weight: 1000;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 10px;
    letter-spacing: 0.2px;
    font-size: 14px;
}

.footer-sub2 {
    font-weight: 800;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.5;
    font-size: 13px;
}

.footer-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.footer-links a {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-weight: 850;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    transition:
        transform 0.14s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}
.footer-links a:hover {
    transform: translateY(-1px);
    border-color: rgba(180, 140, 100, 0.28);
    background: rgba(180, 140, 100, 0.1);
    color: #fff;
}

.footer-contact {
    display: grid;
    gap: 10px;
}
.frow {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.ficon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: rgba(36, 116, 68, 0.14);
    border: 1px solid rgba(36, 116, 68, 0.22);
    color: rgba(255, 255, 255, 0.92);
    font-weight: 900;
}
.ftext {
    font-weight: 850;
    color: rgba(255, 255, 255, 0.84);
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.flink {
    font-weight: 900;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-bottom: 1px dashed rgba(180, 140, 100, 0.35);
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.flink:hover {
    color: #fff;
    border-bottom-color: rgba(180, 140, 100, 0.65);
}
.fmuted {
    color: rgba(255, 255, 255, 0.65);
    font-weight: 800;
    font-size: 12px;
}

.footer-btn {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px 14px;
    border-radius: 14px;
    font-weight: 1000;
    letter-spacing: 0.2px;
    color: #0f172a;
    text-decoration: none;
    background: linear-gradient(
        180deg,
        rgba(180, 140, 100, 1),
        rgba(180, 140, 100, 0.86)
    );
    box-shadow: 0 18px 40px rgba(180, 140, 100, 0.18);
    border: 1px solid rgba(180, 140, 100, 0.35);
    transition:
        transform 0.14s ease,
        box-shadow 0.18s ease,
        filter 0.18s ease;
}
.footer-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
    box-shadow: 0 22px 48px rgba(180, 140, 100, 0.22);
}

.footer-social {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
.social-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    text-decoration: none;
    font-weight: 1000;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition:
        transform 0.14s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}
.social-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(36, 116, 68, 0.28);
    background: rgba(36, 116, 68, 0.12);
    color: #fff;
}

.footerx-bottom {
    padding: 14px 0 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.footer-copy {
    color: rgba(255, 255, 255, 0.68);
    font-weight: 850;
    font-size: 13px;
}
.footer-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}
.footer-mini a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-weight: 850;
}
.footer-mini a:hover {
    color: #fff;
}
.footer-mini .dot {
    color: rgba(255, 255, 255, 0.35);
}

.footer-ids {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.fid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.fid-k {
    font-weight: 950;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.15px;
    font-size: 12px;
}

.fid-v {
    font-weight: 1000;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.2px;
    font-size: 12px;
}

.footer-social {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.social-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition:
        transform 0.14s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

.social-btn svg {
    width: 20px;
    height: 20px;
    fill: rgba(255, 255, 255, 0.86);
    display: block;
}

.social-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(180, 140, 100, 0.3);
    background: rgba(180, 140, 100, 0.1);
}

.social-btn:hover svg {
    fill: #fff;
}
.footer-social {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.social-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition:
        transform 0.14s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

.social-btn svg {
    width: 20px;
    height: 20px;
    fill: rgba(255, 255, 255, 0.86);
    display: block;
}

.social-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(180, 140, 100, 0.3);
    background: rgba(180, 140, 100, 0.1);
}

.social-btn:hover svg {
    fill: #fff;
}

@media (max-width: 992px) {
    .footerx-inner {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 576px) {
    .footerx-inner {
        grid-template-columns: 1fr;
    }
    .footer-col {
        padding: 14px;
    }
    .footer-logo {
        width: 50px;
        height: 50px;
    }
}

/* ---------- Mobile fallback (prevents issues with fixed backgrounds on some phones) ---------- */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }
}

/* ---------- blog ---------- */

.blog-card {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}
.blog-cover {
    height: 190px;
    object-fit: cover;
}
.blog-title {
    font-weight: 900;
    font-size: 16px;
    color: var(--ink);
}
.blog-excerpt {
    color: var(--muted);
    font-weight: 700;
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-content {
    font-weight: 700;
    line-height: 1.9;
    color: var(--ink);
}

/*-------------------------------------- blog -------------------------------*/

/* اجعل الـ navbar بطبقة طبيعية */

/* ارفع طبقة الـ offcanvas فوق كل شيء */
.offcanvas {
    z-index: 2000 !important;
}

/* الخلفية السوداء (backdrop) */
.offcanvas-backdrop {
    z-index: 1990 !important;
}

/* لو عندك navbar fixed أو sticky */
.navx.sticky,
.navx.fixed-top {
    z-index: 1030;
}

/* ================================
   FIX NAVBAR: proper layering
   ================================ */

/* 1) Don't let app-shell create a stacking trap */
.app-shell {
    position: relative;
    z-index: auto !important;
}

/* 2) Put noise layer behind EVERYTHING */
body::before {
    z-index: -1 !important;
}

/* 3) Fixed navbar with proper z-index */
.navx {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1040 !important;
    isolation: isolate;
    pointer-events: auto !important;
    transform: none !important;
    translate: none !important;
}

/* ============ DARK MODE overrides for elements with hardcoded colors ============ */
[data-theme="dark"] body {
    background:
        radial-gradient(
            900px 500px at 10% 0%,
            var(--body-gradient-1),
            transparent 60%
        ),
        radial-gradient(
            700px 420px at 92% 10%,
            var(--body-gradient-2),
            transparent 58%
        ),
        var(--body-base);
}

[data-theme="dark"] .navx::after {
    background: linear-gradient(
        90deg,
        rgba(52, 160, 92, 0),
        rgba(52, 160, 92, 0.4),
        rgba(201, 165, 127, 0.4),
        rgba(201, 165, 127, 0)
    );
}

[data-theme="dark"] .offcanvas {
    background: var(--card) !important;
    color: var(--ink);
}

[data-theme="dark"] .offcanvas .nav-linkx {
    color: var(--ink);
}

[data-theme="dark"] .dropdown-menu {
    background: var(--card);
    border-color: var(--line);
    color: var(--ink);
}

[data-theme="dark"] .dropdown-item {
    color: var(--ink);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background: var(--btn-ghost-bg);
    color: var(--ink);
}

[data-theme="dark"] .blog-card {
    background: var(--card);
    border-color: var(--line);
}

[data-theme="dark"] .blog-title {
    color: var(--ink);
}

[data-theme="dark"] .blog-excerpt {
    color: var(--muted);
}

/* Dark mode footer adjustments */
[data-theme="dark"] .footerx {
    background:
        radial-gradient(
            900px 240px at 12% -20%,
            rgba(52, 160, 92, 0.1),
            transparent 60%
        ),
        radial-gradient(
            900px 240px at 86% -20%,
            rgba(201, 165, 127, 0.12),
            transparent 60%
        ),
        linear-gradient(180deg, rgba(8, 10, 18, 0.95), rgba(8, 10, 18, 0.98));
}

/* ============ Prayer Times Bar ============ */
.prayer-bar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 6px 0;
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
    overflow: hidden;
    position: relative;
    z-index: 1039;
    transition: background 0.3s ease;
}

.prayer-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2vw, 20px);
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.prayer-bar-inner::-webkit-scrollbar {
    display: none;
}

.prayer-item {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.prayer-item.is-next {
    background: var(--ring-green);
    color: var(--brand-green);
    font-weight: 1000;
}

.prayer-name {
    font-weight: 900;
    color: var(--ink);
    font-size: 12px;
}

.prayer-time {
    color: var(--brand-green);
    font-weight: 1000;
    font-size: 13px;
}

.prayer-item.is-next .prayer-name {
    color: var(--brand-green);
}

.prayer-sep {
    color: var(--line);
    font-size: 10px;
}

@media (max-width: 576px) {
    .prayer-bar-inner {
        justify-content: flex-start;
        padding: 0 8px;
    }
}

/* ============ Theme Toggle Button ============ */
.theme-toggle {
    background: var(--btn-ghost-bg);
    border: 1px solid var(--btn-ghost-bd);
    border-radius: 999px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background 0.2s ease,
        transform 0.2s ease;
    padding: 0;
    color: var(--ink);
    font-size: 18px;
    line-height: 1;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    background: var(--ring-green);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-moon,
:root:not([data-theme]) .theme-toggle .icon-moon {
    display: inline;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: inline;
}
