:root {
  --bg-color: #fffafb;
  --text-color: #2c2225;
  --muted-text: #7a666b;
  --accent-pink: #d46a84;
  --accent-dark: #904e55;
  --card-bg: #ffffff;
  --border-color: #f0dfe3;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

img {
  max-width: 100%;
  height: auto;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
label:focus-within {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.noscript-note {
  padding: 16px;
  text-align: center;
  background: #fff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f6d6d7;
  color: var(--text-color);
  line-height: 1.5;
  padding-bottom: 80px;
}

.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 32px;
}

/* Шапка */
.header {
  background-color: #f6d6d7;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.logo img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 64px;
}

.nav a {
  text-decoration: none;
  border-radius: 50px;
  background-color: #b87d82;
  color: #fff;
  margin-left: 20px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(144, 78, 85, 0.12);
}

.nav a:hover {
  background-color: #d46a84;
  color: #fff;
}

/* Главный баннер */
.hero {
  text-align: center;
  padding: 70px 20px;
  background-color: #f6d6d7;
  border-bottom: 1px solid var(--border-color);
}

.hero h1 {
  font-size: 2.5rem;
  color: var(--accent-dark);
  margin-bottom: 10px;
}

.hero h1 img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.subtitle {
  font-size: 1.15rem;
  color: var(--muted-text);
  margin-bottom: 25px;
}

/* Кнопки */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.9;
}

.btn-primary {
  background: #b87d82;
  color: #fff;
}

.btn-secondary {
  background: #e9dfe2;
  color: var(--text-color);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent-pink);
  color: var(--accent-pink);
}

.btn-danger {
  background: #c94a4a;
  color: #fff;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.85rem;
}

/* Секции и категории */
.section {
  padding: 40px 32px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

h2 {
  font-size: 1.6rem;
  margin-bottom: 16px;
}

.categories-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid #e6b7bb;
  background: #f0c8cc;
  cursor: pointer;
  font-size: 0.9rem;
}

.category-chip.active {
  background: #e6b7bb;
  color: var(--text-color);
  border-color: #d9a0a5;
}

.subcategories-grid {
  margin-top: 12px;
}

.subcategory-chip {
  background: #f0c8cc;
}

/* Сетка товаров */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  align-items: start;
}

.product-card {
  background: #edc0c5;
  border: 1px solid #dfadb2;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.product-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.product-images img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.product-cover-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
}

.product-cover-btn:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 3px;
}

.product-viewer {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 520px);
  aspect-ratio: 4 / 5;
  margin: 0 auto 16px;
  overflow: hidden;
  border-radius: 8px;
  background: #211b1d;
}

.product-viewer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-viewer-nav {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 40px;
  aspect-ratio: 1;
  padding: 0 0 4px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: rgba(25, 20, 22, 0.68);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.product-viewer-nav:first-child {
  left: 12px;
}

.product-viewer-nav:nth-of-type(2) {
  right: 12px;
}

.product-viewer-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 9px;
  border-radius: 12px;
  background: rgba(25, 20, 22, 0.68);
  color: #fff;
  font-size: 0.8rem;
}

@media (max-width: 560px) {
  .product-viewer {
    width: 100%;
  }

  .product-viewer-nav {
    width: 36px;
  }
}

.product-badge {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #2c2225;
  margin-bottom: 12px;
}

.product-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.product-meta {
  font-size: 0.85rem;
  color: var(--muted-text);
  margin-bottom: 14px;
}

.product-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.delete-prod-btn {
  margin-top: 12px;
  background: #ffe5e5;
  color: #b02a2a;
  border: none;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}

.add-product-image-btn {
  margin-top: 8px;
  width: 100%;
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid #dfadb2;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}

/* Футер */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 30px 0;
  margin-top: 40px;
  text-align: center;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 12px 0 20px;
}

.social-links a {
  color: var(--accent-dark);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.social-links img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Модальные окна */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.hidden {
  display: none !important;
}

.modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.modal-content h3 {
  margin-bottom: 16px;
}

.product-modal-content {
  max-width: 860px;
}

.product-modal-close {
  display: block;
  margin: -8px -8px 8px auto;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: #f0dfe3;
  color: var(--text-color);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="file"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d8c6cb;
  border-radius: 8px;
  font-size: 0.95rem;
}

.form-hint {
  display: block;
  margin-top: 5px;
  color: var(--muted-text);
  font-size: 0.8rem;
}

.color-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.color-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.sw-f1dadd { background: #F1DADD; }
.sw-e8c1cc { background: #E8C1CC; }
.sw-e7d2c8 { background: #E7D2C8; }
.sw-c49a9d { background: #C49A9D; }

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.15);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.error-text {
  color: #c94a4a;
  font-size: 0.85rem;
  min-height: 18px;
}

/* Панель админа внизу экрана */
.admin-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #2c2225;
  color: #fff;
  padding: 12px 0;
  z-index: 50;
}

.admin-bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-note {
  font-size: 0.8rem;
  color: #cbb8bd;
  margin-left: 10px;
}

.admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Телефоны */
@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .section {
    padding: 32px 16px;
  }

  .header {
    position: static;
    padding: 12px 0;
  }

  .header-inner {
    flex-direction: column;
    gap: 12px;
  }

  .logo img {
    max-height: 48px;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .nav a {
    margin-left: 0;
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  .hero {
    padding: 40px 16px;
  }

  .social-links {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .admin-note {
    display: block;
    margin-left: 0;
  }
}

/* Заказ и чат */
.buy-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  text-align: center;
}

.buy-btn-modal {
  max-width: 260px;
  margin-top: 16px;
}

.order-summary {
  margin: -8px 0 14px;
  color: var(--accent-dark);
  font-weight: 600;
}

.form-group input[type="datetime-local"],
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d8c6cb;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
}

/* Скрытое поле-ловушка для ботов */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.chat-content {
  max-width: 480px;
  display: flex;
  flex-direction: column;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.chat-head h3 {
  margin-bottom: 12px;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #fff7f8;
}

.chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-msg time {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  opacity: 0.7;
}

.chat-msg-client {
  align-self: flex-end;
  background: #b87d82;
  color: #fff;
}

.chat-msg-shop {
  align-self: flex-start;
  background: #f0dfe3;
}

.chat-msg-system {
  align-self: center;
  max-width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted-text);
}

.chat-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid #d8c6cb;
  border-radius: 8px;
  font-size: 0.95rem;
}

.chat-forget {
  align-self: center;
  margin-top: 12px;
  border: 0;
  background: none;
  color: var(--muted-text);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}

.chat-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  padding: 12px 18px;
  border: 0;
  border-radius: 50px;
  background: #904e55;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(44, 34, 37, 0.3);
  cursor: pointer;
}

.chat-unread {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border-radius: 50%;
  background: #ffd45e;
}

@media (max-width: 640px) {
  .chat-fab {
    right: 12px;
    bottom: 12px;
  }
}
