:root{
  /* Neutral background to make product photos pop (white/transparent images look best) */
  --bg:#f6f7f8;
  --card:#ffffff;
  --text:#0b1f1e;
  --muted:#5c6e6d;
  --brand:#27c7c2; /* акцент */
  --brand-dark:#0b6f6b;
  --border:rgba(0,0,0,.08);
  --shadow:0 10px 26px rgba(0,0,0,.08);
  --radius:16px;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.35;
}

/* Subtle section spacing on the public landing */
main.container{ padding-top: 8px; }

img{ max-width:100%; }

.container{
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.h1{ font-size: 28px; margin: 0 0 8px; }
.h3{ font-size: 16px; margin: 0 0 8px; }
.muted{ color: var(--muted); }
.link{ color: var(--brand-dark); text-decoration: none; }
.link:hover{ text-decoration: underline; }

/* Header */
.site-header{
  background: var(--brand);
  color: #083b39;
  box-shadow: var(--shadow);
}
.header-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  padding: 14px 0;
}
.brand-link{
  font-weight: 900;
  letter-spacing: .6px;
  color: #053f3c;
  text-decoration:none;
  font-size: 18px;
}
.nav{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content:flex-end;
}
.nav-link{
  color:#053f3c;
  text-decoration:none;
  font-weight:700;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.25);
  border: 1px solid rgba(255,255,255,.25);
}
.nav-link:hover{ background: rgba(255,255,255,.35); }
.nav-link.active{ background: rgba(255,255,255,.55); }

/* Controls */
.input, .select{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  outline: none;
}
.input:focus, .select:focus{
  border-color: rgba(11,111,107,.35);
  box-shadow: 0 0 0 3px rgba(39,199,194,.18);
}
.btn{
  border: 1px solid rgba(11,111,107,.25);
  background: var(--brand);
  color: #053f3c;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
  cursor:pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.btn:hover{ filter: brightness(0.98); }
.btn:active{ transform: translateY(1px); }
.btn-ghost{
  background: #fff;
  color: var(--brand-dark);
}

/* Footer */
.site-footer{
  margin-top: 22px;
  padding: 18px 0 22px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.footer-row{
  display:flex;
  gap: 16px;
  justify-content:space-between;
  align-items:center;
  flex-wrap: wrap;
}
.footer-left{
  display:flex;
  align-items:center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-logo{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  background: rgba(39,199,194,.18);
  border: 1px solid rgba(0,0,0,.06);
}
.footer-links{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}
.footer-link{
  color: var(--brand-dark);
  text-decoration:none;
  font-size: 12px;
}
.footer-link:hover{ text-decoration: underline; }
.footer-right{ font-size: 12px; }

/* Utility blocks */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(0,0,0,.12);
}

/* Session indicator (header) */
.session-indicator{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.25);
  border: 1px solid rgba(255,255,255,.25);
  color:#053f3c;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}
.si-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.15);
  background: #cbd5d4;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35) inset;
}
.si-dot.on{ background: #20c997; }
.si-dot.off{ background: #cbd5d4; }

/* BAAZAAR — nickname mode
   Build: step02-2026-02-01-01
   If a user has profiles.display_name set, headerStatus.js sets body[data-has-name="1"].
   In that case we hide the status dot (and any future status decorations) and show only the name.
*/
body[data-has-name="1"] #sessionIndicator .si-dot{ display:none; }

/* Place indicator next to nav */
.header-right{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content:flex-end;
}

/* BAAZAAR — anti-flash admin link rule
   Build: step29-2026-02-01-01
   Purpose: Prevent a brief flash of the Admin link for non-admin users on page reload.
*/

/* Hide admin link by default (prevents a brief flash on reload) */
a[href="admin.html"]{ display: none; }

/* Show only when headerStatus.js sets body[data-role="admin"] */
body[data-role="admin"] a[href="admin.html"]{ display: inline-flex; }

/* ===============================
   BAAZAAR header stable navigation (role-based)
   Build: step34-2026-02-01-01
   Goal: NO flicker. Hide role-only links + auth link by default,
         reveal only when body[data-role] is resolved.
   =============================== */

/* Hide role-only NAV links by default to prevent flash.
   IMPORTANT: Scope to top nav only, do NOT hide links inside dropdown menus.
*/
.nav > a[href*="admin.html"],
.nav > a[href*="seller.html"],
.nav > a[href*="cart.html"],
.nav > a[href*="cabinet.html"],
.nav > a[href*="profile.html"]{
  display: none;
}

/* Hide auth NAV link by default to prevent flicker for logged-in users */
.nav > a[href*="auth.html"]{
  display: none;
}

/* Show auth NAV link only for guests */
body[data-role="guest"] .nav > a[href*="auth.html"]{
  display: inline-flex;
}

/* Show admin NAV link only for admin role */
body[data-role="admin"] .nav > a[href*="admin.html"]{
  display: inline-flex;
}

/* Show seller cabinet NAV link only for seller role — disabled by request (access via profile icon) */
body[data-role="seller"] .nav > a[href*="seller.html"]{ display: none; }
/* Show buyer cart NAV link only for buyer role */
body[data-role="buyer"] .nav > a[href*="cart.html"]{
  display: inline-flex;
}

/* BAAZAAR — cart link styles
   Build: step07-2026-02-01-01
*/
.nav-link.nav-cart svg{ width: 22px; height: 22px; }

/* Show personal profile NAV link for any authenticated role (legacy) */
body[data-role="buyer"] .nav > a[href*="profile.html"],
body[data-role="seller"] .nav > a[href*="profile.html"],
body[data-role="admin"] .nav > a[href*="profile.html"]{
  display: inline-flex;
}

/* Keep legacy cabinet.html NAV link visible for authenticated users (compat) */
body[data-role="buyer"] .nav > a[href*="cabinet.html"],
body[data-role="seller"] .nav > a[href*="cabinet.html"],
body[data-role="admin"] .nav > a[href*="cabinet.html"]{
  display: inline-flex;
}

/* Icon-only nav controls (profile/cart)
   Build: step08-2026-02-01-01
   NOTE: No separate tooltip bubble. The dropdown provides the label.
*/
.nav-link.nav-icon{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: transparent;
  border: none;
  padding: 8px;
}
.nav-link.nav-icon:hover{ background: rgba(255,255,255,.18); }
.nav-link.nav-icon.active{ background: rgba(255,255,255,.22); }
.nav-link.nav-icon svg{ width: 22px; height: 22px; display:block; }

/* Profile dropdown menu (hover/focus)
   Build: step05-2026-02-01-01
   Notes:
   - Visibility of items is controlled by body[data-auth] set in headerStatus.js
   - Dropdown opens via CSS (:hover / :focus-within), no JS show/hide.
*/
.profile-menu{ position: relative; display:inline-flex; }

/* Make the trigger button look like a normal nav link */
button.nav-link.profile-trigger{
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.profile-dropdown{
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  padding: 8px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.12);
  box-shadow: 0 18px 50px rgba(0,0,0,.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity .14s ease,
    transform .14s ease,
    visibility 0s linear .28s;
  z-index: 60;
}

.profile-dropdown::before{
  /* Hover "bridge" so the menu doesn't disappear while moving the cursor
     from the icon to the dropdown */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
}

.profile-menu:hover .profile-dropdown,
.profile-menu:focus-within .profile-dropdown{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition:
    opacity .14s ease,
    transform .14s ease,
    visibility 0s;
}

.profile-item{
  display:flex;
  align-items:center;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: #0b2a2a;
  font-weight: 800;
  font-size: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}

.profile-item:hover,
.profile-item:focus-visible{ background: rgba(0,0,0,.06); }

.profile-sep{ height:1px; background: rgba(0,0,0,.10); margin: 8px 6px; }

/* Item visibility by auth state */
body[data-auth="guest"] .profile-dropdown [data-auth="in"]{ display:none; }
body[data-auth="in"] .profile-dropdown [data-auth="guest"]{ display:none; }

/* Admin must not see seller cabinet */
body[data-role="admin"] a[href*="seller.html"]{
  display: none;
}





/* ===============================
   BAAZAAR — catalog dropdown (icon-based)
   Build: step13-2026-02-01-01
   =============================== */

.catalog-menu{ position: relative; display:inline-flex; }

button.nav-link.catalog-trigger{
  appearance:none;
  -webkit-appearance:none;
  border:none;
  background:transparent;
  color:inherit;
  font:inherit;
  cursor:pointer;
}

.catalog-dropdown{
  position:absolute;
  right:0;
  top:calc(100% + 10px);
  min-width:280px;
  padding:12px 14px;
  border-radius:18px;
  background:#ffffff;
  border:1px solid rgba(0,0,0,.12);
  box-shadow:0 18px 50px rgba(0,0,0,.14);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:translateY(-4px);
  transition:
    opacity .14s ease,
    transform .14s ease,
    visibility 0s linear .28s;
  z-index:60;
  display:flex;
  gap:18px;
}

.catalog-dropdown::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:-12px;
  height:12px;
}

.catalog-menu:hover .catalog-dropdown,
.catalog-menu:focus-within .catalog-dropdown{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:translateY(0);
  transition:
    opacity .14s ease,
    transform .14s ease,
    visibility 0s;
}

.catalog-group{ min-width:160px; }
.catalog-title{
  font-weight:900;
  font-size:13px;
  margin-bottom:8px;
  color:#0b2a2a;
}
.catalog-item{
  display:block;
  padding:6px 4px;
  text-decoration:none;
  color:#0b2a2a;
  font-weight:700;
  border-radius:8px;
}
.catalog-item:hover{ background:rgba(0,0,0,.06); }



/* === Catalog dropdown compact layout (step63) === */
.catalog-menu .catalog-dropdown{
  width: min(720px, 92vw);
  max-width: 720px;
  /* No inner scroll: let the page scroll naturally when the menu is tall */
  max-height: none;
  overflow: visible;
  display:block; /* inner grid handles layout */
}

.catalog-dropdown-inner{
  padding: 10px 10px 12px;
  font-size: 13px;
  line-height: 1.25;
}

.catalog-menu.is-open .catalog-dropdown{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:translateY(0);
  transition: opacity .14s ease, transform .14s ease, visibility 0s;
}

/* keep existing hover behavior too, but is-open prevents flicker */
.catalog-reset{
  position: sticky;
  top: 0;
  background: #fff;
  padding: 8px 2px 10px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  z-index: 2;
}
.catalog-reset a{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(11,111,107,.08);
  color: #0b6f6b;
  text-decoration: none;
}

.catalog-grid{
  display:flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 10px;
  /* No inner scroll: let the page scroll */
  overflow: visible;
  max-height: none;
}

.catalog-group{
  min-width: 200px;
  max-width: 240px;
}
.catalog-title{
  font-weight: 800;
  margin: 0 0 6px;
}
.cat-showall{
  display:inline-block;
  margin: 0 0 10px;
  font-size: 12px;
  color: rgba(0,0,0,.55);
  text-decoration: none;
}
.cat-l2-link, .cat-l3-link, .cat-l1-link{
  display:block;
  padding: 6px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-l2-link:hover, .cat-l3-link:hover, .cat-l1-link:hover{
  background: rgba(0,0,0,.06);
}
.catalog-l3{
  margin: 4px 0 10px 10px;
  border-left: 1px solid rgba(0,0,0,.08);
  padding-left: 8px;
}
.cat-l3-link{
  font-size: 12px;
  opacity: .9;
}
.is-active{
  background: rgba(11,111,107,.12) !important;
}


/* === Catalog dropdown expanded layout (user request) === */
.catalog-menu .catalog-dropdown{
  width: min(1120px, 96vw);
  max-width: 1120px;
  max-height: 82vh;
  overflow: auto; /* allow lots of categories without overflowing the viewport */
  padding: 10px 12px;
}

.catalog-dropdown-inner{
  padding: 8px 8px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.catalog-title{
  font-size: 12px;
  margin-bottom: 6px;
}

.catalog-item{
  padding: 5px 4px;
  font-size: 12px;
  font-weight: 700;
}

/* Patch 021: Hide admin button in header nav (access via profile dropdown) */
.nav > a[href*="admin.html"]{ display:none !important; }
