/* ══════════════════════════════════════════════════════════
   ЦветоМагия — Основные стили
   ══════════════════════════════════════════════════════════ */

/* ── Переменные ─────────────────────────────────────────── */
:root {
  --bg:        #F5F0FA;
  --accent:    #9B7CB6;
  --accent-dk: #7B5A96;
  --pink:      #D4A5C9;
  --light:     #E8D5F5;
  --text:      #2D2D2D;
  --sub:       #6B6B6B;
  --white:     #FFFFFF;
  --footer-bg: #2D1A3E;
  --grad:      linear-gradient(135deg, #9B7CB6, #D4A5C9);
  --grad-hover:linear-gradient(135deg, #7B5A96, #B87AAA);
  --shadow:    0 4px 20px rgba(155,124,182,.15);
  --shadow-lg: 0 8px 40px rgba(155,124,182,.25);
  --radius:    16px;
  --font-serif:'Playfair Display', Georgia, serif;
  --font-sans: 'Montserrat', Arial, sans-serif;
  --font-script:'Dancing Script', cursive;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Контейнер ──────────────────────────────────────────── */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Утилиты ─────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-left   { text-align: left !important; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* ── Топбар ──────────────────────────────────────────────── */
.topbar {
  background: var(--footer-bg);
  color: rgba(255,255,255,.85);
  font-size: .78rem;
  font-family: var(--font-sans);
  padding: 7px 0;
}
.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar__socials { display: flex; gap: 16px; }
.topbar__socials a {
  color: var(--pink);
  font-size: .78rem;
  transition: color .2s;
}
.topbar__socials a:hover { color: #fff; }

/* ── Шапка ───────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--light);
  transition: box-shadow .3s;
}
.header.scrolled { box-shadow: 0 4px 24px rgba(155,124,182,.18); }
.header .container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Логотип */
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}
.logo img {
  height: 146px;
  width: auto;
  object-fit: contain;
  display: block;
}
.logo-text {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .04em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 0;
}
.logo-rose { display: inline-block; color: var(--pink); margin: 0 1px; }
.logo-sub {
  font-family: var(--font-sans);
  font-size: .65rem;
  font-weight: 400;
  color: var(--sub);
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Навигация */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav__link {
  font-size: .83rem;
  font-weight: 500;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .2s, background .2s;
  white-space: nowrap;
}
.nav__link:hover, .nav__link.active {
  color: var(--accent);
  background: var(--light);
}

/* Правая часть шапки */
.header__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.header__phone {
  font-weight: 600;
  font-size: .88rem;
  color: var(--accent-dk);
  white-space: nowrap;
}
.header__phone:hover { color: var(--accent); }

/* Кнопка корзины */
.cart-toggle {
  position: relative;
  background: var(--light);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
  transition: background .2s;
}
.cart-toggle:hover { background: var(--pink); color: #fff; }
#cartCount {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: .65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}

/* ── Бургер ──────────────────────────────────────────────── */
.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: 8px;
  transition: background .2s;
}
.burger:hover { background: var(--light); }
.burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Мобильное меню ──────────────────────────────────────── */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.98);
  z-index: 300;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu__close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 1.5rem;
  color: var(--sub);
  padding: 8px;
}
.mobile-menu .nav__link {
  font-size: 1.2rem;
  padding: 12px 24px;
  width: 100%;
  text-align: center;
  border-radius: 12px;
}
.mobile-menu__contacts {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.mobile-menu__contacts a {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}
.mobile-menu__socials {
  display: flex;
  gap: 16px;
  margin-top: .5rem;
}
.mobile-menu__socials a {
  background: var(--light);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background .2s;
}
.mobile-menu__socials a:hover { background: var(--pink); }
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 290;
}

/* ── Кнопки ──────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--grad);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 13px 30px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s;
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(155,124,182,.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 11px 28px;
  border-radius: 50px;
  border: 2px solid var(--accent);
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
  text-decoration: none;
}
.btn-secondary:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

.btn-sm { padding: 8px 18px; font-size: .78rem; }
.btn-ghost {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 50px;
  padding: 11px 28px;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s;
  display: inline-flex;
  align-items: center;
}
.btn-ghost:hover { background: rgba(255,255,255,.25); }

/* ── Заголовки секций ────────────────────────────────────── */
.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700;
  font-style: italic;
  color: var(--accent-dk);
  text-align: center;
  margin-bottom: .5rem;
  position: relative;
}
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--grad);
  border-radius: 2px;
  margin: .6rem auto 0;
}
.section-title.text-left::after { margin-left: 0; }
.section-sub {
  font-size: .95rem;
  color: var(--sub);
  text-align: center;
  margin-bottom: 2.5rem;
}

/* ── Карточка товара ─────────────────────────────────────── */
.product-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .3s, box-shadow .3s;
  cursor: pointer;
  position: relative;
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
.product-card__img {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: linear-gradient(135deg, var(--light), var(--pink));
  position: relative;
}
.product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.product-card:hover .product-card__img img { transform: scale(1.07); }
.product-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}
.product-card__body { padding: 16px; }
.product-card__name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.product-card__desc {
  font-size: .8rem;
  color: var(--sub);
  margin-bottom: 12px;
  line-height: 1.4;
}
.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.product-card__price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}
.product-card__price-old {
  font-size: .8rem;
  color: var(--sub);
  text-decoration: line-through;
  margin-left: 4px;
}
.product-card__btn {
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 8px 16px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  white-space: nowrap;
}
.product-card__btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(155,124,182,.4); }

/* Метки на карточках */
.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: .7rem;
  font-weight: 700;
  z-index: 1;
}
.badge-sale { background: #ff6b6b; color: #fff; }
.badge-new  { background: var(--accent); color: #fff; }
.badge-popular { background: var(--pink); color: #fff; }

/* Избранное */
.product-card__fav {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,.9);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .2s, transform .2s;
  z-index: 1;
}
.product-card__fav:hover { background: #fff; transform: scale(1.15); }

/* ── Сетка товаров ───────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* ── Форма ───────────────────────────────────────────────── */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--light);
  border-radius: 10px;
  font-size: .95rem;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155,124,182,.12);
}
.form-textarea { resize: vertical; min-height: 100px; }

/* ── Корзина (выдвижная панель) ──────────────────────────── */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 400;
}
.cart-overlay.open { display: block; }

.cart-panel {
  position: fixed;
  top: 0;
  right: -440px;
  width: 400px;
  height: 100vh;
  background: var(--white);
  box-shadow: -8px 0 40px rgba(0,0,0,.15);
  z-index: 401;
  display: flex;
  flex-direction: column;
  transition: right .35s cubic-bezier(.4,0,.2,1);
}
.cart-panel.open { right: 0; }

.cart-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--light);
}
.cart-panel__header h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--accent-dk);
}
.cart-panel__close {
  font-size: 1.4rem;
  color: var(--sub);
  transition: color .2s;
}
.cart-panel__close:hover { color: var(--text); }

.cart-panel__items { flex: 1; overflow-y: auto; padding: 16px 24px; }
.cart-panel__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--sub);
  font-size: .95rem;
}
.cart-panel__empty span { font-size: 3rem; }

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--light);
  align-items: flex-start;
}
.cart-item__img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--light), var(--pink));
  overflow: hidden;
  flex-shrink: 0;
}
.cart-item__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item__info { flex: 1; }
.cart-item__name { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.cart-item__price { color: var(--accent); font-weight: 700; font-size: .95rem; }
.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.cart-item__qty button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--light);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.cart-item__qty button:hover { background: var(--pink); color: #fff; }
.cart-item__qty span { font-weight: 600; min-width: 20px; text-align: center; }
.cart-item__remove { color: var(--sub); font-size: 1rem; transition: color .2s; }
.cart-item__remove:hover { color: #ff6b6b; }

.cart-panel__footer {
  padding: 20px 24px;
  border-top: 1px solid var(--light);
}
.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  margin-bottom: 16px;
}
.cart-total strong { font-size: 1.2rem; color: var(--accent); }

/* ── Модальное окно ──────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 20px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  animation: modalIn .3s ease;
}
@keyframes modalIn { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.3rem;
  color: var(--sub);
  transition: color .2s;
  z-index: 1;
}
.modal__close:hover { color: var(--text); }
.modal h3 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--accent-dk);
  margin-bottom: 1.5rem;
}

/* ── Футер ───────────────────────────────────────────────── */
.footer {
  background: var(--footer-bg);
  color: rgba(255,255,255,.8);
  padding: 3rem 0 1.5rem;
  margin-top: 0;
}
.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr 1.5fr;
  gap: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer__logo {
  margin-bottom: .8rem;
}
.footer__logo img {
  height: 144px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: .92;
}
.footer p { font-size: .85rem; line-height: 1.7; }
.footer h4 {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--pink);
  margin-bottom: 1rem;
}
.footer__links { display: flex; flex-direction: column; gap: 8px; }
.footer__links a {
  font-size: .85rem;
  color: rgba(255,255,255,.7);
  transition: color .2s;
}
.footer__links a:hover { color: var(--pink); }
.footer__contact-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .85rem;
  margin-bottom: 8px;
  color: rgba(255,255,255,.75);
}
.footer__socials { display: flex; gap: 10px; flex-wrap: wrap; margin-top: .5rem; }
.footer__socials a {
  background: rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: .78rem;
  color: rgba(255,255,255,.8);
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.footer__socials a:hover { background: var(--accent); color: #fff; }
.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.2rem;
  font-size: .78rem;
  color: rgba(255,255,255,.45);
  gap: 16px;
  flex-wrap: wrap;
}
.footer__bottom a { color: rgba(255,255,255,.45); transition: color .2s; }
.footer__bottom a:hover { color: var(--pink); }
.footer__bottom-links { display: flex; gap: 16px; }

/* ── Фиксированная кнопка звонка (мобильный) ─────────────── */
.mobile-call-btn {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: var(--grad);
  color: #fff;
  border-radius: 50%;
  font-size: 1.4rem;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(155,124,182,.5);
  z-index: 100;
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
}
.mobile-call-btn:hover { transform: scale(1.1); box-shadow: 0 8px 32px rgba(155,124,182,.6); }

/* ── Toast уведомления ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  z-index: 600;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  max-width: 300px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #4caf50; }
.toast.error   { background: #f44336; }

/* ── Анимации появления ──────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: .1s; }
.reveal-delay-2 { transition-delay: .2s; }
.reveal-delay-3 { transition-delay: .3s; }

/* ── Секция (отступы) ────────────────────────────────────── */
.section {
  padding: 5rem 0;
}
.section.bg-white { background: var(--white); }
.section.bg-light { background: var(--bg); }

/* ── Звёзды рейтинга ─────────────────────────────────────── */
.stars { color: #f5a623; font-size: .95rem; letter-spacing: 2px; }

/* ── Пагинация / Показать ещё ─────────────────────────────── */
.load-more-wrap { text-align: center; margin-top: 2rem; }
.btn-load-more {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 12px 32px;
  border-radius: 50px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-load-more:hover { background: var(--accent); color: #fff; }

/* ── Спиннер ─────────────────────────────────────────────── */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   АДАПТИВНОСТЬ
   ══════════════════════════════════════════════════════════ */

/* Планшет */
@media (max-width: 1199px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .footer__grid  { grid-template-columns: 1fr 1fr; }
  .nav__link { padding: 6px 8px; font-size: .8rem; }
}

/* Планшет < 992 */
@media (max-width: 991px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
  .burger { display: flex; }
  .header__right .header__phone,
  .header__right .btn-secondary { display: none; }
}

/* Мобильный */
@media (max-width: 767px) {
  .topbar { display: none; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .footer__grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .section { padding: 3rem 0; }
  .cart-panel { width: 100%; right: -100%; }
  .cart-panel.open { right: 0; }
  .mobile-call-btn { display: flex; }
  .footer__bottom { flex-direction: column; text-align: center; }
  .modal { padding: 1.5rem; border-radius: 16px 16px 0 0; max-height: 85vh; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}
