/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ============ ТЁМНАЯ ТЕМА (по умолчанию) ============ */
:root,
[data-theme="dark"] {
  --bg: #1a1a1c;
  --bg-alt: #141416;
  --bg-soft: #1f1f22;
  --surface: #222225;
  --surface-2: #2a2a2e;
  --text: #e8e6e1;
  --text-muted: #9a9690;
  --text-dim: #6a665f;
  --accent: #c9a961;
  --accent-hover: #d4b770;
  --sale: #c8553d;
  --border: #333336;
  --shadow: rgba(0, 0, 0, 0.4);
  --overlay: rgba(0, 0, 0, 0.8);
  --hero-gradient: radial-gradient(ellipse at top, rgba(201, 169, 97, 0.08), transparent 60%);
  --blend-fade: rgba(26, 26, 28, 0);
}

/* ============ СВЕТЛАЯ ТЕМА ============ NEW */
[data-theme="light"] {
  --bg: #f5f1ea;
  --bg-alt: #ece6db;
  --bg-soft: #faf7f1;
  --surface: #ffffff;
  --surface-2: #f0ebe0;
  --text: #1f1c17;
  --text-muted: #6b6256;
  --text-dim: #9c9284;
  --accent: #a88444;        /* более глубокая латунь — лучше читается на светлом */
  --accent-hover: #8f6f36;
  --sale: #b5452f;
  --border: #e0d9cc;
  --shadow: rgba(90, 70, 40, 0.12);
  --overlay: rgba(30, 25, 15, 0.6);
  --hero-gradient: radial-gradient(ellipse at top, rgba(168, 132, 68, 0.12), transparent 60%);
  --blend-fade: rgba(245, 241, 234, 0);
}

/* Плавный переход цветов при смене темы NEW */
html {
  transition: background-color 0.6s ease, color 0.6s ease;
}
body, .header, .footer, .section, .modal__content, .product-card,
.btn, .filter-btn, .page-btn, .contact-link, .sidebar, .admin-table {
  transition: background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; transition: color 0.3s ease; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4 { font-family: 'Playfair Display', Georgia, serif; font-weight: 500; letter-spacing: -0.01em; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-block;
  padding: 16px 36px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-radius: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid transparent;
}
.btn--primary { background: var(--accent); color: #fff; }
[data-theme="light"] .btn--primary { color: #fff; }
.btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--shadow);
}
.btn--full { width: 100%; }

/* ============ HEADER ============ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 20px 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.logo {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.1em;
}
.logo span { color: var(--accent); }
.nav { display: flex; gap: 32px; }
.nav a {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav a:hover { color: var(--accent); }

@media (max-width: 768px) {
  .header__inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "logo logo logo"
      ". nav toggle";
    align-items: center;
    gap: 12px 20px;
    padding: 0px 20px;
  }

  .logo {
    grid-area: logo;
    justify-self: center;
  }

  .nav {
    grid-area: nav;
    justify-self: center;
    gap: 16px;
    flex-wrap: wrap;
  }

  .theme-toggle {
    grid-area: toggle;
    justify-self: end;
  }

  .nav a {
    font-size: 13px;
    letter-spacing: 0.08em;
  }
}

/* ============ ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ NEW ============ */
.theme-toggle {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(20deg);
}
.theme-toggle__icon {
  width: 20px; height: 20px;
  position: absolute;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.4s ease;
}
.theme-toggle__icon--sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
.theme-toggle__icon--moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

[data-theme="light"] .theme-toggle__icon--sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}
[data-theme="light"] .theme-toggle__icon--moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ============ HERO ============ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 60px;
  position: relative;
  background: var(--hero-gradient), var(--bg);
  overflow: hidden;
}
/* Декоративный фон для parallax NEW */
.hero__bg {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 20% 30%, rgba(201, 169, 97, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(200, 85, 61, 0.05) 0%, transparent 40%);
  pointer-events: none;
  will-change: transform;
}
[data-theme="light"] .hero__bg {
  background:
    radial-gradient(circle at 20% 30%, rgba(168, 132, 68, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(181, 69, 47, 0.06) 0%, transparent 40%);
}
.hero__inner { max-width: 820px; position: relative; z-index: 1; }
.hero__eyebrow {
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}
.hero__title {
  font-size: clamp(40px, 7vw, 84px);
  line-height: 1.05;
  margin-bottom: 28px;
  font-weight: 400;
}
.hero__title em {
  font-style: italic;
  color: var(--accent);
}
.hero__subtitle {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto 40px;
  line-height: 1.7;
}
.hero__scroll {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 24px;
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 10px); }
}

/* ============ SECTIONS ============ */
.section { padding: 100px 0; position: relative; }
.section--alt { background: var(--bg-alt); }

/* ГРАДИЕНТНЫЕ ПЕРЕХОДЫ МЕЖДУ СЕКЦИЯМИ NEW */
.section::before,
.section--alt::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 120px;
  pointer-events: none;
  z-index: 1;
}
.section::before {
  top: -120px;
  background: linear-gradient(to bottom, var(--blend-fade), var(--bg));
}
.section--alt::before {
  top: -120px;
  background: linear-gradient(to bottom, var(--blend-fade), var(--bg-alt));
}
.footer::before {
  content: '';
  position: absolute;
  top: -120px; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(to bottom, var(--blend-fade), var(--bg-alt));
  pointer-events: none;
}

.section-head { text-align: center; margin-bottom: 60px; position: relative; z-index: 2; }
.section-title {
  font-size: clamp(32px, 4vw, 48px);
  margin-bottom: 16px;
}
.section-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 520px;
  margin: 0 auto;
}

/* ============ REVEAL ANIMATIONS NEW ============ */
[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
/* Отключаем анимацию для пользователей, предпочитающих уменьшенное движение */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hero__bg { transform: none !important; }
}

/* ============ FILTERS ============ */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 50px;
  position: relative;
  z-index: 2;
}
.filter-btn {
  padding: 10px 22px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 30px;
  background: transparent;
  transition: all 0.3s ease;
}
.filter-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
[data-theme="light"] .filter-btn.active { color: #fff; }

/* ============ PRODUCTS GRID ============ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  position: relative;
  z-index: 2;
}
@media (max-width: 900px) { .products-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .products-grid { grid-template-columns: 1fr; gap: 24px; } }

.product-card {
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.6s ease;
  position: relative;
  border: 1px solid var(--border);
  /*opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s forwards;*/
}
/*@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}*/
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px var(--shadow);
}
.product-card__img {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
}
.product-card__img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.product-card:hover .product-card__img img { transform: scale(1.05); }

.product-card__badge {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--sale);
  color: #fff;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  border-radius: 2px;
  z-index: 2;
}

.product-card__body { padding: 20px; }
.product-card__name {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  margin-bottom: 12px;
  line-height: 1.3;
}
.product-card__price { display: flex; align-items: baseline; gap: 10px; }
.price-new {
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
}
.price-new--sale { color: var(--sale); }
.price-old {
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: line-through;
}

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 60px;
  position: relative;
  z-index: 2;
}
.page-btn {
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  transition: all 0.3s ease;
}
.page-btn:hover:not(:disabled):not(.active) {
  color: var(--text);
  border-color: var(--text-muted);
}
.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
[data-theme="light"] .page-btn.active { color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ ABOUT ============ */
.about__inner { max-width: 720px; margin: 0 auto; text-align: center; position: relative; z-index: 2; }
.about__text p { color: var(--text-muted); margin-bottom: 20px; font-size: 17px; line-height: 1.8; }
.about__text p:last-child { margin-bottom: 0; }

/* ============ TOAST NOTIFICATION ============ */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface);
  color: var(--text);
  padding: 14px 28px;
  border-radius: 30px;
  border: 1px solid var(--accent);
  font-size: 14px;
  font-weight: 500;
  z-index: 1100;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  box-shadow: 0 10px 30px var(--shadow);
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============ FOOTER ============ */
.footer {
  background: var(--bg-alt);
  padding: 60px 0 0;
  border-top: 1px solid var(--border);
  position: relative;
}
.footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  position: relative;
  z-index: 2;
}
@media (max-width: 700px) { .footer__inner { grid-template-columns: 1fr; } }
.footer__title { font-family: 'Playfair Display', serif; font-size: 22px; margin-bottom: 12px; }
.footer__title span { color: var(--accent); }
.footer__col h4 {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.footer__col p, .footer__col a {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 8px;
}
.footer__col a:hover { color: var(--accent); }
.footer__bottom {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  position: relative;
  z-index: 2;
}

/* ============ MODAL ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.active { display: flex; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal__overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal__content {
  position: relative;
  background: var(--surface);
  border-radius: 6px;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal__close {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 24px;
  z-index: 10;
  transition: background 0.3s ease;
}
.modal__close:hover { background: var(--sale); }

.modal--product .modal__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 760px) { .modal--product .modal__body { grid-template-columns: 1fr; } }

.modal__info { padding: 40px; }
.modal__category {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.modal__title {
  font-size: 32px;
  margin-bottom: 20px;
  line-height: 1.2;
}
.modal__desc {
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.7;
}
.modal__price {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
}
.modal__price .price-new { font-size: 28px; }
.modal__price .price-old { font-size: 18px; }

/* ============ SLIDER ============ */
.slider {
  position: relative;
  background: var(--bg-alt);
  aspect-ratio: 4 / 5;
  overflow: hidden;
}
@media (max-width: 760px) { .slider { aspect-ratio: 1 / 1; } }

.slider__viewport { width: 100%; height: 100%; overflow: hidden; }
.slider__track {
  display: flex;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.slider__track img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex-shrink: 0;
}
.slider__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 5;
}
.slider__arrow:hover { background: var(--accent); color: #fff; }
.slider__arrow--prev { left: 16px; }
.slider__arrow--next { right: 16px; }
.slider__dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;
}
.slider__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
  border: none;
  padding: 0;
  cursor: pointer;
}
.slider__dot.active { background: var(--accent); width: 24px; border-radius: 4px; }

/* ============ CONTACT MODAL ============ */
.modal--contact {
  max-width: 440px;
  padding: 48px 40px;
  text-align: center;
}
.modal--contact .modal__title { margin-bottom: 8px; }
.modal__subtitle { color: var(--text-muted); margin-bottom: 32px; }
.contact-links { display: flex; flex-direction: column; gap: 12px; }
.contact-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s ease;
}
.contact-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ============ LOADING ============ */
.loader {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: var(--text-dim);
}
.loader::after {
  content: '';
  display: inline-block;
  width: 30px; height: 30px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}