* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --primary: #ff4747;
  --primary-dark: #d93636;
  --dark: #191919;
  --bg: #f4f4f6;
  --card: #ffffff;
  --border: #e2e2e8;
}

body {
  background: var(--bg);
  color: var(--dark);
}

.hidden { display: none !important; }

/* Header */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1240px;
  margin: auto;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 800;
  font-size: 1.25rem;
}

.brand-badge {
  background: var(--primary);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
}

.search-bar {
  flex: 1;
  min-width: 240px;
  max-width: 520px;
  display: flex;
  border: 2px solid var(--primary);
  border-radius: 24px;
  overflow: hidden;
}

.search-bar input {
  flex: 1;
  border: none;
  padding: 8px 14px;
  outline: none;
}

.search-bar button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0 18px;
  cursor: pointer;
}

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

.nav-btn {
  background: #f5f5f7;
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.nav-btn:hover { background: #ffeaea; border-color: var(--primary); }
.admin-trigger { background: #191919; color: #fff; }

/* Categories */
.category-bar {
  max-width: 1240px;
  margin: auto;
  padding: 8px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-top: 1px solid #f0f0f0;
}

.cat-btn {
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.85rem;
}

.cat-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Container & Banner */
.container {
  max-width: 1240px;
  margin: 20px auto;
  padding: 0 16px;
  min-height: 70vh;
}

.promo-banner {
  background: linear-gradient(135deg, #ff4747, #ff8533);
  color: #fff;
  padding: 20px 24px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.banner-tag {
  background: rgba(0,0,0,0.25);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: bold;
}

/* Product Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.product-img-wrap {
  position: relative;
  height: 200px;
  background: #fafafa;
  cursor: pointer;
}

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

.photo-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 10px;
}

.product-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.product-price {
  color: var(--primary);
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.card-actions {
  display: flex;
  gap: 6px;
}

/* Buttons & Inputs */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: #fff;
  color: var(--dark);
  border: 1px solid var(--border);
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn-small {
  background: var(--dark);
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.full-btn { width: 100%; }

input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 0.92rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.login-box { text-align: center; max-width: 400px; }
.logo-brand { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.logo-brand span { color: var(--primary); }
.login-box p { color: #666; font-size: 0.9rem; margin-bottom: 16px; }
.login-footer { margin-top: 14px; display: flex; justify-content: center; gap: 10px; font-size: 0.85rem; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-weight: 600; }

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

/* Product Detail Modal */
.product-detail-box { max-width: 820px; }
.detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
#detail-main-img { width: 100%; height: 280px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.thumb-row { display: flex; gap: 10px; margin-top: 10px; }
.thumb-item { text-align: center; cursor: pointer; }
.thumb-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; }
.thumb-item.active img { border-color: var(--primary); }
.thumb-item span { display: block; font-size: 0.75rem; color: #555; }

.detail-price { font-size: 1.4rem; color: var(--primary); font-weight: 800; margin: 8px 0; }
.option-group { margin: 12px 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 0.85rem; }
.chip.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.detail-actions { display: flex; gap: 10px; margin: 16px 0; }
.reviews-box { border-top: 1px solid var(--border); padding-top: 12px; }
.review-item { background: #f8f8fa; padding: 6px 10px; border-radius: 6px; font-size: 0.85rem; margin-bottom: 6px; }
.add-review-row { display: flex; gap: 6px; margin-top: 8px; }
.add-review-row input { margin-bottom: 0; }

/* Cart & Checkout */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.cart-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.cart-item { background: #fff; padding: 12px; border-radius: 10px; border: 1px solid var(--border); display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.cart-item img { width: 68px; height: 68px; object-fit: cover; border-radius: 6px; }
.checkout-card { background: #fff; padding: 20px; border-radius: 10px; border: 1px solid var(--border); }
.coupon-box { display: flex; gap: 8px; margin: 10px 0; }
.coupon-box input { margin-bottom: 0; }
.summary-line { display: flex; justify-content: space-between; margin: 8px 0; }
.summary-line.total { font-size: 1.15rem; color: var(--primary); border-top: 1px solid var(--border); padding-top: 8px; }

/* Tracking */
.tracking-box { background: #fff; padding: 20px; border-radius: 10px; border: 1px solid var(--border); max-width: 600px; }
.track-search { display: flex; gap: 8px; }
.track-search input { margin-bottom: 0; }
.track-steps { display: flex; justify-content: space-between; margin-top: 20px; padding: 12px; background: #f8f9fa; border-radius: 8px; font-size: 0.85rem; }
.step-done { color: #16a34a; font-weight: 700; }

/* Admin Dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: #fff; padding: 16px; border-radius: 10px; border: 1px solid var(--border); }
.stat-card span { display: block; color: #666; font-size: 0.85rem; }
.stat-card strong { font-size: 1.4rem; color: var(--primary); }

.admin-panel-card { background: #fff; padding: 20px; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 20px; }
.admin-panel-card h3 { margin-bottom: 12px; }
.telegram-card { border-left: 4px solid #0088cc; }
.small-hint { font-size: 0.85rem; color: #555; margin-bottom: 10px; }
.tg-form-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
.tg-form-row input { margin-bottom: 0; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.photo-upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.upload-slot { border: 1px dashed #bbb; padding: 10px; border-radius: 8px; background: #fafafa; }
.upload-slot label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; }
.upload-preview { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; margin-top: 6px; }
.form-btn-row { display: flex; gap: 10px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { background: #f8f8fa; }

/* Footer */
.footer { background: #191919; color: #ccc; text-align: center; padding: 24px 16px; margin-top: 40px; }
.footer-links { display: flex; justify-content: center; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.footer-links button { background: none; border: none; color: #fff; cursor: pointer; text-decoration: underline; }

@media (max-width: 768px) {
  .detail-layout, .cart-layout, .tg-form-row { grid-template-columns: 1fr; }
}
