/* =====================================================================
   Shells: public site, customer app, panel (shop/admin), rider app.
   ===================================================================== */

/* ------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-dark {
  background: var(--brand-deep);
  border-bottom-color: transparent;
  color: #fff;
}
.topbar-dark a, .topbar-dark .brand-name { color: #fff; }
.topbar-dark .topbar-link { color: rgba(255, 255, 255, 0.82); }
.topbar-dark .topbar-link:hover, .topbar-dark .topbar-link.is-active { color: #fff; background: rgba(255, 255, 255, 0.14); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--brand-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--sh-brand);
  flex: 0 0 auto;
}
.brand-name { font-size: var(--t-md); line-height: 1.1; }
.brand-sub {
  display: block;
  font-size: 10px;
  font-weight: 650;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: var(--t-sm);
  font-weight: 650;
  color: var(--ink-soft);
  transition: all var(--fast);
  position: relative;
}
.topbar-link:hover { background: var(--surface-3); color: var(--ink); }
.topbar-link.is-active { background: var(--brand-soft); color: var(--brand-deep); }
.topbar-link .count-bubble { position: absolute; top: 3px; right: 4px; }

/* ------------------------------------------------------- customer shell */

.app-main { padding: 18px 0 30px; min-height: 60vh; }
.app-main.has-tabbar { padding-bottom: calc(var(--tabbar-h) + 26px); }

@media (min-width: 860px) {
  .app-main.has-tabbar { padding-bottom: 40px; }
}

/* Delivering-to bar */
.addr-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 420;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  transition: transform var(--med);
}
.addr-bar.is-hidden { transform: translateY(-105%); }
.addr-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.addr-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  color: var(--ink);
}
.addr-btn:hover { color: var(--ink); }
.addr-ic {
  width: 34px; height: 34px;
  border-radius: var(--r-xs);
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.addr-label {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.addr-text {
  font-size: var(--t-sm);
  font-weight: 600;
  min-width: 0;
  display: block;
}
.addr-search {
  flex: 1 1 280px;
  max-width: 420px;
  min-width: 200px;
}
.addr-search .input-group > .input,
.addr-search .input-group > .btn {
  height: 44px;
  min-height: 44px;
  box-shadow: none;
}
@media (max-width: 720px) {
  .addr-bar-inner { flex-wrap: wrap; }
  .addr-btn { flex: 1 1 100%; }
  .addr-search { flex: 1 1 100%; max-width: none; min-width: 0; }
}

.addr-menu {
  position: absolute;
  left: var(--gutter); right: var(--gutter);
  top: calc(100% + 6px);
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  overflow: hidden;
  display: none;
  z-index: 430;
}
.addr-menu.is-open { display: block; animation: pop-in var(--fast) both; }
.addr-menu-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.addr-menu-item:last-of-type { border-bottom: 0; }
.addr-menu-item:hover { background: var(--surface-2); color: var(--ink); }
.addr-menu-item.is-active { background: var(--brand-soft); }

/* Bottom tab bar */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tabbar-h);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  z-index: 600;
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 860px) { .tabbar { display: none; } }

.tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-faint);
  position: relative;
  transition: color var(--fast);
}
.tab.is-active { color: var(--brand-strong); }
.tab.is-active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 3px;
  border-radius: 0 0 var(--r-pill) var(--r-pill);
  background: var(--brand);
}
.tab .count-bubble { position: absolute; top: 8px; right: calc(50% - 20px); }

.tab-fab {
  flex: 0 0 auto;
  width: 62px;
  display: grid;
  place-items: center;
}
.tab-fab span {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--sh-brand);
  margin-top: -18px;
  border: 3px solid var(--surface);
}

/* Floating cart pill (shop page on mobile) */
.cart-fab {
  position: fixed;
  left: 14px; right: 14px;
  bottom: calc(var(--tabbar-h) + 12px);
  z-index: 560;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--r-pill);
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: var(--sh-3);
  animation: toast-in var(--med) both;
}
.cart-fab:hover { color: #fff; }
@media (min-width: 860px) {
  .cart-fab { left: auto; right: 24px; bottom: 24px; width: auto; min-width: 250px; }
}

/* ---------------------------------------------------------- panel shell */

.panel {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}
@media (max-width: 1000px) {
  .panel { grid-template-columns: 1fr; }
}

.panel-side {
  background: var(--brand-deep);
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
@media (max-width: 1000px) {
  .panel-side { position: static; height: auto; }
}

.panel-brand {
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.panel-brand .brand-mark { background: rgba(255, 255, 255, 0.16); box-shadow: none; }
.panel-brand .panel-brand-name { color: #fff; font-weight: 800; font-size: var(--t-base); line-height: 1.2; }
.panel-brand .panel-brand-sub { display: block; font-size: var(--t-xs); color: rgba(255, 255, 255, 0.6); }

.panel-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
}
@media (max-width: 1000px) {
  .panel-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding: 10px var(--gutter);
    scrollbar-width: none;
  }
  .panel-nav::-webkit-scrollbar { display: none; }
}

.panel-nav-group {
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.4);
  padding: 12px 12px 5px;
}
@media (max-width: 1000px) { .panel-nav-group { display: none; } }

.panel-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, 0.78);
  font-size: var(--t-sm);
  font-weight: 650;
  white-space: nowrap;
  transition: all var(--fast);
}
.panel-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.panel-link.is-active { background: rgba(255, 255, 255, 0.17); color: #fff; }
.panel-link .count-bubble { margin-left: auto; }
.panel-link .panel-link-flag {
  margin-left: auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warn-500);
}

.panel-side-foot {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
@media (max-width: 1000px) { .panel-side-foot { display: none; } }

.panel-main { min-width: 0; display: flex; flex-direction: column; }

.panel-top {
  position: sticky;
  top: 0;
  z-index: 400;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.panel-title { font-size: var(--t-lg); font-weight: 800; letter-spacing: -0.02em; }
.panel-subtitle { font-size: var(--t-xs); color: var(--ink-muted); }
.panel-top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.panel-content { padding: 20px var(--gutter) 40px; flex: 1 1 auto; }
@media (max-width: 640px) { .panel-content { padding-bottom: 30px; } }

/* Split layout: sticky form on the left, list on the right */
.split {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.split > .split-side { position: sticky; top: 84px; }
@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .split > .split-side { position: static; }
}

/* ---------------------------------------------------------- rider shell */

.rider-shell {
  max-width: 640px;
  margin-inline: auto;
  padding: 16px var(--gutter) calc(var(--tabbar-h) + 26px);
}
@media (min-width: 860px) { .rider-shell { padding-bottom: 40px; } }

/* ----------------------------------------------------------- auth shell */

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 26px var(--gutter);
  background:
    radial-gradient(1000px 500px at 12% -8%, var(--brand-soft), transparent 60%),
    radial-gradient(800px 420px at 92% 108%, var(--brand-soft), transparent 60%),
    var(--page);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-3);
  padding: 30px 26px;
}
.auth-card.is-wide { max-width: 700px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-mark {
  width: 54px; height: 54px;
  border-radius: var(--r-md);
  background: var(--brand-gradient);
  color: #fff;
  display: grid; place-items: center;
  margin: 0 auto 14px;
  box-shadow: var(--sh-brand);
}
.auth-head h1 { font-size: var(--t-xl); }
.auth-head p { font-size: var(--t-sm); color: var(--ink-muted); margin-top: 4px; }
.auth-foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: var(--t-sm);
  color: var(--ink-muted);
}

/* Role switcher on login screens */
.role-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  background: var(--surface-3);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}
.role-switch a {
  padding: 8px 4px;
  border-radius: var(--r-xs);
  text-align: center;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink-muted);
}
.role-switch a.is-active { background: var(--surface); color: var(--brand-strong); box-shadow: var(--sh-1); }

/* Step dots for OTP / multi-step forms */
.steps { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 18px; }
.steps span {
  width: 26px; height: 4px;
  border-radius: var(--r-pill);
  background: var(--line-strong);
}
.steps span.is-done { background: var(--brand); }

/* ------------------------------------------------------------- footer */

.site-foot {
  background: var(--slate-900);
  color: rgba(255, 255, 255, 0.62);
  padding: 34px 0 26px;
  font-size: var(--t-sm);
  margin-top: 40px;
}
.site-foot a { color: rgba(255, 255, 255, 0.82); }
.site-foot a:hover { color: #fff; }
.site-foot h4 { color: #fff; font-size: var(--t-sm); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.site-foot-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 26px;
}
@media (max-width: 760px) {
  .site-foot-grid { grid-template-columns: repeat(2, 1fr); }
  .site-foot-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .site-foot-grid { grid-template-columns: 1fr; }
  .site-foot-grid > :first-child { grid-column: auto; }
}
.site-foot-bottom {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  font-size: var(--t-xs);
}
