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

.page {
  padding: 32px 0 60px;
}

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

.navbar-inner {
  min-height: 78px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(16px);
  border-radius: 28px;
  padding: 14px 18px;
  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: 58px;
  padding: 8px 18px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
}

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

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 18px;
  background: linear-gradient(135deg, #111827, #2563eb);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
  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: 18px;
  flex-wrap: wrap;
}

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

.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: 14px;
  flex: 1;
  justify-content: flex-end;
}

.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.72);
}

.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(--text);
  color: var(--card-solid, #fff);
}

.nav-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}

.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;
}

@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(20px);
  border: 1px solid var(--line);
  border-radius: 20px;
  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: 18px;
}

.section-head h2 {
  font-size: 28px;
}

.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;
  }

  .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: 12px;
    border-radius: 22px;
  }

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

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

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