/* ===== Color palette: brown & black tones (dark theme) ===== */
:root {
  /* Page / surface colors */
  --bg-color: #0f0d0a;
  --bg-color-alt: #1a1611;
  --card-bg: #e8d8c8;
  --border-color: #cbb99f;
  --input-bg: #fdfbfb;

  /* Text colors */
  --text-color: #e8d8c8;
  --text-primary: #1a1109;
  --text-secondary: #5c503f;
  --heading-color: #e8d8c8;
  --subtitle-color: #ffffff;

  /* Button colors */
  --button-bg: #8b5e3c;
  --button-bg-hover: #a76e4f;
  --button-text: #f5f0e8;
  --accent: #8b5e3c;

  /* Interactive / overlay colors */
  --hover-bg: rgba(255, 255, 255, 0.08);
  --backdrop-color: rgba(0, 0, 0, 0.5);
  --modal-backdrop: rgba(0, 0, 0, 0.6);

  /* Shadows */
  --card-shadow: rgba(0, 0, 0, 0.35);
  --modal-shadow: rgba(0, 0, 0, 0.4);
  --panel-shadow: rgba(0, 0, 0, 0.3);

  /* Status colors */
  --error-color: #b84a3e;
  --error-bg: rgba(159, 47, 45, 0.12);
  --error-border: #9F2F2D;
  --success-color: #2e5d33;
  --success-bg: rgba(52, 100, 56, 0.15);
  --success-border: #346538;

  /* Motion */
  --transition-slow: 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== Light theme variables ===== */
[data-theme="light"] {
  /* Page / surface colors */
  --bg-color: #f5f0e8;
  --bg-color-alt: #f0e8dc;
  --card-bg: #ffffff;
  --border-color: #cbb99f;
  --input-bg: #ffffff;

  /* Text colors */
  --text-color: #2b2019;
  --text-primary: #2b2019;
  --text-secondary: #5c503f;
  --heading-color: #2b2019;
  --subtitle-color: #8b5e3c;

  /* Button colors */
  --button-bg: #a5714f;
  --button-bg-hover: #a76e4f;
  --button-text: #ffffff;
  --accent: #a5714f;

  /* Interactive / overlay colors */
  --hover-bg: rgba(0, 0, 0, 0.05);
  --backdrop-color: rgba(0, 0, 0, 0.3);
  --modal-backdrop: rgba(0, 0, 0, 0.3);

  /* Shadows */
  --card-shadow: rgba(0, 0, 0, 0.1);
  --modal-shadow: rgba(0, 0, 0, 0.12);
  --panel-shadow: rgba(0, 0, 0, 0.08);

  /* Status colors */
  --error-color: #b84a3e;
  --error-bg: rgba(159, 47, 45, 0.12);
  --error-border: #9F2F2D;
  --success-color: #2e5d33;
  --success-bg: rgba(52, 100, 56, 0.15);
  --success-border: #346538;
}

/* ===== Reset & base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Vazirmatn', 'Helvetica Neue', 'Switzer', sans-serif;
  background: radial-gradient(ellipse at top left, var(--bg-color-alt) 0%, var(--bg-color) 70%);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  text-align: right;
  transition: background var(--transition-slow), color var(--transition-slow);
}

/* ===== Header ===== */
.site-header {
  text-align: center;
  padding: 4rem 1.5rem 2.5rem;
}

.site-title {
  font-family: 'Playfair Display', 'Instrument Serif', 'Lyon Text', serif;
  font-size: 2.75rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 0.35rem;
  color: var(--heading-color);
}

.site-subtitle {
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--subtitle-color);
  margin: 0;
}

/* ===== Product grid ===== */
.product-grid {
  display: grid;
  gap: 1.75rem;
  padding: 1.5rem 1.5rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
  grid-template-columns: repeat(3, 1fr);
}

/* Tablet: 2 per row */
@media (max-width: 900px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: 1 per row */
@media (max-width: 560px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Product card ===== */
.product-card {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  will-change: transform, opacity;
}

.product-card.revealed {
  opacity: 1;
  transform: translateY(0);
}

.product-card:hover {
  transform: translateY(-6px) scale(1.025);
  box-shadow: 0 12px 32px var(--card-shadow);
}

/* Staggered reveal delays (set inline via JS) */

/* ===== Card image ===== */
.product-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

/* ===== Card body ===== */
.product-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.product-name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
}

.product-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.product-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  flex-grow: 1;
}

/* ===== Empty / error states ===== */
.empty-state,
.error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1.5rem;
  font-size: 1.1rem;
  color: var(--heading-color);
}

.empty-state {
  opacity: 0.8;
}

.error-state {
  color: var(--error-color);
  font-weight: 500;
}

/* ===== Contact Seller button ===== */
.contact-btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.6rem 1.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--button-text);
  background: var(--button-bg);
  border: 1px solid transparent;
  border-radius: 6px;
  transition:
    background-color 180ms ease,
    transform 160ms ease,
    color 160ms ease;
  will-change: transform;
}

.contact-btn:hover {
  background: var(--button-bg-hover);
  transform: scale(1.05);
}

.contact-btn:active {
  transform: scale(0.97);
}

/* Click pulse feedback */
@keyframes pulse {
  0%   { transform: scale(1); }
  20%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.contact-btn.pulse {
  animation: pulse 0.3s ease-out;
}

/* ===== RTL adjustments for Persian ===== */
html[dir="rtl"] .product-name,
html[dir="rtl"] .product-description {
  text-align: right;
}

html[dir="rtl"] .product-price {
  text-align: left;
}

html[dir="rtl"] .empty-state,
html[dir="rtl"] .error-state {
  text-align: center;
}

/* ===== Responsive typography ===== */
@media (max-width: 900px) {
  .site-title { font-size: 2.1rem; }
}
@media (max-width: 560px) {
  .site-title { font-size: 1.7rem; }
}

/* ===== Hamburger menu button ===== */
.menu-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--button-text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  transition: background 180ms ease, transform 160ms ease;
}

.menu-btn:hover {
  background: var(--button-bg-hover);
  transform: scale(1.05);
}

.hamburger-line {
  width: 22px;
  height: 2.5px;
  background: var(--button-text);
  border-radius: 2px;
  transition: background 180ms ease;
}

/* ===== Side panel (drawer) ===== */
.side-panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
  overflow: hidden;
}

.side-panel.show {
  display: block;
}

.side-panel-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--backdrop-color);
}

.side-panel-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 0 0 12px 0;
  padding: 1.5rem;
  box-shadow: 4px 0 24px var(--panel-shadow);
  transform: translateX(-100%);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  font-family: 'Vazirmatn', 'Helvetica Neue', sans-serif;
}

.side-panel.show .side-panel-content {
  transform: translateX(0);
}

/* ===== Close button ===== */
.close-panel {
  align-self: flex-end;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Vazirmatn', 'Helvetica Neue', sans-serif;
  transition: background 180ms ease, color 160ms ease;
}

.close-panel:hover {
  background: var(--hover-bg);
  color: var(--accent);
}

/* ===== Side panel title ===== */
.side-panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'Vazirmatn', 'Helvetica Neue', sans-serif;
  color: var(--text-primary);
  margin: 0.5rem 0 1.5rem;
  text-align: center;
}

/* ===== Side panel options ===== */
.side-panel-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.side-option {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Vazirmatn', 'Helvetica Neue', sans-serif;
  text-align: center;
  color: var(--button-text);
  background: var(--button-bg);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 180ms ease, transform 160ms ease;
}

.side-option:hover {
  background: var(--button-bg-hover);
  transform: scale(1.02);
}

/* ===== Admin modal ===== */
.admin-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-backdrop);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.admin-modal.show {
  display: flex;
}

.admin-modal-content {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 2rem;
  max-width: 360px;
  width: 90%;
  text-align: center;
  font-family: 'Vazirmatn', 'Helvetica Neue', sans-serif;
  box-shadow: 0 12px 32px var(--modal-shadow);
}

.admin-modal-content h3 {
  margin: 0 0 1.25rem;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.admin-auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-auth-form input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-align: right;
}

.submit-btn-sm {
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--button-text);
  background: var(--button-bg);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 180ms ease, transform 160ms ease;
}

.submit-btn-sm:hover {
  background: var(--button-bg-hover);
  transform: scale(1.02);
}

.auth-message {
  font-size: 0.85rem;
  margin: 0;
}

.auth-message.error {
  color: var(--error-color);
}

.auth-message.success {
  color: var(--success-color);
}