/* ============================================================
   mg-header.css - GLOBAL custom header (used site-wide via header.php
   and on posts via single-blog.php). Self-contained: does NOT depend on
   the .mg-blog wrapper. All colours hardcoded; box-sizing normalised for
   header sub-tree so the theme's global CSS can't distort it.
   ============================================================ */
.mg-header *, .mg-mobile-drawer *, .mg-search-overlay * { box-sizing: border-box; }

/* Lead-form highlight pulse when the header CTA scrolls to it */
.mg-form-highlight { animation: mg-form-pulse 1.6s ease-out; border-radius: 12px; }
@keyframes mg-form-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(30,64,175,0.55); }
    70%  { box-shadow: 0 0 0 12px rgba(30,64,175,0); }
    100% { box-shadow: 0 0 0 0 rgba(30,64,175,0); }
}

/* Bar */
.mg-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid #e5e7eb; box-shadow: 0 2px 15px -3px rgba(0,0,0,0.07); }
/* An injected inline <style> sets `.mg-header{overflow:hidden!important}`
   (same specificity 0,1,0, later in source), clipping the Max Mega Menu dropdown
   below the header edge. Beat it on SPECIFICITY with `header.mg-header` (0,1,1)
   so order no longer matters. Horizontal clipping stays on .mg-blog, not here. */
header.mg-header,
header.mg-header .mg-header__inner,
header.mg-header .mg-header-nav,
header.mg-header .mega-menu-wrap,
header.mg-header .mega-menu {
    overflow: visible !important;
}
.mg-header__inner { max-width: 1600px; margin: 0 auto; padding: 0 20px; height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* Logo */
.mg-logo-link { display: inline-flex; align-items: center; }
header.mg-header a.mg-logo-link img.mg-logo-img { height: 48px !important; width: auto !important; max-height: 48px !important; display: block; }

/* Desktop nav (wired to WP header-menu) */
.mg-header-nav { display: flex; align-items: center; flex: 1; justify-content: center; }
.mg-header-nav ul.mg-header-menu { display: flex; align-items: center; gap: 20px; list-style: none; margin: 0; padding: 0; }
.mg-header-nav ul.mg-header-menu li { margin: 0; padding: 0; }
.mg-header-nav a { color: #374151; font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.mg-header-nav a:hover { color: #1e40af; }
@media (max-width: 1023px) { .mg-header-nav { display: none; } }

/* Header actions / buttons */
.mg-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.mg-header-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; min-height: 40px; transition: all 0.15s; font-family: inherit; line-height: 1; }
.mg-header-btn--primary { background: #1e40af; color: #ffffff !important; border: none; cursor: pointer; }
.mg-header-btn--primary:hover { background: #1e3a8a; color: #ffffff !important; }
.mg-header-btn--outline { background: transparent; color: #1e40af; border: 1.5px solid #1e40af; }
.mg-header-btn--outline:hover { background: #1e40af; color: #fff; }
@media (max-width: 1023px) { .mg-header-btn { display: none; } }
.mg-search-btn { background: none; border: none; cursor: pointer; padding: 10px; min-height: 44px; min-width: 44px; display: flex; align-items: center; justify-content: center; }

/* Search overlay */
.mg-search-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: flex-start; justify-content: center; padding-top: 80px; }
.mg-search-overlay[hidden] { display: none; }
.mg-search-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.mg-search-panel { position: relative; z-index: 1; background: #fff; border-radius: 16px; padding: 32px; width: 560px; max-width: 90vw; display: flex; flex-direction: column; gap: 16px; text-align: center; }
.mg-search-logo img { height: 56px; width: auto; margin: 0 auto; }
.mg-search-input { width: 100%; height: 48px; font-size: 16px; border: 1.5px solid #D5DCEF; border-radius: 10px; padding: 0 16px; direction: rtl; box-sizing: border-box; }
.mg-search-input:focus { outline: none; border-color: #1e40af; box-shadow: 0 0 0 3px rgba(30,64,175,0.1); }
.mg-search-select { width: 100%; height: 48px; font-size: 15px; border: 1.5px solid #D5DCEF; border-radius: 10px; padding: 0 16px; direction: rtl; background: #fff; box-sizing: border-box; appearance: none; }
.mg-search-submit { height: 48px; background: #1e40af; color: #fff; border: none; border-radius: 10px; font-size: 16px; font-weight: 700; cursor: pointer; width: 100%; }
.mg-search-submit:hover { background: #1e3a8a; }

/* Hamburger (mobile nav trigger) */
.mg-hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 10px; cursor: pointer; min-height: 44px; min-width: 44px; align-items: center; justify-content: center; }
.mg-hamburger span { display: block; width: 24px; height: 2px; background: #1e3a8a; border-radius: 2px; transition: all 0.2s; }
.mg-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mg-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.mg-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 1023px) { .mg-hamburger { display: flex; } }

/* Mobile navigation drawer (wired to WP header-menu) */
.mg-mobile-drawer { position: fixed; inset: 0; z-index: 9998; display: flex; }
.mg-mobile-drawer[hidden] { display: none; }
.mg-drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.mg-drawer-panel { position: relative; z-index: 1; background: #fff; width: 280px; height: 100%; padding: 24px 20px; display: flex; flex-direction: column; gap: 0; overflow-y: auto; margin-right: 0; margin-left: auto; direction: rtl; text-align: right; }
.mg-drawer-menu, .mg-drawer-submenu { list-style: none; margin: 0; padding: 0; }
.mg-drawer-menu > li { border-bottom: 1px solid #f1f5f9; }
.mg-drawer-panel a { color: #1e3a8a; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 0; display: block; }
.mg-drawer-panel a:hover { color: #1e40af; }
/* Collapsible parent items (native <details>/<summary>) */
.mg-drawer-item--parent > details > summary { list-style: none; cursor: pointer; padding: 14px 0; font-size: 16px; font-weight: 700; color: #1e3a8a; display: flex; align-items: center; justify-content: space-between; }
.mg-drawer-item--parent > details > summary::-webkit-details-marker { display: none; }
.mg-drawer-item--parent > details > summary::after { content: "\25BC"; font-size: 11px; color: #64748b; transition: transform 0.15s; margin-inline-start: 8px; }
.mg-drawer-item--parent > details[open] > summary::after { transform: rotate(180deg); }
.mg-drawer-submenu { padding-inline-start: 14px; padding-bottom: 6px; }
.mg-drawer-submenu a { font-size: 15px; font-weight: 500; padding: 10px 0; border-bottom: none; color: #334155; }
.mg-drawer-submenu a:hover { color: #1e40af; }
.mg-drawer-cta { margin-top: 20px; background: #1e40af; color: #fff; border: none; border-radius: 999px; padding: 14px 24px; font-size: 16px; font-weight: 700; cursor: pointer; width: 100%; min-height: 48px; font-family: inherit; }

/* ===== Mobile compact quick-actions (blog posts) - desktop untouched ===== */
.mg-header-mcalc { display: none; }
.mg-cstrip { display: none; }
@media (max-width: 768px) {
    /* Compact calculator button - slim; 44px tap zone via ::after (no visual bulk) */
    .mg-header-mcalc { position: relative; display: inline-flex; align-items: center; justify-content: center; padding: 6px 12px;
        border-radius: 999px; border: 1.5px solid #1e40af; color: #1e40af; background: #fff; font-size: 13px; font-weight: 600;
        text-decoration: none; white-space: nowrap; font-family: inherit; line-height: 1.2; }
    .mg-header-mcalc::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); height: 44px; }
    .mg-header-mcalc:hover { background: #1e40af; color: #fff; }

    /* Thin conversion strip - 44px, subtle bg, snap scroll, no wrap, hidden scrollbar */
    .mg-cstrip { display: block; height: 44px; background: #f7f9fd; border-bottom: 1px solid #eef1f7; direction: rtl; }
    .mg-cstrip__track { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; height: 100%; padding-inline: 12px;
        overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; scrollbar-width: none; }
    .mg-cstrip__track::-webkit-scrollbar { display: none; }
    .mg-cstrip__conv { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; scroll-snap-align: start; }
    .mg-cstrip__line { font-size: 12px; font-weight: 600; color: #1e3a8a; white-space: nowrap; }
    /* Delicate CTA: light fill, 12px, thin padding; 44px tap via ::after */
    .mg-cstrip__cta { position: relative; flex: 0 0 auto; padding: 4px 12px; border: none; border-radius: 999px; background: #e8eefc;
        color: #1e3a8a; font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; white-space: nowrap; line-height: 1.3; }
    .mg-cstrip__cta::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); height: 44px; }
    .mg-cstrip__cta:hover { background: #dbe4fb; }
    /* Outline chips: 12px, 1px border; 44px tap via ::after */
    .mg-cstrip__chip { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; scroll-snap-align: start;
        padding: 5px 12px; border-radius: 999px; border: 1px solid #1e40af; color: #1e40af; background: #fff; font-size: 12px;
        font-weight: 600; text-decoration: none; white-space: nowrap; line-height: 1.3; }
    .mg-cstrip__chip::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); height: 44px; }
    .mg-cstrip__chip:hover { background: #1e40af; color: #fff; }
}
