/* Modern header - restyles the existing template header (menu items and links unchanged).
   Uses the site's own palette: orange #FFA012, purple #4a3db8 / #9c31df, navy #0b132b. */
.header-main {
  --hm-orange: #FFA012;
  --hm-orange-deep: #ff7a00;
  --hm-tint: rgba(255, 160, 18, .13);
  --hm-purple: var(--primary-bg-color, #4a3db8);
  --hm-navy: #0b132b;
  --hm-line: #ece9f6;
}

/* ================= Desktop ================= */
@media (min-width: 992px) {
  /* clean white bar, rounded lower corners, soft shadow */
  .header-main .horizontal-main {
    background: #fff;
    border-radius: 0 0 28px 28px;
    box-shadow: 0 10px 30px rgba(11, 19, 43, .10);
    position: relative;
  }
  .header-main .horizontal-mainwrapper.container { max-width: min(1500px, 96vw); }

  /* logo + menu + help + button share the row and use the full width */
  .header-main .horizontal-mainwrapper { display: flex; align-items: center; gap: 1.25rem; padding-top: 4px; padding-bottom: 4px; }
  .header-main .sticky-wrapper:not(.is-sticky) .horizontal-mainwrapper .desktoplogo { float: none; margin: 0; padding: 6px 0; flex: 0 0 auto; }
  .header-main .sticky-wrapper:not(.is-sticky) .horizontal-mainwrapper .desktoplogo img { max-height: 62px; width: auto; }
  .header-main .sticky-wrapper.is-sticky .horizontal-mainwrapper .desktoplogo { display: none !important; }
  .header-main .horizontal-mainwrapper .desktoplogo-1 { float: none; margin: 0; flex: 0 0 auto; }
  .header-main .horizontal-mainwrapper > nav.horizontalMenu {
    flex: 1 1 auto; min-width: 0; display: flex !important; align-items: center; justify-content: space-between; gap: 1rem; float: none; width: auto; margin: 0;
  }
  .header-main .horizontalMenu > ul { float: none; margin: 0; }
  .header-main .horizontalMenu > .horizontalMenu-list { flex: 1 1 auto; display: flex; align-items: center; justify-content: flex-start; gap: clamp(.1rem, .5vw, .5rem); }
  .header-main .horizontalMenu > .horizontalMenu-list > li { float: none; padding: 0; align-self: stretch; display: flex; align-items: center; }
  .header-main .horizontal-mainwrapper > nav.horizontalMenu, .header-main .horizontalMenu > .horizontalMenu-list { align-self: stretch; }
  /* dropdowns are placed from the bottom of the bar (the template's fixed 62px top leaves a gap at some widths) */
  .header-main .horizontalMenu > .horizontalMenu-list > li > ul.sub-menu { top: calc(100% - 16px); }
  .header-main .horizontalMenu > .horizontalMenu-list > li.mobile-contact-container { margin-left: auto; }
  /* spread the spare room equally between the items: the same gap between every link, and the help pill */
  .header-main .horizontalMenu > .horizontalMenu-list > li:first-child { margin-left: 0; }
  .header-main .horizontalMenu > .horizontalMenu-list > li:not(:first-child) { margin-left: auto; }

  /* menu links: larger text, soft pill on hover, orange text + short underline on the current page */
  .header-main .horizontalMenu > .horizontalMenu-list > li > a {
    position: relative;
    color: var(--hm-navy) !important;
    font-size: clamp(14px, 1.05vw, 16px);
    font-weight: 600;
    letter-spacing: .1px;
    border-radius: 999px;
    padding: 11px clamp(8px, .85vw, 14px);
    margin: 0;
    background: none;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease;
  }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a .nav-icon { display: none; }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a .fa-caret-down { background: none !important; color: currentColor !important; margin-left: 8px !important; font-size: 13px; transition: transform .2s ease; }
  .header-main .horizontalMenu > .horizontalMenu-list > li:hover > a { background: var(--hm-tint); color: var(--hm-orange-deep) !important; }
  .header-main .horizontalMenu > .horizontalMenu-list > li:hover > a .fa-caret-down { transform: rotate(180deg); }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a.active,
  .header-main .horizontalMenu > .horizontalMenu-list > li > a.active:hover {
    background: none;
    color: var(--hm-orange-deep) !important;
    box-shadow: none;
  }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a.active::after {
    content: ""; position: absolute; left: 50%; bottom: 1px; width: 22px; height: 3px; border-radius: 3px;
    background: var(--hm-orange); transform: translateX(-50%);
  }

  /* dropdown: white card, tinted icon tiles */
  .header-main .horizontalMenu > .horizontalMenu-list > li > .sub-menu {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 22px 48px rgba(11, 19, 43, .18);
    padding: 10px;
    /* a transparent top border (not a margin) keeps the pointer inside the menu while moving down to it,
       otherwise the dropdown closes (li:hover) before it can be reached */
    border-top: 12px solid transparent;
    background-clip: padding-box;
    margin-top: 0;
    min-width: 290px;
    background: #fff;
  }
  .header-main .horizontalMenu .sub-menu > li > a {
    display: flex; align-items: center; gap: 12px;
    color: var(--hm-navy); font-weight: 600; font-size: 15px; border-radius: 12px; padding: 8px 12px; background: transparent;
    transition: background .15s ease, color .15s ease;
  }
  .header-main .horizontalMenu .sub-menu > li > a .nav-icon {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 36px; height: 36px; margin: 0 !important; border-radius: 10px; font-size: 15px;
    background: var(--hm-tint); color: var(--hm-orange-deep); transition: background .15s ease, color .15s ease;
  }
  .header-main .horizontalMenu .sub-menu > li:hover > a,
  .header-main .horizontalMenu .sub-menu > li > a:hover { background: #fff6e8 !important; color: var(--hm-orange-deep) !important; padding-left: 12px; }
  .header-main .horizontalMenu .sub-menu > li:hover > a .nav-icon,
  .header-main .horizontalMenu .sub-menu > li > a:hover .nav-icon { background: var(--hm-orange) !important; color: #fff !important; }

  /* "Need help?" pill */
  .header-main .contact-help-block {
    border: 1px solid var(--hm-line); border-radius: 999px; padding: 6px 20px 6px 8px; margin: 0 !important; background: #fff;
    box-shadow: 0 4px 14px rgba(11, 19, 43, .05); white-space: nowrap;
  }
  .header-main .contact-help-icon {
    width: 42px; height: 42px; margin: 0 12px 0 0 !important; border-radius: 50%; background: var(--hm-tint);
    display: inline-flex; align-items: center; justify-content: center;
  }
  .header-main .contact-help-content .text-muted { font-size: 12px !important; font-weight: 600 !important; text-transform: none !important; color: #6b7280 !important; }
  .header-main .contact-help-block .phone-number { font-size: clamp(14px, 1.1vw, 17px); }
  .header-main .contact-help-block .phone-number span { color: var(--hm-navy) !important; }

  /* call-to-action */
  .header-main .horizontalMenu > ul.mb-0 { flex: 0 0 auto; }
  .header-main .horizontalMenu > .horizontalMenu-list { min-width: 0; }
  .header-main .contact-help-block { flex: 0 0 auto; }
  .header-main .top-postbtn { margin: 0 !important; padding: 0; }
  .header-main .top-postbtn .ad-post {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, var(--hm-orange), var(--hm-orange-deep));
    border: 0; border-radius: 999px; padding: 15px clamp(16px, 1.9vw, 30px); font-size: clamp(14px, 1.1vw, 17px); font-weight: 700; color: #fff; white-space: nowrap;
    box-shadow: 0 12px 24px rgba(255, 122, 0, .32);
    transition: transform .2s ease, box-shadow .2s ease;
  }
  .header-main .top-postbtn .ad-post i { margin: 0 !important; font-size: 19px; }
  .header-main .top-postbtn .ad-post:hover { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(255, 122, 0, .42); color: #fff; }

  /* sticky: same bar, thin brand line on top */
  .header-main .sticky-wrapper.is-sticky .horizontal-main {
    background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 10px 28px rgba(11, 19, 43, .16);
    height: auto !important;
    overflow: visible;
  }
  .header-main .sticky-wrapper.is-sticky .horizontal-main::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
    border-radius: 0; background: linear-gradient(90deg, var(--hm-purple), #9c31df 45%, var(--hm-orange));
  }
  .header-main .sticky-wrapper.is-sticky .horizontalMenu > .horizontalMenu-list > li { padding: 0; }
  .header-main .sticky-wrapper.is-sticky .horizontal-mainwrapper .desktoplogo-1 { padding: 8px 0; display: block !important; }
  .header-main .sticky-wrapper.is-sticky .top-postbtn { margin-top: 0 !important; }
  /* the template recolours links while sticky: keep them in the same style */
  .header-main .sticky-wrapper.is-sticky .horizontalMenu > .horizontalMenu-list > li > a { background: none !important; color: var(--hm-navy) !important; box-shadow: none; }
  .header-main .sticky-wrapper.is-sticky .horizontalMenu > .horizontalMenu-list > li:hover > a { background: var(--hm-tint) !important; color: var(--hm-orange-deep) !important; }
  .header-main .sticky-wrapper.is-sticky .horizontalMenu > .horizontalMenu-list > li > a.active { background: none !important; color: var(--hm-orange-deep) !important; }
}

/* 992-1599px: tighter spacing so everything stays on one row */
@media (min-width: 992px) and (max-width: 1599.98px) {
  .header-main .horizontal-mainwrapper { gap: .5rem; }
  .header-main .horizontalMenu > .horizontalMenu-list { gap: 0; }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a { font-size: 14px; padding: 9px 9px; }
  .header-main .horizontalMenu > .horizontalMenu-list > li.mobile-contact-container { margin-left: auto; }
  /* spread the spare room equally between the items: the same gap between every link, and the help pill */
  .header-main .horizontalMenu > .horizontalMenu-list > li:first-child { margin-left: 0; }
  .header-main .horizontalMenu > .horizontalMenu-list > li:not(:first-child) { margin-left: auto; }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a .fa-caret-down { margin-left: 5px !important; }
  .header-main .top-postbtn .ad-post { padding: 11px 16px; font-size: 14px; }
  .header-main .top-postbtn .ad-post i { font-size: 16px; }
  .header-main .horizontal-mainwrapper.container { max-width: 98vw; }
  .header-main .contact-help-block .phone-number { font-size: 14px; }
  .header-main .contact-help-icon { width: 34px; height: 34px; margin-right: 8px !important; }
  .header-main .contact-help-block { padding-right: 12px; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  .header-main .sticky-wrapper:not(.is-sticky) .horizontal-mainwrapper .desktoplogo img { max-height: 46px; }
  .header-main .contact-help-block { display: none !important; }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a { padding: 8px 6px; font-size: 13px; }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a .fa-caret-down { margin-left: 3px !important; }
  .header-main .top-postbtn .ad-post { padding: 9px 13px; font-size: 13px; gap: 5px; }
}

/* ================= Tablet / mobile ================= */
@media (max-width: 991.98px) {
  .header-main .horizontal-header {
    background: #fff;
    border-bottom: 1px solid var(--hm-line);
    border-radius: 0 0 22px 22px;
    box-shadow: 0 8px 20px rgba(11, 19, 43, .10);
    position: relative;
  }
  .header-main .horizontal-header::after {
    content: ""; position: absolute; left: 22px; right: 22px; bottom: -1px; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, var(--hm-purple), #9c31df 45%, var(--hm-orange));
  }
  .header-main .animated-arrow span, .header-main .animated-arrow span::before, .header-main .animated-arrow span::after { background: var(--hm-navy); }

  /* slide-out menu */
  .header-main .horizontalMenu > .horizontalMenu-list > li > a {
    color: var(--hm-navy); font-weight: 600; border-radius: 12px; margin: 2px 10px; padding: 12px 14px;
  }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a.active {
    background: var(--hm-tint); color: var(--hm-orange-deep);
  }
  .header-main .horizontalMenu > .horizontalMenu-list > li > a.active .nav-icon { color: var(--hm-orange-deep) !important; }
  .header-main .horizontalMenu .sub-menu > li > a { color: var(--hm-navy); }
  .header-main .horizontalMenu .sub-menu > li > a .nav-icon { color: var(--hm-orange-deep); }
  .header-main .contact-help-block { border: 1px solid var(--hm-line); border-radius: 999px; padding: 6px 16px 6px 8px; }
  .header-main .horizontalMenu .top-postbtn .ad-post,
  .header-main .horizontalMenu .ad-post {
    background: linear-gradient(135deg, var(--hm-orange), var(--hm-orange-deep));
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%;
    border: 0; border-radius: 999px; padding: 10px 24px; font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap;
    box-shadow: 0 8px 18px rgba(255, 122, 0, .28);
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-main * { transition: none !important; }
}
