/*
 | الترويسة والتذييل — تحسينات على style.css دون تعديله.
 | البادئة dh- تعني Daberli Header/Footer لتفادي التصادم مع الفئات الأصلية.
 */

/* ═══════════ الترويسة ═══════════ */

.header.dh {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--surface-border);
    box-shadow: none;
    transition: box-shadow 0.25s ease;
}

/* ظل يظهر عند التمرير فقط — يبقى الرأس نظيفاً في الأعلى */
.header.dh.is-scrolled {
    box-shadow: 0 4px 20px rgba(4, 41, 77, 0.08);
}

.header.dh .header-container {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 76px;
}

/* الشعار — أكبر وأوضح */
.header.dh .logo img {
    height: 52px;
    width: auto;
    display: block;
}

@media (max-width: 900px) {
    .header.dh .logo img { height: 44px; }
    .header.dh .header-container { min-height: 64px; gap: 12px; }
}

/* التنقل */
.header.dh .main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.header.dh .main-nav ul {
    gap: 6px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.header.dh .main-nav a {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: var(--radius-pill);
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: none;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.header.dh .main-nav a:hover {
    background: rgba(8, 148, 151, 0.08);
    color: var(--brand-primary-dark);
}

/* العنصر النشط — خلفية بدل الخط السفلي */
.header.dh .main-nav a.active {
    background: rgba(8, 148, 151, 0.12);
    color: var(--brand-primary-dark);
    border-bottom: none;
    font-weight: 700;
}

/* أزرار المصادقة */
.header.dh .auth-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-inline-start: 0;
}

.header.dh .lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: 40px;
}

.header.dh .lang-switch:hover {
    background: var(--surface-light);
    color: var(--brand-primary-dark);
}

.header.dh .btn-outline,
.header.dh .btn-primary {
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
    transition: .2s;
}

/* «انضم الآن» — كحلي مصمت */
.header.dh .btn-primary,
.dh-drawer-foot .btn-primary {
    background: #0d3b54;
    border: 1px solid #0d3b54;
    color: #fff;
}

.header.dh .btn-primary:hover,
.dh-drawer-foot .btn-primary:hover {
    background: #0a3049;
    border-color: #0a3049;
    color: #fff;
}

/* «تسجيل دخول» — تركوازي مصمت */
.header.dh .btn-outline,
.dh-drawer-foot .btn-outline {
    background: var(--brand-primary, #089497);
    border: 1px solid var(--brand-primary, #089497);
    color: #fff;
}

.header.dh .btn-outline:hover,
.dh-drawer-foot .btn-outline:hover {
    background: var(--brand-primary-dark, #067074);
    border-color: var(--brand-primary-dark, #067074);
    color: #fff;
}

/* ── زر القائمة (برغر) ────────────────────────────────── */
.dh-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    margin-inline-start: auto;
}

.dh-burger span {
    display: block;
    height: 2px;
    width: 24px;
    margin-inline: auto;
    border-radius: 2px;
    background: var(--brand-secondary);
    transition: transform 0.25s, opacity 0.2s;
}

.dh-burger[aria-expanded='true'] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.dh-burger[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.dh-burger[aria-expanded='true'] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── نقطة التحوّل للموبايل ────────────────────────────── */
@media (max-width: 900px) {
    .header.dh .main-nav,
    .header.dh .auth-buttons {
        display: none;
    }

    .dh-burger { display: flex; }
}

/* ── درج التنقل ───────────────────────────────────────── */
/*
 | سمة hidden يجب أن تتغلّب على display في القواعد التالية،
 | وإلا ظهر الدرج مفتوحاً قبل تشغيل الـ JS.
 */
.dh-drawer[hidden],
.dh-overlay[hidden] {
    display: none !important;
}

.dh-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(4, 41, 77, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s;
}

.dh-overlay.is-open { opacity: 1; }

.dh-drawer {
    position: fixed;
    inset-block: 0;
    left: 0;                    /* مثبّت يسار — في اللغتين */
    z-index: 1200;
    width: min(84vw, 320px);
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 32px rgba(4, 41, 77, 0.16);
    transform: translateX(-100%);   /* مغلق: خارج الشاشة يسار → يظهر من اليسار */
    transition: transform 0.28s ease;
    overflow-y: auto;
}

.dh-drawer.is-open { transform: translateX(0); }

.dh-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--surface-border);
}

.dh-drawer-head img { height: 40px; width: auto; }

.dh-close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--surface-light);
    color: var(--text-secondary);
    font-size: 17px;
    cursor: pointer;
}

.dh-close:hover { background: var(--surface-border); }

.dh-drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 2px;
}

.dh-drawer-nav a {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.dh-drawer-nav a:hover { background: var(--surface-light); }

.dh-drawer-nav a.active {
    background: rgba(8, 148, 151, 0.1);
    color: var(--brand-primary-dark);
}

.dh-drawer-foot {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--surface-border);
    display: grid;
    gap: 10px;
}

.dh-drawer-foot .btn-primary,
.dh-drawer-foot .btn-outline {
    width: 100%;
    justify-content: center;
    padding: 13px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.dh-drawer-foot form { display: block; }
.dh-drawer-foot form button { width: 100%; }

.dh-lang {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    min-height: 44px;
}

/* يمنع التمرير خلف الدرج */
body.dh-locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .dh-drawer, .dh-overlay, .dh-burger span { transition: none; }
}

/* ═══════════ التذييل ═══════════ */

.footer.dh-footer {
    background: var(--brand-secondary);
    color: rgba(255, 255, 255, 0.75);
    margin-top: 72px;
}

.footer.dh-footer .footer-container {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1.4fr;
    gap: 64px;
    padding: 80px 24px 60px;
    max-width: 1280px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .footer.dh-footer .footer-container {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

@media (max-width: 600px) {
    .footer.dh-footer .footer-container {
        grid-template-columns: 1fr;
        padding: 48px 20px 40px;
        gap: 36px;
    }
}

.footer.dh-footer .footer-logo img {
    height: 140px;
    width: auto;
    margin-bottom: 4px;
    margin-inline-start: -16px;
    /* الشعار ملوّن — يُقلب ليظهر على الخلفية الداكنة */
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

/* يجب أن يلي القاعدة الأساسية أعلاه، وإلا فاز الارتفاع الأكبر عليه */
@media (max-width: 600px) {
    .footer.dh-footer .footer-logo img { height: 90px; }
}

.footer.dh-footer .footer-brand p {
    font-size: 17px;
    line-height: 2;
    color: rgba(255, 255, 255, 0.72);
    margin: 0 0 24px;
}

.footer.dh-footer h3 {
    font-size: 21px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 24px;
}

.footer.dh-footer ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 16px;
}

.footer.dh-footer ul a {
    color: rgba(255, 255, 255, 0.75);
    font-size: 17px;
    text-decoration: none;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.footer.dh-footer ul a::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--brand-primary);
    opacity: 0;
    transition: opacity 0.2s;
}

.footer.dh-footer ul a:hover {
    color: #fff;
}

.footer.dh-footer ul a:hover::before { opacity: 1; }

/* النشرة البريدية */
.footer.dh-footer .newsletter {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.footer.dh-footer .newsletter input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    min-height: 48px;
}

.footer.dh-footer .newsletter input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.footer.dh-footer .newsletter input:focus {
    outline: none;
    border-color: var(--brand-primary);
    background: rgba(255, 255, 255, 0.12);
}

.footer.dh-footer .newsletter button {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--brand-primary);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    min-height: 48px;
    transition: background-color 0.2s;
}

.footer.dh-footer .newsletter button:hover { background: #0AA9AC; }

/* شارات المتاجر */
.dh-stores {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.dh-store {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    text-decoration: none;
}

.dh-store i { font-size: 22px; }
.dh-store small { display: block; font-size: 11px; opacity: 0.7; line-height: 1.4; }
.dh-store strong { display: block; font-size: 14px; font-weight: 700; line-height: 1.4; }

/* الشريط السفلي */
.footer.dh-footer .footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 24px;
}

/* space-between كان يدفع الفقرة الوحيدة إلى إحدى الحافتين */
.footer.dh-footer .footer-bottom .container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    text-align: center;
}

.footer.dh-footer .footer-bottom p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.dh-social {
    display: flex;
    gap: 8px;
}

.dh-social a {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    text-decoration: none;
    transition: var(--transition-fast);
}

.dh-social a:hover {
    background: var(--brand-primary);
    color: #fff;
}


/* أيقونتا المتجرين قبل نشر التطبيق — معطّلتان بصرياً بدل رابط مكسور */
.dh-store.is-soon { opacity: .55; cursor: default; }
.dh-store.is-soon:hover { transform: none; }
a.dh-store { text-decoration: none; color: inherit; }
