/* ===================== eTroniX — Layout (header, footer, home grid, sidebar) ===================== */

/* ---- HEADER ---- */
.site-header {
  position: sticky; top: 0; z-index: 90;
  background: rgba(255,255,255,.86); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar { background: var(--ink); color: #cfd8e8; font-size: 12.5px; }
.topbar .wrap { display: flex; align-items: center; gap: 22px; height: 38px; }
.topbar a { display: inline-flex; align-items: center; gap: 6px; color: #cfd8e8; transition: color .15s; }
.topbar a:hover { color: #fff; }
.topbar svg { width: 14px; height: 14px; }
.topbar .sp { flex: 1; }
.topbar .lang { display: flex; gap: 2px; align-items: center; }
.topbar .lang button { padding: 3px 7px; border-radius: 6px; color: #9fb0cc; font-weight: 600; font-size: 12px; }
.topbar .lang button.on { background: rgba(255,255,255,.12); color: #fff; }

.headmain { display: flex; align-items: center; gap: 20px; height: 84px; }

.head-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.logo { display: flex; align-items: center; gap: 0; background: none; border: none; cursor: pointer; padding: 0; }
.logo-mark { display: none; }

/* ---- SEARCH ---- */
.search { position: relative; flex: 1; min-width: 0; }
.search-box {
  display: flex; align-items: center; height: 50px;
  background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s; overflow: hidden;
}
.search-box.focus { border-color: var(--blue); box-shadow: 0 0 0 4px var(--glow-soft); }
.search-box .si { width: 22px; height: 22px; color: var(--ink-3); margin: 0 4px 0 16px; flex: 0 0 auto; }
.search-box input {
  flex: 1; min-width: 0; height: 100%; border: none; outline: none;
  background: none; font-size: 15px; color: var(--ink); padding: 0 8px;
}
.search-box input::placeholder { color: var(--ink-4); }
.search-go {
  height: 38px; margin-right: 6px; padding: 0 18px; border-radius: 9px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 13.5px;
  display: flex; align-items: center; gap: 7px; cursor: pointer;
}
.search-go:hover { background: var(--blue); }
.search-clear {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); margin-right: 4px; cursor: pointer;
}
.search-clear:hover { background: var(--bg-2); color: var(--ink); }

.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-3); overflow: hidden; z-index: 80;
  animation: fadeUp .16s ease both;
}
.suggest-sect { padding: 9px 14px 5px; font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-4); }
.sug-term { display: flex; align-items: center; gap: 11px; padding: 9px 14px; cursor: pointer; }
.sug-term:hover, .sug-term.active { background: var(--blue-soft); }
.sug-term svg { width: 16px; height: 16px; color: var(--ink-3); flex: 0 0 auto; }
.sug-term .hl { color: var(--blue); font-weight: 700; }
.sug-prod { display: flex; align-items: center; gap: 12px; padding: 9px 14px; cursor: pointer; border-top: 1px solid var(--line); }
.sug-prod:hover, .sug-prod.active { background: var(--surface-2); }
.sug-prod .ph { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 10px; }
.sug-prod .ph::after { font-size: 8px; }
.sug-prod .nm { font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.sug-prod .mt { font-size: 11.5px; color: var(--ink-3); }
.sug-prod .pr { margin-left: auto; font-weight: 800; font-size: 14px; white-space: nowrap; }
.suggest-foot {
  padding: 11px 14px; border-top: 1px solid var(--line); background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between; font-size: 13px; cursor: pointer;
}
.suggest-foot:hover { background: var(--blue-soft); }
.suggest-foot b { color: var(--blue); }

/* ---- FOOTER ---- */
.site-footer { background: var(--ink); color: #aab8d0; margin-top: 70px; }
.foot-top { display: flex; justify-content: space-around; gap: 40px; padding: 54px 0 40px; }
.site-footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: #fff; margin-bottom: 16px; font-family: var(--ff-mono); font-weight: 500; }
.site-footer a { display: block; padding: 6px 0; color: #aab8d0; font-size: 14px; transition: color .15s; }
.site-footer a:hover { color: #fff; }
.foot-logo img { height: 30px; filter: brightness(1.1); }
.foot-soc { display: flex; gap: 10px; margin-top: 18px; }
.foot-soc a { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.07); display: flex; align-items: center; justify-content: center; padding: 0; }
.foot-soc a:hover { background: var(--blue); }
.foot-soc svg { width: 18px; height: 18px; }
.foot-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 20px 0; display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: #7d8aa3; gap: 16px; flex-wrap: wrap; }

/* ---- HOME LAYOUT: sidebar + main ---- */
.home { display: grid; grid-template-columns: 248px minmax(0,1fr); gap: 26px; align-items: start; }
.home-main { min-width: 0; }
.home-main .hero-row { margin-top: 0; }

/* ---- CATEGORY SIDEBAR ---- */
.cs-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(11,21,38,.34); backdrop-filter: blur(6px) saturate(.9);
  opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s;
}
.cs-backdrop.on { opacity: 1; visibility: visible; }

.cat-sidebar {
  position: sticky; top: 138px; z-index: 60; height: calc(100vh - 158px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px;
}
.cat-sidebar.menu-open { z-index: 78; box-shadow: var(--sh-2); }

.cs-head { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; padding: 9px 12px 11px; letter-spacing: -0.01em; flex: 0 0 auto; }
.cs-head svg { width: 20px; height: 20px; color: var(--blue); }

.cs-list { display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; flex: 0 1 auto; }
.cs-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 11px;
  cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2);
  transition: background .12s, color .12s; width: 100%; text-align: left; background: none; border: none;
}
.cs-item:hover, .cs-item.active { background: var(--blue-soft); color: var(--blue-deep); }
.cs-ic {
  width: 32px; height: 32px; border-radius: 9px; background: var(--bg-2);
  display: flex; align-items: center; justify-content: center; color: var(--blue);
  flex: 0 0 auto; transition: background .12s;
}
.cs-item:hover .cs-ic, .cs-item.active .cs-ic { background: #fff; }
.cs-ic svg { width: 18px; height: 18px; }
.cs-nm { flex: 1; min-width: 0; }
.cs-cnt { font-family: var(--ff-mono); font-size: 11px; color: var(--ink-4); }
.cs-chev { display: flex; color: var(--ink-4); opacity: 0; transform: translateX(-3px); transition: opacity .12s, transform .12s; }
.cs-chev svg { width: 15px; height: 15px; }
.cs-item:hover .cs-chev, .cs-item.active .cs-chev { opacity: 1; transform: translateX(0); color: var(--blue); }

.cs-promo {
  margin-top: auto; padding: 16px; border-radius: var(--r-md);
  background: linear-gradient(155deg, var(--blue-soft), #fff); border: 1px solid var(--line);
  cursor: pointer; display: flex; flex-direction: column; gap: 5px; flex: 0 0 auto;
}
.cs-promo:hover { box-shadow: var(--sh-2); }
.cs-promo-t { font-weight: 800; font-size: 15px; margin-top: 5px; letter-spacing: -0.01em; }
.cs-promo-s { font-size: 12px; color: var(--ink-3); line-height: 1.35; margin-bottom: 4px; }

/* ---- FLYOUT PANEL ---- */
.cs-flyout {
  position: absolute; left: 100%; top: 0;
  width: min(720px, calc(100vw - 320px)); max-height: calc(100vh - 158px); overflow-y: auto;
  margin-left: 14px; z-index: 79;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -18px rgba(11,21,38,.34), 0 4px 14px -6px rgba(11,21,38,.18);
  padding: 22px 24px 24px; animation: flyIn .18s cubic-bezier(.22,.61,.36,1);
}
.cs-flyout::before { content: ''; position: absolute; left: -14px; top: 0; width: 14px; height: 100%; }
@keyframes flyIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }

.cs-fly-head { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.cs-fly-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.cs-fly-ic svg { width: 21px; height: 21px; }
.cs-fly-head h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; flex: 1; }
.cs-fly-all {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px;
  color: var(--blue); padding: 7px 13px; border-radius: 10px; background: var(--blue-soft);
  transition: background .14s; cursor: pointer; border: none;
}
.cs-fly-all:hover { background: #fff; box-shadow: inset 0 0 0 1.5px var(--blue); }
.cs-fly-grid { columns: 3; column-gap: 30px; }
.cs-grp { break-inside: avoid; margin-bottom: 22px; }
.cs-grp-t { font-size: 11px; font-weight: 800; letter-spacing: .07em; color: var(--ink-4); margin-bottom: 9px; }
.cs-grp ul { display: flex; flex-direction: column; gap: 2px; }
.cs-grp a { display: block; padding: 5px 8px; margin-left: -8px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: background .12s, color .12s; }
.cs-grp a:hover { background: var(--blue-soft); color: var(--blue-deep); }

/* ---- TOASTS ---- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 14px; box-shadow: var(--sh-3);
  animation: toastIn .25s cubic-bezier(.2,1.2,.4,1) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.toast-ic { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 auto; background: var(--green); }
.toast.fav .toast-ic { background: var(--red); }
.toast.info .toast-ic { background: var(--blue); }
.toast-ic svg { width: 20px; height: 20px; }
.toast-body { display: flex; flex-direction: column; min-width: 0; }
.toast-body b { font-size: 14px; }
.toast-body span { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.toast-x { width: 28px; height: 28px; border-radius: 8px; color: var(--ink-4); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; cursor: pointer; }
.toast-x:hover { background: var(--bg-2); color: var(--ink); }
.toast-x svg { width: 15px; height: 15px; }

.hide-mobile { display: inline-flex; }
.hide-tablet { display: inline-flex; }
.mobile-nav { display: none; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1080px) {
  .home { grid-template-columns: 1fr; }
  .cat-sidebar { display: none; }
}
@media (max-width: 900px) {
  .foot-top { grid-template-columns: 1fr 1fr; gap: 30px; }
}
@media (max-width: 1024px) {
  .hide-tablet { display: none; }
  .logo-full { display: none; }
  .logo-mark { display: block; }
  .headmain { flex-wrap: nowrap; }
  .search { flex: 1; min-width: 0; }
  .search-go { padding: 0 12px; gap: 0; }

  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: rgba(255,255,255,.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around;
  }
  .mn-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 8px; border-radius: 12px; color: var(--ink-3); flex: 1; }
  .mn-item.on { color: var(--blue); }
  .mn-ic { position: relative; display: flex; }
  .mn-ic svg { width: 23px; height: 23px; }
  .mn-badge { position: absolute; top: -6px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px; background: var(--blue); color: #fff; border-radius: 20px; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
  .mn-label { font-size: 10px; font-weight: 700; }
  body { padding-bottom: 64px; }
  .toasts { bottom: 80px; }
}
@media (max-width: 760px) {
  .topbar { display: none; }
  .headmain { height: auto; padding: 12px 0; gap: 12px; }
  .head-actions { margin-left: auto; }
  .hide-mobile { display: none; }
  :root { --header-h: 64px; }
}
@media (max-width: 600px) {
  .foot-top { flex-direction: column; }
}
@media (max-width: 480px) {
  .sec-head h2 { font-size: 23px; }
  .section { margin-top: 40px; }
}
