/* Smart Home V2 — هوية البراند المعتمدة */
:root {
  --teal: #0F4C45;
  --teal-2: #1F7A68;
  --cream: #F7F5EF;
  --sand: #E8DDC8;
  --gold: #C89B3C;
  --ink: #182522;
  --danger: #b3423a;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 76, 69, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* Header */
.site-header {
  background: var(--teal);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 40px; }
.brand-name { font-weight: 700; font-size: 1.15rem; }
.brand-tag { font-size: .72rem; opacity: .85; }
.header-spacer { flex: 1; }
.cart-btn {
  position: relative; background: var(--teal-2); color: #fff;
  border: none; border-radius: 999px; padding: 9px 18px; font-size: .95rem;
  display: flex; align-items: center; gap: 8px;
}
.cart-count {
  background: var(--gold); color: var(--ink); font-weight: 700;
  border-radius: 999px; min-width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; padding: 0 6px;
}

/* Layout */
.container { max-width: 1080px; margin: 0 auto; padding: 16px; width: 100%; }
main.container { flex: 1; }

/* Search + categories */
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.search-box {
  width: 100%; padding: 12px 16px; border: 1px solid var(--sand);
  border-radius: var(--radius); font-family: inherit; font-size: 1rem;
  background: #fff;
}
.search-box:focus { outline: 2px solid var(--teal-2); }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.cat-chip {
  border: 1px solid var(--sand); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 8px 18px; white-space: nowrap; font-size: .92rem;
}
.cat-chip.active { background: var(--teal); color: #fff; border-color: var(--teal); }

/* Product grid */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
}
.card {
  background: #fff; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card-img { aspect-ratio: 1; object-fit: cover; width: 100%; background: var(--sand); }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: .95rem; font-weight: 600; line-height: 1.4; }
.card-price { color: var(--teal); font-weight: 700; }
.card-actions { margin-top: auto; }

/* Add / qty controls */
.btn {
  border: none; border-radius: 10px; padding: 10px 14px;
  font-size: .95rem; font-weight: 600; width: 100%;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-2); }
.btn-primary:disabled { background: #9db3af; cursor: not-allowed; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-outline { background: #fff; color: var(--teal); border: 1.5px solid var(--teal); }
.qty-controls {
  display: flex; align-items: center; justify-content: space-between;
  border: 1.5px solid var(--teal); border-radius: 10px; overflow: hidden;
}
.qty-controls button {
  background: var(--teal); color: #fff; border: none;
  width: 40px; height: 40px; font-size: 1.2rem; font-weight: 700;
}
.qty-controls button:disabled { background: #9db3af; }
.qty-controls .qty-num { font-weight: 700; font-size: 1.05rem; }

/* Product page */
.product-layout { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .product-layout { grid-template-columns: 1fr 1fr; } }
.gallery-main {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--radius); background: var(--sand);
}
.thumbs { display: flex; gap: 8px; margin-top: 10px; }
.thumbs img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px;
  border: 2px solid transparent; cursor: pointer;
}
.thumbs img.active { border-color: var(--teal); }
.p-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.p-price { font-size: 1.25rem; color: var(--teal); font-weight: 700; margin-bottom: 12px; }
.p-desc { line-height: 1.9; white-space: pre-line; color: #3c4a46; margin-bottom: 16px; }

/* Color swatches */
.swatches-label { font-weight: 600; margin-bottom: 8px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.swatch {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--sand);
  cursor: pointer; position: relative; padding: 0;
}
.swatch.selected { outline: 3px solid var(--teal); outline-offset: 2px; }
.swatch.disabled { cursor: not-allowed; opacity: .45; }
.swatch.disabled::after {
  content: ''; position: absolute; inset: -2px;
  background: linear-gradient(to top left, transparent 46%, var(--danger) 48%, var(--danger) 52%, transparent 54%);
  border-radius: 50%;
}
.swatch-name { font-size: .9rem; color: #3c4a46; min-height: 1.3em; margin-bottom: 12px; }
.whatsapp-hint {
  background: var(--sand); border-radius: 10px; padding: 10px 14px;
  font-size: .88rem; margin: 14px 0;
}
.whatsapp-hint a { color: var(--teal); font-weight: 700; }

/* Cart / checkout */
.cart-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.cart-row {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; display: flex; gap: 12px; align-items: center;
}
.cart-row img { width: 70px; height: 70px; object-fit: cover; border-radius: 10px; }
.cart-row-info { flex: 1; }
.cart-row-name { font-weight: 600; font-size: .95rem; }
.cart-row-color { font-size: .82rem; color: #5a6a66; }
.cart-row-price { color: var(--teal); font-weight: 700; font-size: .95rem; margin-top: 2px; }
.cart-row .qty-controls { width: 130px; flex-shrink: 0; }
.summary {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 20px;
}
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; }
.summary-row.total { border-top: 1px dashed var(--sand); margin-top: 6px; padding-top: 12px; font-weight: 700; font-size: 1.1rem; }
.form-grid { display: flex; flex-direction: column; gap: 12px; }
.form-grid label { font-weight: 600; font-size: .92rem; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--sand); border-radius: 10px;
  font-family: inherit; font-size: 1rem; background: #fff;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { outline: 2px solid var(--teal-2); }
.field-error { color: var(--danger); font-size: .82rem; min-height: 1.1em; }
.alert {
  border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; font-size: .92rem;
}
.alert-error { background: #fbe9e7; color: var(--danger); }
.alert-info { background: var(--sand); color: var(--ink); }

/* Success */
.success-box {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 40px 24px; text-align: center; max-width: 480px; margin: 40px auto;
}
.success-box .check { font-size: 3rem; color: var(--teal-2); margin-bottom: 12px; }
.order-num { font-size: 1.3rem; font-weight: 700; color: var(--teal); margin: 10px 0; }

/* Footer */
.site-footer {
  background: var(--teal); color: #fff; text-align: center;
  padding: 18px; font-size: .85rem; margin-top: 30px;
}
.empty-state { text-align: center; padding: 60px 20px; color: #5a6a66; }
.loading { text-align: center; padding: 60px 20px; color: #5a6a66; }
.min-order-note { font-size: .85rem; color: var(--danger); }
