/* ============================================================================
   CYRAHOP — header.css
   Dual-row sticky header, location modal, global search, avatar menu, footer.
   Mobile-first.
   ============================================================================ */

/* ---- Shell --------------------------------------------------------------- */
.hdr {
  position: sticky;
  top: 0;
  z-index: var(--header-z);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  transition: transform 0.25s ease;
}
/* hide-on-scroll-down / show-on-scroll-up (toggled by location.js/header script) */
.hdr[data-state="hidden"] { transform: translateY(-100%); }

/* ---- Row 1: subheader ---------------------------------------------------- */
.hdr-sub {
  background: #E3F2F8;       /* soft warm-pink bar */
  color: var(--text-main);
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(31, 75, 93, 0.18);
}
.hdr-sub-in {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
}
.loc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  font-weight: 500;
  white-space: nowrap;
}
.loc-pill .loc-city { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--primary); }
.loc-ic { color: var(--primary); }
.loc-chev { font-size: 0.7rem; opacity: 0.7; }

.hdr-tabs {
  display: none;          /* hidden on mobile; tabs collapse into the page */
  align-items: center;
  gap: 4px;
  margin-inline: auto;
}
.hdr-tab {
  padding: 10px 12px;
  color: var(--text-muted);
  font-family: var(--font-head);
  font-weight: 500;
  border-bottom: 2px solid transparent;
}
.hdr-tab:hover { color: var(--text-main); }
.hdr-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.lang-toggle {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
}
.lang-toggle:hover { color: var(--primary); border-color: var(--primary); }

/* ---- Row 2: main nav ----------------------------------------------------- */
.hdr-main-in {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
}
.brand {
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  white-space: nowrap;
}
.brand span { color: var(--primary); }
.brand-img { height: 28px; width: auto; display: block; }

/* search */
.search {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding-left: 6px;
  min-width: 0;
  position: relative;
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(240, 126, 71, .20); }
.search-scope { display: none; }            /* collapses on mobile */
.search-scope select {
  border: none; background: transparent; padding: 0 8px;
  font-size: 0.85rem; color: var(--text-muted); cursor: pointer; width: auto;
}
.search-ic { padding: 0 4px 0 8px; color: var(--text-hint); }
.search input[type="search"] {
  flex: 1; border: none; background: transparent; padding: 11px 8px;
  font-size: 0.9rem; min-width: 0;
}
.search input[type="search"]:focus { box-shadow: none; }
.search-go { border-radius: var(--radius-pill); padding: 9px 14px; margin: 4px; }
.search-go-text { display: none; }
.search-go-ic { display: inline; }

/* autocomplete dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  z-index: 5;
}
.search-results li > a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; font-size: 0.9rem;
}
.search-results li > a:hover,
.search-results li.is-active > a { background: var(--bg-page); }
.search-results .sr-thumb { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--border); flex: 0 0 auto; }
.search-results .sr-cat { margin-left: auto; font-size: 0.72rem; color: var(--text-muted); }

/* actions */
.hdr-actions { display: flex; align-items: center; gap: 10px; }
.hdr-link { font-weight: 500; font-size: 0.9rem; white-space: nowrap; }
.hdr-link:hover { color: var(--primary); }
.hdr-download { display: none; }            /* hidden on small screens */

/* avatar menu */
.avatar-menu { position: relative; }
.avatar-btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 0.9rem; }
.avatar-circle {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: var(--on-pastel);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.85rem;
}
.avatar-name { display: none; }
.avatar-drop {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 190px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover); overflow: hidden; z-index: 5;
}
.avatar-drop a { display: block; padding: 11px 16px; font-size: 0.9rem; }
.avatar-drop a:hover { background: var(--bg-page); }

/* ---- Location modal ------------------------------------------------------ */
/* Hidden by default — the [hidden] attribute MUST win, so scope display to
   :not([hidden]). Without this, `display:flex` would override [hidden] and the
   modal would auto-show on every page load. */
.loc-modal[hidden] { display: none !important; }
.loc-modal:not([hidden]) {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.loc-modal-card {
  background: var(--bg-card); width: 100%; max-width: 460px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px; box-shadow: var(--shadow-hover);
}
.loc-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.loc-modal-x { font-size: 1.1rem; color: var(--text-muted); }
.loc-or { text-align: center; color: var(--text-hint); font-size: 0.8rem; margin: 14px 0; }
.loc-cities { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.loc-city-opt {
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 12px; font-weight: 500;
}
.loc-city-opt:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Footer -------------------------------------------------------------- */
.ftr { background: var(--bg-card); border-top: 1px solid var(--border); margin-top: 40px; }
.ftr-in { padding-block: 32px; }
.ftr-grid { display: grid; grid-template-columns: 1fr; gap: 28px; }
.ftr-brand { font-size: 1.3rem; }
.ftr-tag { font-size: 0.88rem; margin: 8px 0 14px; }
.ftr-apps { display: flex; gap: 10px; flex-wrap: wrap; }
.store-badge {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 9px 14px; font-size: 0.85rem; font-weight: 500;
}
.store-badge:hover { border-color: var(--text-muted); }
.ftr-col h4 { font-size: 0.95rem; margin-bottom: 12px; }
.ftr-col a { display: block; padding: 5px 0; font-size: 0.88rem; color: var(--text-muted); }
.ftr-col a:hover { color: var(--primary); }
.ftr-bottom {
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid var(--border); margin-top: 28px; padding-top: 18px;
  font-size: 0.8rem;
}

/* ===========================================================================
   Desktop (>=768px)
   =========================================================================== */
@media (min-width: 768px) {
  .hdr-tabs { display: flex; }
  .search-scope {
    display: flex; align-items: center;
    border-right: 1px solid var(--border); margin-right: 4px;
  }
  .search-go-text { display: inline; }
  .search-go-ic { display: none; }
  .hdr-download { display: inline-flex; }
  .avatar-name { display: inline; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .loc-modal { align-items: center; }
  .loc-modal-card { border-radius: var(--radius-lg); }

  .ftr-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr; gap: 28px; align-items: start; }
  .ftr-bottom { flex-direction: row; justify-content: space-between; }
}

/* Staff (vendor/rider/admin) management header */
.hdr-portal-label { font-size: 0.85rem; font-weight: 600; color: var(--teal); margin-left: 4px; }
.hdr-actions-staff { margin-left: auto; }

/* Message icon + unread badge — present on every page (header is global). */
.hdr-msg { position: relative; }
.hdr-msg-badge {
  /* Unread messages → yellow (saffron) badge with dark text. */
  position: absolute; top: -6px; right: -8px; background: var(--yellow, #FFC64F); color: var(--teal, #20373B);
  font-size: .66rem; font-weight: 700; border-radius: 999px; padding: 1px 6px; min-width: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg-page, #fff);
}

/* Vendor "orders need attention" bell — badge appears only when count > 0. */
.hdr-bell { position: relative; }
.hdr-bell-badge {
  position: absolute; top: -6px; right: -8px; background: #e5484d; color: #fff;
  font-size: .66rem; font-weight: 700; border-radius: 999px; padding: 1px 6px; min-width: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg-page, #fff);
}
/* When there's something to attend to, tint the bell itself for emphasis. */
.hdr-bell.has-alert { color: #e5484d; }

/* ============================================================================
   App-style bottom tab bar — mobile only (Talabat/Snoonu pattern).
   ========================================================================== */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    background: var(--teal, #20373B); border-top: 1px solid rgba(255,255,255,.08);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 16px rgba(22, 58, 56, 0.22);
  }
  .tabbar-item {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: rgba(255,255,255,.66); font-weight: 600; text-decoration: none; padding: 4px 0;
  }
  .tabbar-ic { position: relative; font-size: 20px; line-height: 1; }
  .tabbar-label { font-size: 10px; }
  .tabbar-item.is-on { color: var(--yellow, #FFC64F); }
  .tabbar-dot {
    position: absolute; top: -2px; right: -6px; width: 8px; height: 8px;
    background: var(--yellow, #FFC64F); border-radius: 50%; box-shadow: 0 0 0 2px var(--teal, #20373B);
  }
  /* Lift page content & sticky cart bars above the fixed tab bar. */
  body { padding-bottom: 64px; }
  .cart-bar, .cart-bar-fixed { bottom: 64px; }
}

/* ---- Mega footer extras (Snoonu-style, light footer) --------------------- */
.ftr-more { border-top: 1px solid var(--border); margin-top: 22px; padding-top: 20px; }
.ftr-more h4 { font-size: .9rem; margin-bottom: 12px; }
.ftr-more-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ftr-svc { display: flex; align-items: center; gap: 10px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; color: var(--text-main); }
.ftr-svc:hover { border-color: var(--primary); }
.ftr-svc span { font-size: 1.5rem; }
.ftr-svc b { display: block; font-size: .88rem; }
.ftr-svc small { color: var(--text-muted); font-size: .74rem; }
/* Highlighted "Enroll your shop" CTA card */
.ftr-svc-cta { background: linear-gradient(120deg, var(--primary), var(--primary-dark)); border-color: transparent; color: #fff; box-shadow: 0 8px 18px rgba(31, 75, 93,.30); }
.ftr-svc-cta:hover { border-color: transparent; transform: translateY(-1px); }
.ftr-svc-cta small { color: rgba(255,255,255,.9); }
.ftr-social { display: flex; gap: 10px; }
.ftr-social a { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-main); font-weight: 700; }
.ftr-social a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.ftr-bottom { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
@media (min-width: 760px) { .ftr-more-row { grid-template-columns: repeat(4, 1fr); } }

/* CyraWash icon-suite sizing in the tab bar + footer social */
.tabbar-svg{ width:22px; height:22px; display:block; }
.ftr-social a img{ width:20px; height:20px; display:block; }

/* Text wordmark logo (CyRaHop rebrand — replaces the image logo) */
.brand-wordmark{
  font-family:var(--font-head, 'Poppins', sans-serif); font-weight:800;
  font-size:1.5rem; letter-spacing:-.02em; color:var(--primary, #ED7B6A);
  text-decoration:none; line-height:1; white-space:nowrap;
}
.ftr-brand.brand-wordmark{ font-size:1.35rem; display:inline-block; }
.admin-brand.brand-wordmark{ font-size:1.1rem; color:#fff; }
.admin-brand.brand-wordmark small{ color:rgba(255,255,255,.6); font-weight:500; }
