.container {
  width: min(1180px, 92%);
  margin: 0 auto;
}

.page {
  padding: 24px 0 48px;
}

.navbar {
  position: sticky;
  top: 10px;
  z-index: 100;
  padding-top: 10px;
}

.mobile-top-nav {
  display: none;
}

.mobile-top-nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.mobile-top-nav-link.is-active,
.mobile-top-nav-link:hover {
  color: var(--text);
}

.navbar-inner {
  min-height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  transition: min-height 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              padding 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.28s ease;
}

/* Compact navbar when page is scrolled */
.navbar-inner.compact {
  min-height: 54px;
  padding: 8px 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #202123, #2563eb);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  overflow: hidden;
  flex-shrink: 0;
}

body.dark .brand-logo {
  background: linear-gradient(135deg, #ffffff, #cbd5e1);
  color: #0f172a;
}

.brand-text h2 {
  font-size: 18px;
}

.brand-text p {
  font-size: 12px;
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.brand:hover .brand-text h2,
.brand:focus-visible .brand-text h2 {
  color: var(--accent);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.language-switcher-mobile {
  width: fit-content;
}

.language-pill {
  min-width: 42px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.language-pill:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.language-pill.active {
  background: var(--primary);
  color: var(--card-solid, #fff);
}

.nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
}

.mobile-menu-title {
  font-size: 18px;
  font-weight: 700;
}

/* Theme toggle icon */
.theme-toggle-icon {
  font-size: 16px;
  line-height: 1;
}

/* Notification button */
.nav-notif-btn {
  position: relative;
  padding: 10px 14px;
}

.nav-notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  animation: badge-pulse 2.4s ease-in-out infinite;
}

.bottom-nav-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
  animation: badge-pulse 2.4s ease-in-out infinite;
}


@keyframes badge-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50%       { transform: scale(1.15); box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}

/* Notification dropdown */
.nav-notif-wrap {
  position: relative;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-strong);
  z-index: 500;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.notif-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.notif-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}

.notif-dropdown-title {
  font-weight: 700;
  font-size: 14px;
}

.notif-read-all-btn {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.14s;
  white-space: nowrap;
}

.notif-read-all-btn:hover {
  background: rgba(37, 99, 235, 0.1);
}

.notif-dropdown-list {
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notif-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.14s;
}

.notif-dropdown-item:last-child {
  border-bottom: none;
}

.notif-dropdown-item:hover {
  background: rgba(37, 99, 235, 0.05);
}

.notif-dropdown-item.unread {
  background: rgba(37, 99, 235, 0.04);
}

.notif-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}

.notif-item-dot.read {
  background: transparent;
}

.notif-item-body {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.notif-item-text {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 3px;
}

.notif-dropdown-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.notif-dropdown-footer a {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.notif-dropdown-footer a:hover {
  text-decoration: underline;
}

.notif-dropdown-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Hamburger button — скрыт на десктопе */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(10px);
  cursor: pointer;
  flex-shrink: 0;
}

body.dark .hamburger-btn {
  background: rgba(255,255,255,0.06);
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.22s ease, opacity 0.22s ease;
  transform-origin: center;
}

.hamburger-active .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-active .hamburger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-active .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu drawer */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(4px);
  z-index: 199;
}

.mobile-menu-overlay-visible {
  display: block;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 88vw);
  background: var(--card-solid, #fff);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(15,23,42,0.14);
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 20px;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-open {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-menu-title {
  font-size: 18px;
  font-weight: 700;
}

.mobile-menu-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.mobile-nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  transition: background 0.15s ease;
}

.mobile-nav-links a:hover {
  background: rgba(37,99,235,0.07);
}

.mobile-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.site-footer {
  margin-top: 48px;
  padding: 0 0 28px;
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.site-footer-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer-copy strong {
  color: var(--text);
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.site-footer-links a {
  color: var(--muted);
  font-size: 14px;
}

.site-footer-links a:hover {
  color: var(--text);
}

/* ===== GRIDS ===== */

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}

.search-grid,
.profile-grid,
.product-layout,
.admin-grid,
.seller-layout,
.chat-page-layout,
.profile-overview-layout,
.product-secondary-grid,
.stats-grid {
  display: grid;
  gap: 24px;
}

.search-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

.admin-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.seller-layout {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: start;
}

.chat-page-layout {
  grid-template-columns: 340px minmax(0, 1fr);
  align-items: start;
}

.profile-overview-layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.product-secondary-grid {
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
}

.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 22px;
  line-height: 1.08;
  font-weight: 700;
}

.section-head-compact {
  align-items: center;
  margin-bottom: 14px;
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .seller-layout,
  .profile-grid,
  .product-layout,
  .admin-grid,
  .chat-page-layout,
  .profile-overview-layout,
  .product-secondary-grid {
    grid-template-columns: 1fr;
  }
}

/* На планшетах прячем CTA-кнопку "Продать" в nav-actions чтобы не ломать ряд */
@media (max-width: 860px) {
  .nav-cta {
    display: none;
  }
}

/* Hamburger breakpoint: скрываем nav-links, показываем кнопку */
@media (max-width: 768px) {
  .page {
    padding: 22px 0 40px;
  }

  .search-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .nav-links {
    display: none;
  }

  .mobile-top-nav {
    display: none !important;
  }

  .navbar {
    top: 0;
    padding-top: 8px;
  }

  .navbar-inner {
    min-height: 62px;
    padding: 10px 12px;
    gap: 10px;
    border-radius: 18px;
  }

  .brand {
    gap: 10px;
    flex: 1;
    min-width: 0;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .brand-text h2 {
    font-size: 16px;
  }

  .brand-text p {
    font-size: 11px;
  }

  .navbar-right {
    gap: 6px;
    flex: 0 1 auto;
  }

  .nav-actions {
    gap: 6px;
    flex-shrink: 1;
  }

  .nav-actions > .btn,
  .nav-actions > .nav-notif-wrap {
    display: none !important;
  }

  .nav-actions > .language-switcher {
    display: inline-flex !important;
  }

  .language-switcher {
    gap: 4px;
    padding: 3px;
    flex-shrink: 1;
    min-width: 0;
  }

  .language-pill {
    min-width: 30px;
    height: 28px;
    padding: 0 7px;
    font-size: 11px;
  }

  .hamburger-btn {
    display: flex;
    width: 38px;
    height: 38px;
    padding: 0;
    flex: 0 0 38px;
  }

  .hamburger-btn {
    display: flex;
  }

  /* В nav-actions на мобильном скрываем лишнее — всё доступно в drawer */
  .nav-actions .btn-light[data-guest-only],
  .nav-actions [data-logout-btn] {
    display: none !important;
  }
}

@media (max-width: 700px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .navbar-inner {
    padding: 10px 10px 9px;
    border-radius: 18px;
  }

  .navbar {
    padding-top: 6px;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .brand-text h2 {
    font-size: 14px;
    line-height: 1.05;
  }

  .brand-text p {
    display: none;
  }

  .navbar-right {
    gap: 5px;
  }

  .nav-actions {
    gap: 5px;
  }

  .language-switcher {
    gap: 2px;
    padding: 2px;
  }

  .language-pill {
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    font-size: 10px;
    letter-spacing: 0.02em;
  }

  .hamburger-btn {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .site-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─── Bottom Navigation (mobile) ────────────────────────────────────────────── */

.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    z-index: 1000;
    align-items: stretch;
    box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(18px);
    padding-bottom: env(safe-area-inset-bottom);
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  /* Push page content above bottom nav */
  .page {
    padding-bottom: 80px !important;
  }

  /* Hide hamburger since bottom nav replaces it */
  .hamburger-btn {
    display: flex !important;
  }

  /* Hide footer on mobile — bottom nav replaces it */
  .site-footer {
    display: none;
  }

  body.mobile-menu-is-open .bottom-nav {
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px);
  }
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted, #6b7280);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 6px 0;
}

.bottom-nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.bottom-nav-item.is-active {
  color: var(--primary, #2563eb);
}

.bottom-nav-item.is-active svg {
  stroke: var(--primary, #2563eb);
}

body.dark .bottom-nav {
  background:
    radial-gradient(circle at 50% -28px, rgba(96, 165, 250, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(15, 23, 34, 0.92), rgba(6, 9, 14, 0.98));
  border-top-color: rgba(226, 232, 240, 0.12);
  box-shadow: 0 -16px 38px rgba(0, 0, 0, 0.38);
}

body.dark .bottom-nav-item {
  color: rgba(203, 213, 225, 0.72);
}

body.dark .bottom-nav-item.is-active {
  color: #f8fafc;
}

body.dark .bottom-nav-item.is-active svg {
  stroke: #f8fafc;
}

/* Sell button — elevated center action */
.bottom-nav-sell {
  flex: 0 0 64px;
  position: relative;
  top: -12px;
}

.bottom-nav-sell-icon {
  width: 40px;
  height: 40px;
  background: var(--primary, #2563eb);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.bottom-nav-sell:active .bottom-nav-sell-icon {
  transform: scale(0.93);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.bottom-nav-sell span:last-child {
  font-size: 10px;
  margin-top: 2px;
  color: var(--primary, #2563eb);
}

body.dark .navbar-inner,
body.dark .mobile-menu {
  background:
    radial-gradient(circle at top right, rgba(139, 183, 255, 0.1), transparent 32%),
    rgba(12, 17, 24, 0.9);
  border-color: rgba(226, 232, 240, 0.12);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
}

body.dark .notif-dropdown,
body.dark .site-footer-inner {
  color: var(--text);
  border-color: rgba(226, 232, 240, 0.11);
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.08), transparent 34%),
    rgba(12, 17, 24, 0.92);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.36);
}

body.dark .notif-dropdown-item:hover,
body.dark .notif-dropdown-item.unread,
body.dark .mobile-nav-links a:hover {
  background: rgba(96, 165, 250, 0.1);
}

body.dark .language-switcher {
  background: rgba(15, 23, 42, 0.52);
  border-color: rgba(226, 232, 240, 0.12);
}

body.dark .language-pill.active {
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.26);
}

.mobile-theme-toggle {
  justify-content: center;
  gap: 10px;
}

.mobile-theme-toggle .theme-toggle-icon {
  width: 18px;
  height: 18px;
}
