/* ─── GOOGLE FONTS ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700&display=swap');

/* ─── DESIGN TOKENS ─────────────────────────────────────────────────────────── */
:root {
  --bg:           #f5f6f8;
  --surface:      #ffffff;
  --surface2:     #eef0f4;
  --border:       #dde0e8;
  --accent:       #d97706;
  --accent2:      #b45309;
  --text:         #1a1d27;
  --muted:        #6b7280;
  --available:    #16a34a;
  --unavailable:  #dc2626;
  --danger:       #dc2626;
  --accent-glow:  rgba(217, 119, 6, 0.12);

  --font-body:    'Vazirmatn', sans-serif;

  --radius:       10px;
  --radius-sm:    6px;
  --max-w:        760px;
  --max-w-wide:   1000px;
}

/* ─── RESET ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html  { font-size: 16px; scroll-behavior: smooth; }

body {
  background:  var(--bg);
  color:       var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  direction:   rtl;
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }

/* ─── NAV ────────────────────────────────────────────────────────────────────── */
.nav {
  position:        sticky;
  top:             0;
  z-index:         100;
  background:      rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom:   1px solid var(--border);
  box-shadow:      0 1px 4px rgba(0,0,0,0.06);
}

.nav-inner {
  max-width:       var(--max-w-wide);
  margin:          0 auto;
  padding:         0 1.5rem;
  height:          60px;
  display:         flex;
  align-items:     center;
  justify-content: space-between;
}

.nav-logo {
  font-size:      1.15rem;
  font-weight:    700;
  color:          var(--accent);
  letter-spacing: 0.02em;
}

.nav-links {
  display:    flex;
  gap:        1.5rem;
  list-style: none;
}

.nav-links a {
  color:      var(--muted);
  font-size:  0.9rem;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--text); }

/* ─── HERO ───────────────────────────────────────────────────────────────────── */
.hero {
  background:    var(--surface);
  border-bottom: 1px solid var(--border);
  padding:       3rem 1.5rem;
  text-align:    center;
}

.hero-eyebrow {
  display:        inline-block;
  font-size:      0.72rem;
  font-weight:    700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color:          var(--accent);
  margin-bottom:  0.75rem;
}

.hero h1 {
  font-size:     2rem;
  font-weight:   700;
  line-height:   1.3;
  margin-bottom: 0.75rem;
  color:         var(--text);
}

.hero p {
  font-size: 1rem;
  color:     var(--muted);
  max-width: 480px;
  margin:    0 auto;
}

/* ─── POWER LINE ─────────────────────────────────────────────────────────────── */
.power-line {
  width:      100%;
  height:     2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border:     none;
  margin:     0;
}

/* ─── PRODUCT LIST SECTION ───────────────────────────────────────────────────── */
.grid-section {
  max-width: var(--max-w-wide);
  margin:    0 auto;
  padding:   2.5rem 1.5rem;
}

.grid-section-header {
  margin-bottom: 1.5rem;
}

.grid-section-header h2 {
  font-size:   1.3rem;
  font-weight: 700;
  color:       var(--text);
}

.grid-section-header p {
  color:      var(--muted);
  font-size:  0.875rem;
  margin-top: 0.2rem;
}

/* ─── PRODUCTS LIST ──────────────────────────────────────────────────────────── */
.products-list {
  display:        flex;
  flex-direction: column;
  gap:            0;
  border:         1px solid var(--border);
  border-radius:  var(--radius);
  overflow:       hidden;
  background:     var(--surface);
}

/* ─── PRODUCT ROW ────────────────────────────────────────────────────────────── */
.product-row {
  display:      flex;
  align-items:  center;
  border-bottom: 1px solid var(--border);
  transition:   background 0.15s;
  min-height:   72px;
}

.product-row:last-child {
  border-bottom: none;
}

.product-row:hover {
  background: var(--surface2);
}

/* Image — 25% width, fixed height, right side (RTL natural) */
.product-row-img {
  width:       25%;
  flex-shrink: 0;
  aspect-ratio: 4/3;
  overflow:    hidden;
  background:  var(--surface2);
  border-left: 1px solid var(--border);
}

.product-row-img img {
  width:      100%;
  height:     100%;
  object-fit: cover;
  transition: transform 0.25s;
}

.product-row:hover .product-row-img img {
  transform: scale(1.04);
}

/* Product name — grows to fill available space */
.product-row-name {
  flex:        1;
  padding:     0 1.25rem;
  font-size:   0.975rem;
  font-weight: 600;
  color:       var(--text);
  line-height: 1.4;
}

/* Price — fixed right, bold accent */
.product-row-price {
  padding:     0 1.25rem;
  font-size:   1rem;
  font-weight: 700;
  color:       var(--accent);
  white-space: nowrap;
  text-align:  left;
}

.row-price-from {
  font-size:    0.72rem;
  font-weight:  400;
  color:        var(--muted);
  margin-left:  0.2rem;
}

.unavailable-label {
  font-size:   0.82rem;
  color:       var(--unavailable);
  font-weight: 500;
}

/* ─── PRODUCT PAGE ───────────────────────────────────────────────────────────── */
.product-page-wrap {
  max-width: var(--max-w-wide);
  margin:    0 auto;
  padding:   2.5rem 1.5rem;
}

.back-link {
  display:       inline-flex;
  align-items:   center;
  gap:           0.4rem;
  color:         var(--muted);
  font-size:     0.875rem;
  margin-bottom: 2rem;
  transition:    color 0.2s;
}

.back-link:hover { color: var(--text); }

.product-hero {
  display:               grid;
  grid-template-columns: 1fr 1fr;
  gap:                   2.5rem;
  margin-bottom:         2.5rem;
  align-items:           start;
  background:            var(--surface);
  border:                1px solid var(--border);
  border-radius:         var(--radius);
  overflow:              hidden;
}

.product-hero-img-wrap {
  aspect-ratio: 4/3;
  overflow:     hidden;
  background:   var(--surface2);
}

.product-hero-img-wrap img {
  width:      100% !important;
  height:     100% !important;
  max-width:  none !important;
  object-fit: cover;
}

.product-hero-info {
  padding: 2rem 2rem 2rem 1rem;
}

.product-name {
  font-size:     1.75rem;
  font-weight:   700;
  line-height:   1.3;
  margin-bottom: 0.75rem;
  color:         var(--text);
}

.product-desc {
  color:         var(--muted);
  font-size:     0.95rem;
  line-height:   1.7;
  margin-bottom: 1.25rem;
}

.product-updated {
  font-size: 0.78rem;
  color:     var(--muted);
  opacity:   0.8;
}

/* ─── VARIANTS TABLE ─────────────────────────────────────────────────────────── */
.variants-section {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  overflow:      hidden;
}

.variants-title {
  font-size:     1rem;
  font-weight:   700;
  padding:       1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  color:         var(--text);
  background:    var(--surface2);
}

.variants-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       0.925rem;
}

.variants-table th {
  background:     var(--surface2);
  padding:        0.8rem 1.5rem;
  text-align:     right;
  font-weight:    600;
  color:          var(--muted);
  font-size:      0.78rem;
  letter-spacing: 0.04em;
  border-bottom:  1px solid var(--border);
}

.variants-table td {
  padding:        0.8rem 1.5rem;
  border-top:     1px solid var(--border);
  vertical-align: middle;
  color:          var(--text);
}

.variants-table tr:hover td {
  background: var(--surface2);
}

.variants-table tr.row-unavailable td {
  opacity: 0.45;
}

.variant-price {
  font-weight: 700;
  font-size:   1rem;
  color:       var(--accent);
}

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

/* ─── BADGES ─────────────────────────────────────────────────────────────────── */
.badge {
  display:       inline-block;
  padding:       0.2rem 0.6rem;
  border-radius: 99px;
  font-size:     0.72rem;
  font-weight:   600;
}

.badge-available {
  background: rgba(22, 163, 74, 0.1);
  color:      var(--available);
}

.badge-unavailable {
  background: rgba(220, 38, 38, 0.1);
  color:      var(--unavailable);
}

/* ─── LOADING & STATES ───────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding:    4rem 2rem;
  color:      var(--muted);
  font-size:  0.9rem;
}

.loading::after {
  content:       '';
  display:       inline-block;
  width:         0.9rem;
  height:        0.9rem;
  border:        2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation:     spin 0.7s linear infinite;
  margin-right:  0.5rem;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error {
  text-align: center;
  padding:    3rem;
  color:      var(--danger);
}

/* ─── FADE IN ────────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.35s ease both; }

/* ─── FOOTER ─────────────────────────────────────────────────────────────────── */
footer {
  border-top:  1px solid var(--border);
  padding:     1.75rem 1.5rem;
  text-align:  center;
  color:       var(--muted);
  font-size:   0.82rem;
  margin-top:  3rem;
  background:  var(--surface);
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero h1     { font-size: 1.5rem; }
  .nav-links   { display: none; }

  .product-row-img  { width: 30%; }
  .product-row-name { font-size: 0.875rem; padding: 0 0.75rem; }
  .product-row-price { padding: 0 0.75rem; font-size: 0.875rem; }

  .product-hero {
    grid-template-columns: 1fr;
  }

  .product-hero-info { padding: 1.25rem; }
  .product-name      { font-size: 1.4rem; }

  .variants-table th,
  .variants-table td { padding: 0.7rem 1rem; }
}
