/* ============================================================
   HOME — светлый минималистичный стиль (дизайн-система)
   ============================================================ */

:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --text: #1c1d22;
  --text-muted: #6b6f76;
  --border: #ececec;
  --accent: #b6845c;          /* тёплый акцент — под мебельный бренд */
  --accent-dark: #9a6c47;
  --accent-soft: #f3e9df;
  --danger: #d9534f;
  --success: #4c9a6b;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(24, 26, 32, 0.06);
  --shadow-hover: 0 14px 40px rgba(24, 26, 32, 0.12);
  --font: 'Manrope', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.page-content {
  flex: 1 0 auto;
  padding: 32px 0 64px;
}

a {
  text-decoration: none;
  color: var(--accent-dark);
  transition: color .15s ease;
}
a:hover { color: var(--accent); }

.dropdown-toggle::after { margin-left: .4em; }

.section-title {
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.link-accent { color: var(--accent-dark); font-weight: 600; }

.surface-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------- Header / Navbar ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .navbar { padding: .7rem 0; }

.navbar-brand {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: .12em;
  color: var(--text) !important;
}
.navbar-brand:hover { color: var(--accent) !important; }

.navbar .nav-link {
  color: var(--text) !important;
  font-weight: 600;
  border-radius: 10px;
  padding: .4rem .8rem !important;
  transition: background .15s ease, color .15s ease;
}
.navbar .nav-link:hover { background: var(--accent-soft); color: var(--accent-dark) !important; }

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: .4rem;
}
.dropdown-item {
  border-radius: 8px;
  font-weight: 500;
  padding: .5rem .8rem;
}
.dropdown-item:hover { background: var(--accent-soft); color: var(--accent-dark); }

/* Поиск */
.nav-search {
  gap: .4rem;
  margin-left: auto;
}
.nav-search .form-control {
  border-radius: 999px;
  border: 1px solid var(--border);
  min-width: 200px;
  padding: .5rem 1rem;
}
.nav-search .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn-search {
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-weight: 600;
  padding: .5rem 1.1rem;
}
.btn-search:hover { background: #000; color: #fff; }

/* Кнопка корзины */
.btn-cart {
  background: var(--accent-soft);
  border-radius: 999px;
  padding: .5rem 1rem;
  margin-left: .6rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.btn-cart:hover { background: #ecdcca; }
.btn-cart__label { font-weight: 600; color: var(--accent-dark); }

/* Меню аккаунта: отступ от корзины + аккуратный фокус (не налезает на «В корзине») */
.navbar .nav-item.dropdown { margin-left: .35rem; }
.navbar .nav-link:focus,
.navbar .nav-link:focus-visible,
.btn-cart:focus,
.btn-cart:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 999px;
  padding: 0 5px;
}

/* ---------------- Кнопки ---------------- */
.btn-accent {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: 999px;
  padding: .6rem 1.4rem;
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn-accent:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
  box-shadow: 0 8px 20px rgba(182, 132, 92, .35);
}
.btn-accent:active { transform: translateY(1px); }

.btn-outline-accent {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
  border-radius: 999px;
  padding: .6rem 1.4rem;
}
.btn-outline-accent:hover { background: var(--accent-soft); color: var(--accent-dark); }

.btn-lg { padding: .8rem 1.8rem; font-size: 1.05rem; }

.btn-add {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: .5rem;
  display: inline-flex;
  transition: background .15s ease, transform .1s ease;
}
.btn-add:hover { background: var(--accent); }
.btn-add:hover img { filter: brightness(0) invert(1); }
.btn-add:active { transform: scale(.94); }

/* ---------------- Hero ---------------- */
.hero {
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-soft) 100%);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  padding: 64px 48px;
  margin-bottom: 48px;
  box-shadow: var(--shadow);
}
.hero__inner { max-width: 640px; }
.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: .8rem;
}
.hero__title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.hero__text {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 1.8rem;
}

/* ---------------- Секции главной ---------------- */
.home-section { margin-bottom: 48px; }

.category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}
.category-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .6rem 1.3rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all .15s ease;
}
.category-chip:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ---------------- Сетка товаров ---------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  margin-top: 12px;
}
@media (max-width: 1199px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 850px)  { .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .product-grid { grid-template-columns: 1fr; } }
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.product-card__imgwrap {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f0f0ec;
}
.product-card__imgwrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.product-card:hover .product-card__imgwrap img { transform: scale(1.05); }
.badge-discount {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  padding: .25rem .6rem;
  border-radius: 999px;
}
.product-card__cart {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.in-cart-badge {
  background: var(--accent-soft);
  color: var(--success);
  font-weight: 700;
  font-size: .72rem;
  padding: .25rem .5rem;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.btn-add { flex-shrink: 0; padding: .4rem; }
.product-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.product-card__name {
  font-weight: 700;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.3;
}
.product-card__desc { color: var(--text-muted); font-size: .9rem; margin: 0; }
.product-card__id { color: #b3b3b3; font-size: .78rem; margin: 0; }
.product-card__bottom {
  margin-top: auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
}
.product-card__price { font-size: 1.05rem; flex-shrink: 0; white-space: nowrap; }
.product-card__price s { color: #b3b3b3; font-size: .85rem; margin-right: 6px; }
.product-card__price strong { color: var(--text); }

.catalog-page .catalog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.catalog-query { color: var(--text-muted); margin-bottom: 16px; }
.catalog-empty, .cart-empty { color: var(--text-muted); padding: 24px 0; }
.filter-menu { padding: 1rem; min-width: 260px; }
.filter-menu .form-check { margin-bottom: .4rem; }
.filter-label { font-weight: 700; margin: .6rem 0 .3rem; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* ---------------- Страница товара ---------------- */
.product-detail__card { padding: 28px; }
.product-detail__imgwrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #f0f0ec;
  aspect-ratio: 1 / 1;
}
.product-detail__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.product-detail__id { color: #b3b3b3; font-size: .8rem; margin-bottom: 6px; }
.product-detail__name { font-weight: 800; font-size: 2rem; letter-spacing: -.01em; }
.product-detail__price { font-size: 1.6rem; margin: 12px 0; }
.product-detail__price s { color: #b3b3b3; font-size: 1.1rem; margin-right: 10px; }
.product-detail__price strong { color: var(--accent-dark); }
.product-detail__stock { margin-bottom: 16px; }
.in-stock { color: var(--success); font-weight: 600; }
.out-stock { color: var(--danger); font-weight: 600; }
.product-detail__desc { color: var(--text-muted); margin-bottom: 24px; }

/* ---------------- Формы / авторизация ---------------- */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: .6rem .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-label { font-weight: 600; margin-bottom: .35rem; }
.form-error { color: var(--danger); font-size: .85rem; margin-top: .3rem; }
.form-hint { color: var(--text-muted); font-size: .82rem; margin-top: .3rem; }
/* Поле с ошибкой валидации — красная обводка (подсвечивается нужное поле) */
.has-error .form-control,
.has-error .form-select { border-color: var(--danger); }
.has-error .form-control:focus { box-shadow: 0 0 0 3px rgba(217, 83, 79, .15); }

/* Радио/чекбоксы — акцентный цвет вместо синего */
.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}
.form-check-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-wrapper {
  display: flex;
  justify-content: center;
  padding: 24px 0;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 440px;
}
.auth-title { font-weight: 800; font-size: 1.7rem; margin-bottom: .3rem; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 1.6rem; }
.auth-switch { text-align: center; margin-top: 1.2rem; color: var(--text-muted); }

/* ---------------- Профиль / заказы ---------------- */
.profile-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-soft);
}
.order-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.order-number { font-weight: 700; }
.order-status {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: .15rem .7rem;
  font-size: .8rem;
  font-weight: 600;
}
.order-date { color: var(--text-muted); font-size: .85rem; margin-bottom: 8px; }
.order-items { list-style: none; padding: 0; margin: 0; }
.order-items li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-top: 1px dashed var(--border);
  font-size: .92rem;
}
.order-summary-item, .order-summary-total {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}
.order-summary-total { font-size: 1.1rem; }

/* ---------------- Корзина (модалка) ---------------- */
.cart-modal { border: none; border-radius: var(--radius); }
.cart-modal .modal-header { border-bottom: 1px solid var(--border); }
.cart-modal .modal-title { font-weight: 800; }
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item__img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f0f0ec;
}
.cart-item__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item__body { flex: 1; }
.cart-item__name { font-weight: 600; margin-bottom: 6px; }
.cart-item__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.qty-group { display: inline-flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.qty-btn:hover { background: var(--accent-soft); }
.qty-input {
  width: 40px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 0;
}
.cart-item__price { font-weight: 700; }
.cart-item__remove { opacity: .6; }
.cart-item__remove:hover { opacity: 1; }
.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  font-size: 1.05rem;
}

/* ---------------- Уведомления ---------------- */
.toast-area {
  position: fixed;
  top: 84px;
  right: 24px;
  z-index: 1080;
  width: 320px;
  max-width: calc(100vw - 48px);
}
.toast-area .alert { border-radius: var(--radius-sm); box-shadow: var(--shadow); }

/* ---------------- Пагинация ---------------- */
.pagination .page-link {
  color: var(--text);
  border: 1px solid var(--border);
  margin: 0 3px;
  border-radius: 10px !important;
  font-weight: 600;
}
.pagination .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination .page-link:hover { background: var(--accent-soft); color: var(--accent-dark); }

/* ---------------- О нас ---------------- */
.about-text { color: var(--text-muted); font-size: 1.05rem; }

/* ---------------- Панель управления (dashboard) ---------------- */
.dash {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}
.dash__sidebar {
  position: sticky;
  top: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.dash__brand {
  font-weight: 800;
  font-size: 1.1rem;
  padding: 6px 12px 12px;
  color: var(--accent-dark);
}
.dash__nav { display: flex; flex-direction: column; gap: 4px; }
.dash__link {
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
}
.dash__link:hover { background: var(--accent-soft); color: var(--accent-dark); }
.dash__link.active { background: var(--accent); color: #fff; }
.dash__title { font-weight: 800; font-size: 1.7rem; margin-bottom: 20px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.stat-card__value { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.01em; }
.stat-card__label { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }

.dash-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dash-row:last-child { border-bottom: none; }

.dash-table { width: 100%; border-collapse: collapse; }
.dash-table th {
  text-align: left;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
}
.dash-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.dash-table tr:hover td { background: #faf8f5; }
.dash-thumb {
  width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #f0f0ec;
}
.dash-thumb-lg {
  width: 120px; height: 120px; object-fit: cover; border-radius: 12px; background: #f0f0ec;
}

.status-badge {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
}

.dash-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .4rem 1rem;
  font-weight: 600;
  color: var(--text);
  font-size: .9rem;
}
.chip:hover { background: var(--accent-soft); color: var(--accent-dark); }
.chip--active { background: var(--accent); color: #fff; border-color: var(--accent); }

.btn-outline-danger {
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 999px;
  font-weight: 600;
}
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: .3rem .7rem; font-size: .82rem; }

@media (max-width: 860px) {
  .dash { grid-template-columns: 1fr; }
  .dash__sidebar { position: static; }
  .dash__nav { flex-direction: row; flex-wrap: wrap; }
}

/* ---------------- Страницы ошибок ---------------- */
.error-page {
  text-align: center;
  padding: 80px 20px;
  max-width: 560px;
  margin: 0 auto;
}
.error-code {
  font-size: 6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.error-title { font-weight: 800; font-size: 1.8rem; margin: 12px 0 8px; }
.error-text { color: var(--text-muted); margin-bottom: 24px; }

/* ---------------- Footer ---------------- */
.site-footer {
  flex-shrink: 0;
  background: var(--text);
  color: #d8d8d4;
  padding: 24px 0;
}
.footer-brand { font-weight: 800; letter-spacing: .12em; color: #fff; }
.footer-copy { color: #a9a9a4; font-size: .9rem; }

/* ---------------- Адаптив ---------------- */
@media (max-width: 991px) {
  .nav-search { margin: .8rem 0; width: 100%; }
  .nav-search .form-control { min-width: 0; flex: 1; }
  .btn-cart { margin: .4rem 0; }
  .hero { padding: 40px 24px; }
  .hero__title { font-size: 2rem; }
}
@media (max-width: 575px) {
  .catalog-page .catalog-head { flex-direction: column; align-items: flex-start; }
  .auth-card { padding: 28px 20px; }
  .hero__title { font-size: 1.7rem; }
}
