:root {
  --bg: #f7f7f7;
  --panel: #ffffff;
  --text: #111;
  --muted: #6b6b6b;
  --accent: #df0000;
  --border: #e5e5e5;
  --radius: 16px;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
  --gap: 20px;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
  display: block;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--panel);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.category-tabs {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab.active {
  background: #191919;
  color: #fff;
  border-color: #191919;
}

.icon-button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 8px;
}

.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
}

.filter-buttons {
  display: flex;
  gap: 8px;
}

.pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--panel);
  cursor: pointer;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 14px;
}

.catalog {
  padding: 0 32px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

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

.section-header h1 {
  margin: 0;
  font-size: 28px;
}

.section-subtitle {
  margin: 0;
  color: var(--muted);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
}

.product-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.08);
}

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.badge-neutral {
  background: #252525;
}

.image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #e3e3e3;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed #c7c7c7;
  font-weight: 600;
  overflow: hidden;
}

.image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder {
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 10px;
  border-radius: 8px;
}

.product-title {
  margin: 0;
  font-size: 16px;
}

.product-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.price-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.price {
  font-weight: 700;
  font-size: 18px;
}

.old-price {
  color: var(--muted);
  text-decoration: line-through;
}

.footer {
  text-align: center;
  padding: 24px 16px 32px;
  color: var(--muted);
  font-size: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal.is-open {
  display: grid;
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  max-width: 900px;
  width: min(900px, 100%);
  box-shadow: var(--shadow);
  position: relative;
  padding: 20px;
}

.modal-content.narrow {
  max-width: 420px;
}

.close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: #f0f0f0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

.modal-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

.modal-image-wrapper {
  background: #f3f3f3;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border);
}

.modal-image {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.modal-description {
  color: var(--muted);
}

.primary,
.secondary,
.ghost,
.danger {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.primary {
  background: #191919;
  color: #fff;
}

.secondary {
  background: #f3f3f3;
  color: #111;
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.danger {
  background: #ffdede;
  color: #8f0000;
}

.drawer {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: min(480px, 100%);
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.08);
  padding: 20px;
  overflow-y: auto;
  z-index: 15;
  display: none;
}

.drawer.is-open {
  display: grid;
}

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

.drawer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-section {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
}

.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
  margin: 0;
}

@media (max-width: 900px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .filters {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .catalog {
    padding: 0 16px 32px;
  }

  .modal {
    padding: 12px;
  }
}

/* === MODAL FIX === */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  padding: 20px;
}

/* === PRODUCT MODAL FULLSCREEN === */
.product-modal[hidden] {
  display: none !important;
}

.product-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.product-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.product-modal__content {
  position: relative;
  height: 100vh;
  width: 100%;
  background: #fff;
  overflow: auto;
}

.product-modal__close {
  position: fixed;
  top: 16px;
  right: 16px;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 22px;
  z-index: 100000;
}

.product-modal__body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 20px 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.product-modal__image {
  background: #f3f3f3;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 360px;
}

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

.product-modal__info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-modal__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.product-modal__badge {
  background: #191919;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.product-modal__desc {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.product-modal__price {
  font-size: 22px;
  font-weight: 800;
}

.product-modal__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .product-modal__body {
    grid-template-columns: 1fr;
    padding-top: 72px;
  }

  .product-modal__image {
    min-height: 280px;
  }
}