/* =========================================================
   LAYOUT  -  topbar, header, menu, drawer, bottom nav, footer
   ========================================================= */

/* ---------- TOPBAR ---------- */
.topbar {
  background: var(--mint-dark);
  color: var(--white);
  text-align: center;
  font-size: .82rem;
  font-weight: 600;
  padding: 7px 12px;
}
.topbar strong { color: var(--yellow); }

/* ---------- HEADER ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--bg);
  padding: 10px 0;
  transition: box-shadow var(--ease);
}
.site-header.scrolled { box-shadow: 0 6px 18px rgba(var(--shadow-rgb), .08); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 8px 12px 8px 18px;
  box-shadow: var(--shadow-clay);
}

/* logo */
.logo { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-gem {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--peach-soft);
  color: var(--primary);
  font-size: 1.1rem;
  box-shadow: var(--shadow-clay-sm);
}
.logo-text {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--mint-deep);
  letter-spacing: .3px;
}

/* actions */
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.icon-btn {
  position: relative;
  width: 42px; height: 42px;
  display: inline-grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.05rem;
  box-shadow: var(--shadow-clay-sm);
  transition: transform var(--ease), color var(--ease), background var(--ease);
}
.icon-btn:hover { color: var(--primary); transform: translateY(-2px); }
.icon-btn:active { transform: translateY(0); }

.badge-dot {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--white);
  font-size: .7rem;
  font-weight: 800;
  line-height: 1;
  font-style: normal;
  box-shadow: 0 2px 6px rgba(var(--primary-rgb), .45);
}
.badge-dot[hidden] { display: none; }

.menu-toggle { display: none; }

/* ---------- DESKTOP NAV ---------- */
.main-nav { flex: 1; display: flex; justify-content: center; }
.main-nav > ul { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: .95rem;
  transition: background var(--ease), color var(--ease);
}
.main-nav a:hover { background: var(--mint-soft); color: var(--mint-deep); }
.main-nav a.active {
  background: var(--mint-soft);
  color: var(--mint-deep);
  box-shadow: var(--shadow-inset);
}
.nav-caret { font-size: .65rem; transition: transform var(--ease); }
.has-dropdown:hover .nav-caret { transform: rotate(180deg); }

/* dropdown */
.has-dropdown, .account-menu { position: relative; }
.dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 230px;
  padding: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--ease), transform var(--ease), visibility var(--ease);
  z-index: 5;
}
.dropdown::before { content: ""; position: absolute; top: -14px; left: 0; right: 0; height: 14px; }
.dropdown-right { left: auto; right: 0; }
.has-dropdown:hover > .dropdown,
.has-dropdown:focus-within > .dropdown,
.account-menu:hover > .dropdown,
.account-menu:focus-within > .dropdown { opacity: 1; visibility: visible; transform: none; }

.dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .92rem;
}
.dropdown a i { width: 18px; color: var(--mint-dark); }
.main-nav .dropdown a { border-radius: var(--radius-sm); }
.dropdown a:hover { background: var(--peach-soft); color: var(--text); }
.dropdown-title {
  display: block;
  padding: 8px 14px 6px;
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--mint-deep);
}

/* ---------- SEARCH PANEL ---------- */
.search-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}
.site-header.search-open .search-panel { max-height: 75vh; overflow-y: auto; }

.search-form {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
  padding: 8px 8px 8px 18px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-inset);
}
.search-form > i { color: var(--text-light); }
.search-form input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: 0;
  padding: 8px 0;
}
.search-results { padding: 8px 0 6px; }
.search-results:empty { padding: 0; }
.sr-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  transition: background var(--ease);
}
.sr-item:hover { background: var(--surface-2); }
.sr-item img { width: 52px; height: 52px; border-radius: var(--radius-sm); object-fit: cover; background: var(--peach-soft); }
.sr-item strong { display: block; font-size: .95rem; line-height: 1.3; }
.sr-item span { font-size: .85rem; color: var(--mint-deep); font-weight: 700; }
.sr-empty { padding: 14px; text-align: center; color: var(--text-soft); }
.sr-all {
  display: block;
  margin-top: 6px;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius-pill);
  background: var(--mint-soft);
  color: var(--mint-deep);
  font-weight: 800;
  font-size: .9rem;
}
.sr-all:hover { background: var(--mint); }

/* ---------- DRAWER (mobile) ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(var(--shadow-rgb), .45);
  opacity: 0; visibility: hidden;
  transition: opacity var(--ease), visibility var(--ease);
  z-index: var(--z-overlay);
}
body.drawer-open .overlay { opacity: 1; visibility: visible; }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: min(86vw, 320px);
  display: flex; flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: var(--mint);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  transform: translateX(-105%);
  transition: transform .3s ease;
  z-index: var(--z-drawer);
  overflow-y: auto;
}
body.drawer-open .drawer { transform: none; }

.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-user { display: flex; align-items: center; gap: 12px; }
.drawer-avatar {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--mint-deep);
  font-size: 1.2rem;
  box-shadow: var(--shadow-clay-sm);
}
.drawer-hi { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; color: var(--mint-deep); }

.drawer-nav { display: flex; flex-direction: column; gap: 6px; }
.drawer-nav a {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  color: var(--mint-deep);
  transition: background var(--ease);
}
.drawer-nav a i { width: 20px; text-align: center; }
.drawer-nav a:hover { background: rgba(var(--white-rgb), .35); }
.drawer-nav a.active { background: var(--surface-2); box-shadow: var(--shadow-clay-sm); color: var(--mint-deep); }

.drawer-cats { display: flex; flex-direction: column; gap: 2px; }
.drawer-label { padding: 0 16px 6px; font-size: .8rem; font-weight: 800; color: var(--mint-deep); opacity: .75; }
.drawer-cats a { padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600; color: var(--mint-deep); }
.drawer-cats a:hover { background: rgba(var(--white-rgb), .35); }

.drawer-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

/* ---------- BOTTOM NAV (mobile) ---------- */
.bottom-nav { display: none; }

/* ---------- PAGE HERO / BREADCRUMB ---------- */
.page-hero {
  margin: 8px 0 8px;
  padding: 28px 24px;
  text-align: center;
  background: var(--peach-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-clay);
}
.page-hero h1 { margin-bottom: 6px; }
.breadcrumb { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; font-size: .88rem; color: var(--text-soft); font-weight: 600; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb li + li::before { content: "/"; margin-right: 8px; color: var(--text-light); }

/* ---------- SECTION HEAD ---------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head p { color: var(--text-soft); margin-top: 4px; }
.link-more { font-weight: 800; color: var(--mint-dark); white-space: nowrap; }
.link-more:hover { color: var(--primary); }

/* ---------- FOOTER ---------- */
.site-footer {
  margin-top: 56px;
  padding: 48px 0 24px;
  background: var(--mint-soft);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.3fr; gap: 32px; }
.footer-col h4 { margin-bottom: 14px; color: var(--mint-deep); }
.footer-col li { margin-bottom: 8px; }
.footer-col a:hover { color: var(--primary); }
.footer-brand p { margin: 14px 0; color: var(--text-soft); max-width: 320px; }
.footer-contact li { display: flex; gap: 10px; align-items: flex-start; }
.footer-contact i { margin-top: 5px; color: var(--mint-dark); width: 16px; }

.social { display: flex; gap: 10px; }
.social a {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--mint-deep);
  box-shadow: var(--shadow-clay-sm);
  transition: transform var(--ease), color var(--ease);
}
.social a:hover { transform: translateY(-3px); color: var(--primary); }

.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 36px; padding-top: 18px;
  border-top: 2px dashed var(--mint);
  font-size: .88rem; color: var(--text-soft);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 992px) {
  .main-nav, .hide-md { display: none !important; }
  .menu-toggle { display: inline-grid; }
  .header-inner { padding: 8px 12px; }
  .logo { margin: 0 auto 0 0; }
  .header-actions { margin-left: 0; }

  body { padding-bottom: calc(var(--bottom-nav-h) + 28px); }

  .bottom-nav {
    position: fixed;
    left: 12px; right: 12px; bottom: 10px;
    height: var(--bottom-nav-h);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: var(--surface-2);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-lg), inset 0 2px 3px rgba(var(--white-rgb), .9);
    z-index: var(--z-bottom);
    padding: 6px;
  }
  .bottom-nav a {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    border-radius: var(--radius-pill);
    color: var(--text-soft);
    font-size: .68rem;
    font-weight: 700;
    transition: background var(--ease), color var(--ease);
  }
  .bottom-nav a i { font-size: 1.1rem; }
  .bottom-nav a.active { background: var(--peach-soft); color: var(--primary); box-shadow: var(--shadow-inset); }
  .bottom-nav .badge-dot { top: 2px; right: 50%; margin-right: -24px; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (min-width: 993px) {
  .drawer, .overlay { display: none; }
}

@media (max-width: 560px) {
  .topbar { font-size: .74rem; }
  .logo-text { font-size: 1.3rem; }
  .logo-gem { width: 36px; height: 36px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .site-footer { margin-top: 40px; padding-top: 36px; }
}