:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --secondary: #64748b;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f8fafc;
  --bg-white: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.logo-icon {
  font-size: 28px;
}

.logo-text {
  font-size: 24px;
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 32px;
}

.nav-link {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
  width: 100%;
  justify-content: center;
}

.btn-icon {
  font-size: 18px;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 50%, #a855f7 100%);
  color: white;
  padding: 80px 0;
  text-align: center;
}

.hero-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 20px;
  opacity: 0.9;
  margin-bottom: 40px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 60px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
}

.stat-label {
  font-size: 14px;
  opacity: 0.8;
}

/* Categories */
.categories {
  padding: 30px 0;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
}

.categories-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.category-btn {
  padding: 10px 20px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-light);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.category-btn:hover,
.category-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Catalog */
.catalog {
  padding: 60px 0;
}

.section-title {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: var(--text-light);
}

/* Product Card */
.product-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.product-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
}

.product-body {
  padding: 20px;
}

.product-category {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg);
  color: var(--text-light);
  font-size: 12px;
  font-weight: 500;
  border-radius: 50px;
  margin-bottom: 8px;
}

.product-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}

.product-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.product-min-order {
  font-size: 13px;
  color: var(--text-light);
}

.stock-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 10px;
}

.stock-badge.in-stock {
  background: #dcfce7;
  color: #15803d;
}

.stock-badge.out-of-stock {
  background: #fee2e2;
  color: #b91c1c;
}

/* About */
.about {
  padding: 80px 0;
  background: var(--bg-white);
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.about-card {
  text-align: center;
  padding: 30px;
}

.about-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
}

.about-card h3 {
  font-size: 20px;
  margin-bottom: 12px;
}

.about-card p {
  color: var(--text-light);
  font-size: 15px;
}

/* Contacts */
.contacts {
  padding: 80px 0;
}

.contacts-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
}

.contact-icon {
  font-size: 24px;
}

.contact-item a {
  color: var(--primary);
  text-decoration: none;
}

.contact-item a:hover {
  text-decoration: underline;
}

/* Footer */
.footer {
  background: var(--text);
  color: white;
  padding: 30px 0;
  text-align: center;
}

.footer p {
  opacity: 0.7;
  font-size: 14px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-white);
  border-radius: var(--radius);
  max-width: 1100px;
  width: 95%;
  max-height: 95vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* Gallery */
.modal-gallery {
  padding: 20px;
}

.gallery-main {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 12px;
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gallery-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.gallery-thumb:hover,
.gallery-thumb.active {
  border-color: var(--primary);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-info {
  padding: 30px;
  display: flex;
  flex-direction: column;
}

.modal-category {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bg);
  color: var(--text-light);
  font-size: 13px;
  font-weight: 500;
  border-radius: 50px;
  margin-bottom: 12px;
  align-self: flex-start;
}

.modal-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.2;
}

.modal-description {
  color: var(--text-light);
  margin-bottom: 20px;
  line-height: 1.8;
  font-size: 15px;
  white-space: pre-line;
  max-height: 200px;
  overflow-y: auto;
}

.modal-details {
  margin-bottom: 24px;
}

.modal-price,
.modal-min-order {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.price-label,
.order-label {
  color: var(--text-light);
}

.price-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.order-value {
  font-weight: 600;
}

.modal-stock {
  padding: 10px 0;
}

/* Order Form */
.order-form {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.order-form h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text);
}

.order-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.order-form .form-group {
  margin-bottom: 12px;
}

.order-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-light);
}

.order-form input,
.order-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.order-form input:focus,
.order-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.order-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: none;
}

.order-result.success {
  display: block;
  background: #dcfce7;
  color: #15803d;
}

.order-result.error {
  display: block;
  background: #fee2e2;
  color: #b91c1c;
}

/* Responsive */
@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 15px 20px;
    gap: 15px;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 20px;
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-stats {
    gap: 30px;
  }

  .stat-value {
    font-size: 28px;
  }

  .modal-body {
    grid-template-columns: 1fr;
  }

  .modal-gallery {
    padding: 16px;
  }

  .gallery-main {
    aspect-ratio: 4/3;
  }

  .modal-info {
    padding: 20px;
  }

  .modal-name {
    font-size: 20px;
  }

  .order-form .form-row {
    grid-template-columns: 1fr;
  }
}

/* Оптовые цены (фронтенд) */
.modal-price-tiers {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
}

.price-tiers-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: #15803d;
}

.price-tiers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-tier {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
}

.tier-qty {
  color: var(--text-light);
  font-size: 14px;
}

.tier-price {
  font-weight: 700;
  color: #15803d;
  font-size: 16px;
}

/* Выбор цвета (фронтенд) */
.modal-colors {
  margin-bottom: 20px;
}

.color-selector-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.color-selector-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.color-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.color-btn:hover {
  transform: scale(1.1);
  border-color: var(--primary);
}

.color-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
}

.color-btn.active::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.selected-color-name {
  font-size: 14px;
  color: var(--text-light);
  font-style: italic;
}
