:root {
  --bg: #f4efe9;
  --panel: #fffaf3;
  --card: #ffffff;
  --primary: #7c5132;
  --primary-dark: #543725;
  --accent: #d6b38a;
  --text: #1f1a17;
  --muted: #6a5f59;
  --line: #eadcc9;
  --success: #3c8f63;
  --shadow: 0 18px 40px rgba(86, 63, 38, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #f6f1ea 0%, #f1e7dc 100%);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

.page-shell, .admin-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

.topbar, .admin-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: rgba(255, 250, 243, 0.82);
  border: 1px solid rgba(124, 81, 50, 0.12);
  border-radius: 20px;
  padding: 18px 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 12px;
  z-index: 20;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #a97854 100%);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 24px;
}

.brand-subtitle, .eyebrow {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.brand-title, .hero h2, .section-heading h3, .admin-header h3, .orders-header h4, .admin-products-box h4, .product-form h4, .auth-card h2 {
  margin: 0;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.cart-button, .primary-btn, .secondary-btn, .icon-button, .header-link {
  border: none;
  border-radius: 12px;
  transition: transform 0.2s ease;
}

.cart-button, .primary-btn {
  background: linear-gradient(135deg, var(--primary) 0%, #a36c47 100%);
  color: white;
  font-weight: 700;
}

.cart-button {
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cart-count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 40px;
  background: linear-gradient(135deg, rgba(124, 81, 50, 0.08), rgba(214, 179, 138, 0.12));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 34px;
}

.hero h2 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  margin-top: 8px;
}

.hero p { max-width: 640px; color: var(--muted); font-size: 1.06rem; }

.hero-badge {
  min-width: 220px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow);
}

.hero-badge span { color: var(--muted); }
.hero-badge strong { font-size: 1.5rem; }

.catalog-section { margin-top: 40px; }
.section-heading { margin-bottom: 18px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

.product-card:hover { transform: translateY(-4px); }

.product-image-wrap { position: relative; height: 260px; overflow: hidden; }
.product-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.product-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.7);
  color: white;
  font-size: 0.75rem;
}

.product-info { padding: 18px 18px 20px; }
.product-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.product-name { margin: 0; font-size: 1.08rem; }
.product-price { font-size: 1.3rem; font-weight: 700; color: var(--primary-dark); }
.product-quantity { display: inline-block; margin-bottom: 12px; color: var(--muted); font-size: 0.92rem; }
.card-actions { display: flex; gap: 10px; }
.card-actions .secondary-btn { flex: 1; }
.primary-btn, .secondary-btn {
  padding: 12px 14px;
  font-weight: 700;
}
.secondary-btn {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.primary-btn:hover, .secondary-btn:hover, .cart-button:hover, .icon-button:hover, .header-link:hover { transform: translateY(-1px); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-quantity-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f5efe9;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 8px;
}

.product-quantity-control button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 1.2rem;
  line-height: 1;
}

.product-quantity-control span {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  opacity: 1;
}
.modal.hidden, .cart-panel.hidden, .admin-panel.hidden, .auth-card.hidden, .hidden { display: none !important; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 16, 15, 0.62);
}
.modal-card {
  position: relative;
  width: min(900px, calc(100vw - 32px));
  max-height: 92vh;
  overflow: auto;
  background: white;
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  z-index: 1;
}
.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(0, 0, 0, 0.05);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 22px;
}
.modal-content {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 26px;
}
.modal-gallery {
  display: grid;
  gap: 12px;
}
.modal-main-image {
  border-radius: 18px;
  overflow: hidden;
  height: 420px;
}
.modal-main-image img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
}
.gallery-thumb {
  width: 88px;
  height: 68px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  background: none;
}
.gallery-thumb.active { border-color: var(--primary); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

.modal-body h3 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 8px; }
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
}
.price-row strong { font-size: 2rem; color: var(--primary-dark); }
.rating {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d8a742;
  font-weight: 700;
}
.rating .stars { letter-spacing: 0.12em; }
.modal-body p { color: var(--muted); line-height: 1.6; }
.review-list { margin-top: 20px; display: grid; gap: 14px; }
.review-item {
  padding: 12px 14px;
  background: #f6f1eb;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.review-item strong { display: block; margin-bottom: 6px; }
.review-item small { color: var(--muted); }

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 100%);
  background: #fffdfb;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 35px rgba(0, 0, 0, 0.12);
  padding: 18px 20px 24px;
  z-index: 30;
  overflow-y: auto;
}

.cart-header, .admin-header, .orders-header, .form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-button {
  background: #f1e7df;
  color: var(--primary-dark);
  width: 40px;
  height: 40px;
  font-size: 24px;
  font-weight: 700;
}

.cart-items { display: grid; gap: 14px; margin-top: 18px; }
.cart-item {
  display: grid;
  grid-template-columns: 78px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.cart-item img { width: 78px; height: 78px; object-fit: cover; border-radius: 12px; }
.cart-item h4 { margin: 0 0 6px; font-size: 1rem; }
.item-price { color: var(--primary-dark); font-weight: 700; }
.cart-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.quantity-button {
  border: 1px solid var(--line);
  background: white;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 1rem;
}
.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 0 14px;
  font-size: 1.1rem;
}
.order-form, .product-form, .admin-login-form {
  display: grid;
  gap: 12px;
}
label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 600;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
}
textarea { resize: vertical; }

.admin-shell { padding-top: 28px; }
.auth-card {
  max-width: 460px;
  margin: 40px auto 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
}

.admin-panel {
  margin-top: 30px;
  background: rgba(255, 250, 243, 0.95);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 26px;
}
.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 22px;
  margin-top: 20px;
}
.product-form, .admin-products-box, .orders-box {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.admin-products-list, .orders-list { display: grid; gap: 12px; margin-top: 14px; }
.admin-product-item, .order-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.admin-product-item strong, .order-item strong { display: block; margin-bottom: 6px; }
.admin-product-actions { display: flex; gap: 8px; }
.orders-box { margin-top: 22px; }
.status-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}
.status-group.new { background: #f2fbf4; border-color: #bfe6c8; }
.status-group.in-progress { background: #fff9eb; border-color: #f0d88f; }
.status-group.done { background: #eef5ff; border-color: #bfd7ff; }
.status-group.canceled { background: #fff0f0; border-color: #f0c4c4; }
.status-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-weight: 700;
}
.status-group.new .status-group-header { background: #dff7e6; color: #1c6c3e; }
.status-group.in-progress .status-group-header { background: #fef0bf; color: #8b5f08; }
.status-group.done .status-group-header { background: #deebff; color: #1e4ea3; }
.status-group.canceled .status-group-header { background: #f9dede; color: #8b3131; }
.status-group-body { display: grid; gap: 12px; padding: 12px; }
.order-item {
  align-items: flex-start;
  flex-direction: column;
  border-left: 4px solid transparent;
}
.status-group.new .order-item { border-left-color: #3ab26b; }
.status-group.in-progress .order-item { border-left-color: #f0b000; }
.status-group.done .order-item { border-left-color: #3d82f4; }
.status-group.canceled .order-item { border-left-color: #dc5b5b; }
.order-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}
.order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 6px;
}
.status-select { max-width: 150px; }
.order-thumbnail {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
}
.order-items-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}
.order-items-row .mini-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--line);
  padding: 6px 8px;
  border-radius: 999px;
}
.track-order-box {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.track-order-result {
  margin-top: 16px;
  min-height: 110px;
}

.track-order-result .status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.track-order-result .status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: #eee5db;
  color: var(--primary-dark);
}

.compact-modal {
  max-width: 500px;
}

.order-success-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf5;
}

.order-success-row strong {
  font-size: 1.1rem;
  word-break: break-all;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #faf6f2;
}

@media (max-width: 860px) {
  .topbar, .hero, .modal-content, .admin-layout { display: grid; grid-template-columns: 1fr; }
  .topbar { position: static; }
  .main-nav { justify-content: center; }
  .hero { padding: 22px 18px; }
  .modal-card { padding: 20px 16px 18px; }
  .product-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}

@media (max-width: 560px) {
  .page-shell, .admin-shell { padding-left: 14px; padding-right: 14px; }
  .topbar, .admin-header-bar { padding: 16px 14px; }
  .main-nav { gap: 12px; font-size: 0.9rem; }
  .cart-button { padding: 10px 12px; }
  .brand-title { font-size: 1.3rem; }
}
