/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Cairo:wght@400;500;600&display=swap');

/* ===== TOKENS ===== */
:root {
  --bg: #14161a;
  --surface: #1e2128;
  --surface-hover: #262a33;
  --border: #2c303a;
  --text: #f5f3ef;
  --text-dim: #8a8f98;
  --gold: #c9a961;
  --gold-dim: #8a7847;
  --danger: #e8542e;
  --success: #4a9d6e;
  --image-placeholder: #0e1013;
}

:root[data-theme="light"] {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-hover: #f0ede6;
  --border: #e2ddd2;
  --text: #1a1a1a;
  --text-dim: #6b6b6b;
  --gold: #a3823f;
  --gold-dim: #c9a961;
  --danger: #c0392b;
  --success: #3d8b5f;
  --image-placeholder: #ece8e0;
}

/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, .logo, .quote-text {
  font-family: "Tajawal", "Cairo", sans-serif;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--text);
  letter-spacing: 0.5px;
}

.search-input {
  flex: 1;
  min-width: 150px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  outline: none;
  border-color: var(--gold);
}

.cart-button {
  background: var(--gold);
  color: #14161a;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s;
}

.cart-button:hover {
  background: #d9bb7a;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--gold);
}

#cartCount {
  background: rgba(20, 22, 26, 0.25);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}

/* ===== QUOTE STRIP (signature element) ===== */
.quote-strip {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 20px 22px;
  text-align: center;
}

.quote-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gold-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 600;
}

.quote-text {
  font-size: 19px;
  font-weight: 500;
  color: var(--text);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

.quote-rule {
  width: 48px;
  height: 2px;
  background: var(--gold);
  margin: 16px auto 0;
}

/* ===== CATEGORY BAR ===== */
.category-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.category-chip {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.category-chip:hover {
  border-color: var(--gold-dim);
  color: var(--text);
}

.category-chip.active {
  background: var(--gold);
  color: #14161a;
  border-color: var(--gold);
  font-weight: 700;
}

/* ===== PRODUCT GRID ===== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 60px;
}

.loading {
  text-align: center;
  padding: 60px 0;
  color: var(--text-dim);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

@media (min-width: 960px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===== PRODUCT CARD ===== */
.product-card {
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-dim);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--image-placeholder);
}

.product-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.product-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
  font-family: "Tajawal", sans-serif;
}

.product-stock {
  font-size: 12px;
  color: var(--text-dim);
}

.product-stock.out {
  color: var(--danger);
}

.add-to-cart-btn {
  margin-top: auto;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 9px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.add-to-cart-btn:hover {
  background: var(--gold);
  color: #14161a;
}

.add-to-cart-btn:disabled {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
  cursor: not-allowed;
}

/* ===== CART SIDEBAR ===== */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 200;
}

.cart-overlay.open {
  display: block;
}

.cart-sidebar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  border-inline-end: 1px solid var(--border);
}

.cart-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h2 {
  font-size: 17px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-dim);
}

.close-btn:hover {
  color: var(--text);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--image-placeholder);
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.qty-btn {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.qty-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.remove-item-btn {
  margin-inline-start: auto;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.empty-cart-msg {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
  font-size: 14px;
}

.cart-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.cart-total {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  font-family: "Tajawal", sans-serif;
  color: var(--gold);
}

.checkout-btn {
  width: 100%;
  background: var(--gold);
  color: #14161a;
  border: none;
  padding: 13px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.checkout-btn:hover {
  background: #d9bb7a;
}

.checkout-btn:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
}

.delivery-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 10px;
}

/* ===== PRODUCT DETAIL PAGE ===== */
.product-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding: 32px 20px;
  max-width: 1000px;
  margin: 0 auto;
}

@media (min-width: 800px) {
  .product-detail {
    grid-template-columns: 1fr 1fr;
  }
}

.gallery-main img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.gallery-thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
}

.gallery-thumbs img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.gallery-thumbs img.active {
  border-color: var(--gold);
}

.detail-info h1 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text);
}

.detail-price {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--gold);
  font-family: "Tajawal", sans-serif;
}

.detail-description {
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 20px;
}

/* ===== ADMIN PANEL ===== */
.admin-header {
  background: var(--surface);
  color: var(--text);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.admin-header a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.admin-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 20px;
}

.login-form {
  max-width: 360px;
  margin: 100px auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form h1 {
  color: var(--text);
  font-weight: 800;
}

.login-form input {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

.login-form input:focus, .admin-form input:focus, .admin-form textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.login-form button, .admin-form button {
  background: var(--gold);
  color: #14161a;
  border: none;
  padding: 13px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.login-form button:hover, .admin-form button:hover {
  background: #d9bb7a;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
}

.admin-product-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--surface);
}

.admin-product-row img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--image-placeholder);
}

.admin-product-row .name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
  padding: 24px;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.admin-form label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
}

.admin-form input, .admin-form textarea {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  width: 100%;
  background: #f4f4f4;
  color: var(--text);
  font-family: inherit;
}

.delete-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.delete-btn:hover {
  background: var(--danger);
  color: #14161a;
}

.add-btn {
  display: inline-block;
  background: var(--gold);
  color: #14161a;
  padding: 11px 18px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 20px;
}

.add-btn:hover {
  background: #d9bb7a;
}

.quote-strip, .category-bar {
  max-height: 200px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
  opacity: 1;
}

.site-header.scrolled .quote-strip,
.site-header.scrolled .category-bar {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* ===== VARIANT MODAL: center its content over the overlay ===== */
/* The variant modal reuses .cart-overlay, but needs its content
   centered rather than docked to a side like the cart sidebar. */
#variantModal.open {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#variantModal .admin-form {
  width: 100%;
}

.cart-total-line {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 800;
  font-family: "Tajawal", sans-serif;
  color: var(--gold);
  margin-bottom: 6px;
}

/* ===== ADMIN: EXISTING IMAGE MANAGEMENT ===== */
.image-manage-card {
  position: relative;
  width: 90px;
}

.image-manage-card img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border);
  display: block;
}

.image-manage-card.is-cover img {
  border-color: var(--gold);
}

.image-manage-card .cover-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--gold);
  color: #14161a;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.image-manage-card .image-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.image-manage-card .set-cover-btn {
  flex: 1;
  font-size: 11px;
  padding: 4px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  cursor: pointer;
}

.image-manage-card .set-cover-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.image-manage-card .delete-image-btn {
  width: 24px;
  font-size: 12px;
  padding: 4px;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 6px;
  cursor: pointer;
}

.image-manage-card .delete-image-btn:hover {
  background: var(--danger);
  color: #14161a;
}

.detail-description ul {
  margin: 0 0 12px;
  padding-inline-start: 20px;
}

.detail-description li {
  margin-bottom: 6px;
  line-height: 1.6;
  color: var(--text-dim);
}

.detail-description p {
  margin-bottom: 10px;
  line-height: 1.7;
}

.detail-description strong {
  color: var(--text);
  font-weight: 700;
}

.suggestions-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

.suggestions-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text);
}