/* =====================================================================
   طبيبك — الهيدر والقائمة الرئيسية (واجهة فقط)
   - شريط علوي: اللوجو + البحث + أدوات الحساب
   - شريط أقسام بقوائم منسدلة على الكمبيوتر
   - قائمة جانبية (Drawer) بأقسام قابلة للطي على الجوال والتابلت
   ===================================================================== */

/* ---------- أيقونات SVG ---------- */
.ic {
    width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em;
    fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- الغلاف الثابت ---------- */
.site-header-fixed {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    font-family: var(--font-body);
}

/* ---------- شريط التوثيق ---------- */
.verify-promo-bar {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--ink); color: #E2E8F0; direction: rtl;
    font-size: 12.5px; font-weight: 500; padding: 7px 16px; cursor: pointer;
    letter-spacing: 0.01em; transition: background-color .2s ease;
}
.verify-promo-bar .ic { color: #5EEAD4; width: 15px; height: 15px; }
.verify-promo-bar:hover { background: #1E293B; color: #fff; }

/* ---------- الهيدر ---------- */
.site-header {
    display: block; background: #fff;
    border-bottom: 1px solid var(--border-color); direction: rtl;
    font-family: var(--font-body); position: relative;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* إعادة ضبط أزرار الهيدر (الموقع يطبّق ستايل عام على كل الأزرار) */
.site-header button {
    flex: none; width: auto; padding: 0; margin: 0; border: none; background: none;
    color: inherit; font: inherit; font-weight: inherit; border-radius: 0; cursor: pointer;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.site-header button:active { transform: none; }
.site-header button:focus-visible,
.site-header [role="button"]:focus-visible,
.site-header [role="link"]:focus-visible,
.site-header select:focus-visible {
    outline: 2px solid var(--primary-color); outline-offset: 2px;
}

.hdr-top {
    display: flex; align-items: center; gap: 20px;
    max-width: 1280px; margin: 0 auto; padding: 10px 24px; min-height: 64px;
}

/* اللوجو */
.hdr-brand { display: flex; align-items: center; gap: 6px; flex: none; }
.logo-container { display: flex; align-items: center; cursor: pointer; flex: none; }
.logo-container .header-logo-img { height: 38px; width: auto; max-width: 170px; object-fit: contain; }

.yt-hamburger-btn {
    display: none; width: 40px; height: 40px; border-radius: 10px;
    align-items: center; justify-content: center; color: var(--ink);
}
.site-header .yt-hamburger-btn:hover { background: var(--surface); }
.yt-hamburger-btn .ic { width: 22px; height: 22px; }

/* البحث */
.yt-search-group { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.yt-search-bar {
    flex: 1; display: flex; align-items: center; max-width: 560px; margin: 0 auto;
    background: var(--surface); border: 1px solid transparent; border-radius: 12px;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.yt-search-bar:focus-within {
    background: #fff; border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(12, 110, 106, 0.10);
}
.yt-search-bar input,
.yt-search-bar input:focus {
    flex: 1; min-width: 0; border: none; background: transparent; box-shadow: none; outline: none;
    padding: 10px 4px; font-size: 14px; color: var(--text-color); font-family: inherit;
}
.yt-search-bar input::placeholder { color: var(--text-muted); }
.site-header .yt-search-icon-btn {
    width: 42px; height: 40px; display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); border-radius: 0 12px 12px 0;
}
.site-header .yt-search-icon-btn:hover { color: var(--primary-color); }
.site-header .yt-search-clear {
    width: 36px; height: 40px; display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}
.site-header .yt-search-clear:hover { color: var(--ink); }
.yt-search-clear .ic { width: 15px; height: 15px; }

/* اللغة */
.yt-lang-wrap { position: relative; flex: none; }
.yt-lang-btn {
    display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px;
    border: 1px solid var(--border-color); border-radius: 10px; background: #fff;
    font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; cursor: pointer;
    transition: border-color .18s ease, color .18s ease;
}
.yt-lang-btn:hover { border-color: #CBD5E1; color: var(--ink); }
.yt-lang-menu {
    display: none; flex-direction: column; gap: 2px;
    position: absolute; top: calc(100% + 8px); left: 0; width: 190px; max-height: 340px; overflow-y: auto;
    background: #fff; border: 1px solid var(--border-color); border-radius: 12px;
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 1003;
}
.yt-lang-menu.open { display: flex; }
.site-header .yt-lang-item {
    text-align: right; padding: 9px 12px; border-radius: 8px;
    font-size: 13px; font-weight: 500; color: var(--text-color);
}
.site-header .yt-lang-item:hover { background: var(--surface); }
.site-header .yt-lang-item.active { background: var(--primary-tint); color: var(--primary-color); font-weight: 700; }

/* أدوات الحساب */
.yt-profile-group { display: flex; align-items: center; gap: 10px; flex: none; }
.header-login-link {
    /* بدون ارتفاع ثابت: script.js يغيّر display إلى inline، فنعتمد على line-height + padding للتوسيط */
    display: inline-block; line-height: 22px; padding: 9px 18px; border-radius: 10px;
    background: var(--primary-color); color: #fff; font-weight: 700; font-size: 13.5px;
    cursor: pointer; white-space: nowrap; flex: none; transition: background-color .18s ease;
}
.header-login-link:hover { background: var(--primary-hover); }

.site-header .yt-create-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px;
    border: 1px solid var(--border-color); border-radius: 10px; background: #fff;
    font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap;
}
.site-header .yt-create-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }

.yt-bell-btn, .yt-avatar-btn {
    position: relative; width: 40px; height: 40px; border-radius: 10px; flex: none;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    color: var(--text-secondary); transition: background-color .18s ease, color .18s ease;
}
.yt-bell-btn:hover { background: var(--surface); color: var(--ink); }
.yt-bell-btn .ic, .yt-avatar-btn .ic { width: 20px; height: 20px; }
.yt-avatar-btn { border-radius: 50%; background: var(--primary-tint); color: var(--primary-color); }
.yt-avatar-btn:hover { background: #D5EBE9; }
.yt-badge {
    position: absolute; top: 4px; right: 4px; background: var(--emergency-color); color: #fff;
    font-size: 10px; font-weight: 700; border-radius: 9px; min-width: 17px; height: 17px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
    border: 2px solid #fff; line-height: 1;
}

/* قائمة الإشعارات */
.yt-notif-wrap { position: relative; flex: none; }
.yt-notif-menu {
    display: none; flex-direction: column;
    position: absolute; top: calc(100% + 8px); left: -60px; width: 340px; max-width: calc(100vw - 24px);
    background: #fff; border: 1px solid var(--border-color); border-radius: 14px;
    box-shadow: var(--shadow-lg); z-index: 1003; overflow: hidden;
}
.yt-notif-menu.open { display: flex; }
.yt-notif-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; font-size: 14px; font-weight: 700; color: var(--ink);
    border-bottom: 1px solid var(--border-color); flex: none;
}
.yt-notif-mark-all { font-size: 12px; font-weight: 600; color: var(--primary-color); cursor: pointer; }
#notifListContainer { max-height: 380px; overflow-y: auto; }
.yt-notif-empty { padding: 28px 14px; text-align: center; color: var(--text-muted); font-size: 13px; }
.yt-notif-item {
    display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; cursor: pointer;
    border-bottom: 1px solid #F1F5F9; text-align: right;
}
.yt-notif-item:hover { background: #F8FAFC; }
.yt-notif-item.unread { background: var(--primary-tint); }
.yt-notif-item.unread:hover { background: #DDEFED; }
.yt-notif-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.yt-notif-body { font-size: 12px; color: var(--text-secondary); }
.yt-notif-time { font-size: 11px; color: var(--text-muted); }

/* قائمة الحساب */
.profile-menu-wrap { position: relative; flex: none; }
.profile-menu-panel {
    display: none; flex-direction: column; gap: 2px;
    position: absolute; top: calc(100% + 8px); left: 0; width: 230px;
    background: #fff; border: 1px solid var(--border-color); border-radius: 14px;
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 1003;
    max-height: 72vh; overflow-y: auto;
}
.profile-menu-panel.open { display: flex; }
.profile-menu-header {
    padding: 10px 12px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted);
    border-bottom: 1px solid var(--border-color); margin-bottom: 4px; word-break: break-all;
}
.site-header .profile-menu-item {
    display: flex; align-items: center; gap: 10px; text-align: right; padding: 10px 12px; border-radius: 8px;
    font-size: 13.5px; font-weight: 500; color: var(--text-color);
}
.profile-menu-item .ic { color: var(--text-muted); width: 18px; height: 18px; }
.site-header .profile-menu-item:hover { background: var(--surface); color: var(--primary-color); }
.site-header .profile-menu-item:hover .ic { color: var(--primary-color); }
.site-header .profile-menu-item.is-danger { color: var(--emergency-color); margin-top: 4px; border-top: 1px solid var(--border-color); border-radius: 0 0 8px 8px; }
.site-header .profile-menu-item.is-danger .ic { color: var(--emergency-color); }

/* =====================================================================
   القائمة الرئيسية (الأقسام)
   ===================================================================== */
.main-nav { border-top: 1px solid #F1F5F9; }

.yt-menu-panel {
    display: flex; align-items: center; gap: 2px; list-style: none;
    max-width: 1280px; margin: 0 auto; padding: 0 16px; min-height: 48px;
}
.yt-menu-panel > li { list-style: none; position: relative; }
.nav-drawer-head, .nav-backdrop { display: none; }

/* زر القسم */
.site-header .nav-cat-btn,
.site-header .nav-top-link {
    display: inline-flex; align-items: center; gap: 6px; height: 48px; padding: 0 14px;
    font-size: 14px; font-weight: 600; color: var(--text-color); white-space: nowrap;
    position: relative;
}
.site-header .nav-cat-btn::after,
.site-header .nav-top-link::after {
    content: ""; position: absolute; right: 14px; left: 14px; bottom: -1px; height: 2px;
    background: var(--primary-color); border-radius: 2px; transform: scaleX(0);
    transition: transform .2s ease;
}
.site-header .nav-cat-btn:hover,
.site-header .nav-top-link:hover,
.nav-cat.is-open > .nav-cat-btn { color: var(--primary-color); }
.nav-cat-btn:hover::after, .nav-top-link:hover::after, .nav-cat.is-open > .nav-cat-btn::after { transform: scaleX(1); }

.nav-caret { width: 15px; height: 15px; color: var(--text-muted); transition: transform .2s ease, color .2s ease; }
.nav-cat.is-open .nav-caret { transform: rotate(180deg); color: var(--primary-color); }

.site-header .nav-top-link.is-emergency { color: var(--emergency-color); font-weight: 700; }
.site-header .nav-top-link.is-emergency::after { background: var(--emergency-color); }
.nav-top-link.is-emergency .ic { width: 17px; height: 17px; }

/* القائمة المنسدلة */
.nav-dropdown {
    position: absolute; top: 100%; right: 0; z-index: 1002;
    min-width: 320px; padding: 10px; margin-top: 0;
    background: #fff; border: 1px solid var(--border-color); border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.05);
    opacity: 0; visibility: hidden; transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.nav-dropdown--wide { min-width: 560px; }
.nav-dd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.nav-cat.is-open > .nav-dropdown {
    opacity: 1; visibility: visible; transform: translateY(0);
    transition: opacity .18s ease, transform .18s ease, visibility 0s;
}
.nav-dd-title {
    font-size: 11.5px; font-weight: 700; color: var(--text-muted); letter-spacing: .02em;
    padding: 6px 12px 8px;
}

/* عناصر القائمة المنسدلة */
.site-header .dd-item {
    display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: right;
    padding: 10px 12px; border-radius: 10px; color: var(--text-color); white-space: normal;
}
.site-header .dd-item:hover,
.site-header .dd-item:focus-visible { background: var(--surface); }
.dd-ico {
    width: 38px; height: 38px; border-radius: 10px; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-tint); color: var(--primary-color);
    transition: background-color .18s ease, color .18s ease;
}
.dd-ico .ic { width: 19px; height: 19px; }
.site-header .dd-item:hover .dd-ico { background: var(--primary-color); color: #fff; }
.dd-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-top: 1px; }
.dd-txt strong { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.dd-txt small { font-size: 12px; font-weight: 400; color: var(--text-secondary); line-height: 1.5; }

/* اختيار الدولة */
.nav-country {
    margin-right: auto; display: flex; align-items: center; gap: 4px;
    color: var(--text-secondary);
}
.nav-country-label { display: flex; align-items: center; margin: 0; color: var(--text-muted); cursor: pointer; }
.site-header select.country-nav-select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    width: auto; max-width: 200px; height: 34px; padding: 0 10px 0 26px;
    border: 1px solid transparent; border-radius: 8px; background-color: transparent;
    font-size: 13px; font-weight: 600; color: var(--text-secondary); font-family: inherit; direction: rtl;
    text-overflow: ellipsis; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat; background-position: left 10px center;
}
.site-header select.country-nav-select:hover { background-color: var(--surface); }

/* =====================================================================
   شاشات متوسطة (تابلت أفقي)
   ===================================================================== */
@media (max-width: 1180px) {
    .hdr-top { gap: 14px; padding: 10px 18px; }
    .site-header .nav-cat-btn, .site-header .nav-top-link { padding: 0 11px; font-size: 13.5px; }
    .site-header select.country-nav-select { max-width: 150px; }
}

/* =====================================================================
   الجوال والتابلت: قائمة جانبية
   ===================================================================== */
@media (max-width: 1023px) {
    .yt-hamburger-btn { display: inline-flex; }
    .hdr-top { flex-wrap: wrap; gap: 10px 12px; padding: 8px 14px 10px; min-height: 0; }
    .hdr-brand { order: 1; }
    .yt-profile-group { order: 2; margin-right: auto; gap: 6px; }
    .yt-search-group { order: 3; flex-basis: 100%; }
    .yt-search-bar { max-width: none; }
    .logo-container .header-logo-img { height: 34px; }
    .site-header .yt-create-btn { width: 40px; padding: 0; justify-content: center; }
    .yt-create-btn .create-label { display: none; }

    .main-nav { border-top: none; }

    /* اللوحة الجانبية */
    .yt-menu-panel {
        position: fixed; top: 0; bottom: 0; right: 0; z-index: 1101;
        width: min(340px, 88vw); max-width: none; margin: 0; padding: 0 0 24px;
        flex-direction: column; align-items: stretch; gap: 0;
        background: #fff; overflow-y: auto; overscroll-behavior: contain;
        box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
        transform: translateX(105%); visibility: hidden;
        transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .28s;
    }
    .yt-menu-panel.open {
        transform: translateX(0); visibility: visible;
        transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s;
    }
    .nav-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1100;
        background: rgba(15, 23, 42, 0.45);
        opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
    }
    .yt-menu-panel.open ~ .nav-backdrop { opacity: 1; visibility: visible; transition: opacity .25s ease, visibility 0s; }

    .nav-drawer-head {
        display: flex; align-items: center; justify-content: space-between;
        position: sticky; top: 0; z-index: 2; background: #fff;
        padding: 14px 16px; border-bottom: 1px solid var(--border-color);
    }
    .nav-drawer-logo { height: 32px; width: auto; }
    .site-header .nav-drawer-close {
        width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
        color: var(--text-secondary);
    }
    .site-header .nav-drawer-close:hover { background: var(--surface); color: var(--ink); }

    .yt-menu-panel > li { border-bottom: 1px solid #F1F5F9; }

    .site-header .nav-cat-btn,
    .site-header .nav-top-link {
        display: flex; width: 100%; height: 54px; padding: 0 18px; font-size: 15px;
        justify-content: flex-start;
    }
    .nav-cat-btn .nav-caret { margin-right: auto; width: 18px; height: 18px; }
    .site-header .nav-cat-btn::after, .site-header .nav-top-link::after { display: none; }
    .nav-cat.is-open > .nav-cat-btn { background: #F8FAFC; }

    /* الأقسام تتحول لقوائم قابلة للطي (Accordion) */
    .nav-dropdown, .nav-dropdown--wide {
        position: static; min-width: 0; margin: 0; padding: 0 10px;
        border: none; border-radius: 0; box-shadow: none; background: #F8FAFC;
        opacity: 1; visibility: visible; transform: none;
        display: none; transition: none;
    }
    .nav-cat.is-open > .nav-dropdown { display: block; padding: 4px 10px 10px; animation: navAccordion .2s ease; }
    .nav-dd-title { display: none; }
    .nav-dd-grid { grid-template-columns: 1fr; }
    .site-header .dd-item { padding: 10px 8px; }
    .site-header .dd-item:hover { background: #EEF2F6; }
    .dd-ico { width: 34px; height: 34px; background: #fff; border: 1px solid var(--border-color); }

    .nav-country {
        margin: 0; padding: 14px 18px; gap: 8px; border-bottom: none !important;
    }
    .site-header select.country-nav-select {
        flex: 1; max-width: none; height: 44px; border: 1px solid var(--border-color); background-color: #fff;
    }

    body.nav-drawer-open { overflow: hidden; }
}

@keyframes navAccordion {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* جوال صغير */
@media (max-width: 480px) {
    .hdr-top { padding: 8px 10px 10px; gap: 8px; }
    .logo-container .header-logo-img { height: 30px; max-width: 120px; }
    .header-login-link { line-height: 20px; padding: 8px 12px; font-size: 13px; }
    .yt-bell-btn, .yt-avatar-btn, .site-header .yt-create-btn { width: 36px; height: 36px; }
    .yt-hamburger-btn { width: 36px; height: 36px; }
    .yt-lang-btn { height: 40px; padding: 0 10px; }
    .yt-lang-btn .yt-lang-label { display: none; }
    .yt-notif-menu { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; }
    .profile-menu-panel { left: 0; width: 220px; }
    .verify-promo-bar { font-size: 12px; padding: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .nav-dropdown, .yt-menu-panel, .nav-backdrop, .nav-caret { transition: none !important; animation: none !important; }
}
