:root {
  --bg-default: #ffffff;
  --text-strong-950: #171717;
  --text-sub-600: #5c5c5c;
  --text-soft-400: #A3A3A3;
  --static-white: #ffffff;
  --font-primary: "Noto Sans Georgian", system-ui, sans-serif;
  --stroke-soft-200: #ebebeb;
  --bg-weak-50: #f7f7f7;
  --bg-white-0: #ffffff;
  --primary-accent: #0fa9d2;
  --primary-accent-hover: #0c95ba;
  --primary-dark: #00293F;

  /* Layout tokens */
  --sidebar-width: 272px;
  --bottom-nav-height: 60px;

  /* Breakpoints (raw values — CSS custom properties cannot be used inside  media query conditions; these are documentation + JS reference only)
   * sm: 480px  |  md: 768px  |  lg: 1024px  |  xl: 1280px */
}

/* === RESET === */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
p, ul, ol, li,
dl, dt, dd,
blockquote, figure, pre,
fieldset, legend {
  margin: 0;
  padding: 0;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background-color: var(--bg-default);
  font-family: var(--font-primary);
  color: var(--text-strong-950);
}

/* === APP LAYOUT === */
/* Mobile: single column */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Desktop: sidebar + content row */
@media (min-width: 1024px) {
  .app-layout {
    flex-direction: row;
  }
}

/* === SIDEBAR === */
/* Mobile: fixed overlay, off-screen left */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  width: var(--sidebar-width);
  height: 100vh;
  flex-shrink: 0;

  border-right: 1px solid var(--stroke-soft-200);
  background: var(--bg-white-0);

  transform: translateX(-100%);
  /* Transition timing lives in transitions.css */
}

/* JS applies this class on open */
.app-sidebar.is-open {
  transform: translateX(0);
}

/* Desktop: always visible, no transform */
@media (min-width: 1024px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    transform: none;
  }
}

.sidebar-top {
  display: 1;
  flex-direction: column;
  overflow-y: 0;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
}

/* === SIDEBAR BACKDROP === */
/* Resting state: invisible, non-interactive */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  /* Transition timing lives in transitions.css */
}

/* JS applies this class when sidebar opens */
.sidebar-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 1024px) {
  .sidebar-backdrop {
    display: none;
  }
}

/* === APP CONTENT === */
.app-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 0 16px;
}

@media (min-width: 1024px) {
  .app-content {
    padding: 5px 30px;
  }
}

/* === TOPBAR LOGO — mobile only === */
.topbar-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.05em;
  color: var(--primary-dark);
  text-decoration: none;
}

@media (min-width: 1024px) {
  .topbar-logo {
    display: none;
  }
}

/* === SEARCH BOX === */
/* Mobile default: hidden; revealed via .search-is-open on the topbar */
.search-box {
  display: none;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-weak-50);
}

/* Desktop: always visible at fixed width */
@media (min-width: 1024px) {
  .search-box {
    display: flex;
    flex: none;
    width: 244px;
  }
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 16px;
  color: var(--text-strong-950);
}

@media (min-width: 1024px) {
  .search-box input {
    font-size: 14px;
  }
}

.search-box input::placeholder {
  color: #a4a4a4;
}

/* Close button — hidden on desktop, hidden on mobile until search opens */
.search-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-sub-600);
}

/* === SEARCH-IS-OPEN STATE (mobile only) === */
.topbar.search-is-open .topbar-logo {
  display: none;
}

.topbar.search-is-open .search-box {
  display: flex;
  flex: 1; /* fills remaining topbar space */
}

.topbar.search-is-open .search-close-btn {
  display: flex;
}

.topbar.search-is-open .topbar-end {
  display: none;
}

/* === TOPBAR END (right-side cluster) === */
.topbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* === SEARCH TRIGGER — mobile only === */
.search-trigger-btn {
  display: flex;
}

@media (min-width: 1024px) {
  .search-trigger-btn {
    display: none;
  }
}

/* === DESKTOP-ONLY ACTIONS (cart, favourites, user) === */
.topbar-desktop-actions {
  display: none;
}

@media (min-width: 1024px) {
  .topbar-desktop-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
}

/* === HAMBURGER BUTTON === */
.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  color: var(--text-strong-950);
}

@media (min-width: 1024px) {
  .hamburger-btn {
    display: none;
  }
}

/* === MAIN CONTENT AREA === */
#app {
  flex: 1;
  min-width: 0;
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

@media (min-width: 1024px) {
  #app {
    padding-bottom: 0;
  }
}

/* === PAGE LAYOUTS === */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

.page h1 {
  margin-bottom: 16px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header .text-title {
  margin: 0;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page--wide    { max-width: 100%; }
.page--narrow  { max-width: 720px; }
.page--tight   { padding-top: 16px; }
.page--centered { text-align: center; }

.text-title {
  display: none;
  padding: 10px 0;
}

@media (min-width: 768px) {
.text-title {
    display: block;
  }
}

/* === PRODUCT GRID === */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

@media (min-width: 768px) {
  .product-grid {
    gap: 16px;
  }
}

/* Desktop: auto-fill with min card width */
@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(338px, 1fr));
  }
}

/* === UI SPLIT === */
.ui-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 10px 0;
  flex-wrap: wrap;
}

.ui-split-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ui-split-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* === SEARCH TITLE === */
.search-title {
  padding: 20px 0;
}