:root {
  --color-jade: #00895e;
  --color-jade-dark: #00593d;
  --color-gold: #c9a227;
  --color-white: #ffffff;
  --color-bg: #fbfaf7;
  --color-text: #222222;
  --color-muted: #6b7280;
  --color-border: #e9e6df;
  --radius: 12px;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.03), 0 10px 28px -14px rgba(0,0,0,0.14);
}

body.dark-mode {
  --color-white: #1b1f2a;
  --color-bg: #12151d;
  --color-text: #eef0f3;
  --color-muted: #9ca3af;
  --color-border: #2b3140;
}

body.dark-mode .admin-table { background: var(--color-white); }
body.dark-mode .admin-table th { background: #20242f; }

/* Alternate color presets - selected via body class from site settings (theme = 1/2/3) */
body.theme-royal-blue {
  --color-jade: #1e4d8c;
  --color-jade-dark: #12325c;
  --color-gold: #d4af37;
}

body.theme-terracotta {
  --color-jade: #a3512b;
  --color-jade-dark: #6e3419;
  --color-gold: #dcae53;
}

body.theme-plum {
  --color-jade: #5c2a4d;
  --color-jade-dark: #3b1a32;
  --color-gold: #c9a227;
}

* { box-sizing: border-box; }

input, select, textarea, button {
  font-family: inherit;
}

img { max-width: 100%; height: auto; }

.content img, .page-content img, .post-single .content img {
  border-radius: var(--radius);
  margin: 12px 0;
}

body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; margin-top: 2.2rem; }
h3 { font-size: 1.15rem; }

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--color-jade);
  color: var(--color-white);
  box-shadow: 0 2px 14px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 14px 16px;
  gap: 12px;
}

.logo {
  color: var(--color-white);
  font-weight: 700;
  font-size: 1.3rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.main-nav {
  display: flex;
  gap: 6px 14px;
  flex-wrap: wrap;
  max-width: 62%;
}

.main-nav a {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.site-nav-toggle.force-visible {
  display: block !important;
}

.main-nav.force-vertical {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  max-width: none;
  order: 10;
  padding-top: 10px;
}

.main-nav.force-vertical.open {
  display: flex;
}

.main-nav a:hover {
  color: var(--color-gold);
}

.lang-switcher select {
  padding: 6px 10px;
  border-radius: var(--radius);
  border: none;
  font-family: inherit;
}

.site-search-form input {
  padding: 6px 12px;
  border-radius: var(--radius);
  border: none;
  font-family: inherit;
  width: 140px;
}

.theme-toggle-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 1rem;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: none;
}

.theme-toggle-btn:hover {
  background: rgba(255,255,255,0.28);
  color: #fff;
  transform: none;
}

#mini-cart-badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  background: var(--color-gold);
  color: var(--color-jade-dark);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* ---------- Buttons ---------- */
button, .btn, .btn-secondary {
  background: var(--color-gold);
  color: var(--color-jade-dark);
  border: 1px solid transparent;
  padding: 10px 21px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px -6px rgba(0,0,0,0.25);
}

button:hover, .btn:hover, .btn-secondary:hover {
  background: var(--color-jade);
  color: var(--color-white);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-jade-dark);
  border-color: var(--color-border);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--color-jade);
  color: var(--color-white);
  border-color: var(--color-jade);
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 72px 20px 60px;
}

.hero h1 {
  color: var(--color-jade-dark);
  font-size: 2.4rem;
  margin-bottom: 14px;
}

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

/* ---------- Home sections ---------- */
.home-section {
  margin: 56px 0;
}

.home-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}

.home-section-header h2 {
  margin: 0;
}

.home-section-header a {
  color: var(--color-jade-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- Forms ---------- */
form label {
  display: block;
  margin-bottom: 14px;
  font-weight: 500;
}

form input, form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-family: inherit;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-jade-dark);
  color: var(--color-white);
  text-align: center;
  padding: 20px 0;
  margin-top: 60px;
}

.site-logo-img {
  height: 36px;
  vertical-align: middle;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-logo-img {
  height: 40px;
}

.footer-social-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-social-links a {
  color: var(--color-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  transition: background 0.15s ease, color 0.15s ease;
}

.footer-social-links a:hover {
  background: var(--color-gold);
  color: var(--color-jade-dark);
}

.content-share-links {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
}

.content-share-links a {
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 0.15s ease, color 0.15s ease;
}

.content-share-links a:hover {
  background: var(--color-gold);
  color: var(--color-jade-dark);
}

.settings-accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--color-white);
}

.settings-accordion summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  list-style: none;
}

.settings-accordion summary::-webkit-details-marker {
  display: none;
}

.settings-accordion summary::before {
  content: '▸';
  display: inline-block;
  margin-left: 8px;
  transition: transform 0.15s ease;
}

.settings-accordion[open] summary::before {
  transform: rotate(90deg);
}

.settings-accordion .settings-panel {
  padding: 0 16px 16px;
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}

/* ---------- Video embeds (Aparat / YouTube) ---------- */
.video-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  margin: 20px 0;
}

.video-embed iframe {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius);
}

/* ---------- Blog ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.post-card {
  background: var(--color-white);
  color: var(--color-text);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  padding-bottom: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.post-card:hover {
  transform: translateY(-3px);
}

.post-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.post-card h2, .post-card p, .post-card .btn {
  margin: 10px 16px;
}

.post-card h2 {
  font-size: 1.15rem;
  line-height: 1.4;
}

.post-card h2 a {
  color: var(--color-text);
  text-decoration: none;
}

.post-card h2 a:hover {
  color: var(--color-jade, var(--color-primary, #2b6cb0));
  text-decoration: underline;
}

.share-box {
  margin-top: 30px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.share-box a {
  color: var(--color-jade-dark);
  text-decoration: none;
  font-weight: 500;
}

/* ---------- Forms (contact, checkout, account pages) ---------- */
fieldset {
  border: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-text);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}

legend {
  padding: 0 8px;
  font-weight: 700;
}

.admin-form {
  max-width: 560px;
}

.admin-form label {
  display: block;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.admin-form input[type="number"],
.admin-form input[type="url"],
.admin-form input[type="date"],
.admin-form input[type="datetime-local"],
.admin-form input[type="file"],
.admin-form select,
.admin-form textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 10px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  outline: none;
  border-color: var(--color-jade);
  box-shadow: 0 0 0 3px rgba(0, 137, 94, 0.12);
}

.admin-form input:disabled {
  background: #f3f3f0;
  color: var(--color-muted);
}

.admin-form textarea { resize: vertical; min-height: 150px; }

.admin-form fieldset {
  border: 1px solid var(--color-border);
  background: var(--color-white);
  border-radius: var(--radius);
  margin-bottom: 20px;
  padding: 18px 20px;
}

.admin-form legend {
  padding: 0 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.form-row {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-row label { flex: 1; min-width: 160px; margin-bottom: 0; }

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 7px;
  font-weight: 500 !important;
}

.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-jade);
}

.error {
  background: #fbeaea;
  color: #c23b3b;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 10px;
}

/* ---------- Tables (cart, invoice) ---------- */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  margin: 16px 0;
}

.admin-table {
  width: 100%;
  min-width: 480px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table th {
  background: #fafaf7;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-muted);
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid var(--color-border);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.admin-table tbody tr:last-child td { border-bottom: none; }

/* ---------- Pagination (public pages) ---------- */
.pagination {
  display: flex;
  gap: 6px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.pagination a {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--color-white);
  color: var(--color-text);
  border: 1px solid #ddd;
  text-decoration: none;
  color: #333;
}

.pagination a.active {
  background: var(--color-jade);
  color: #fff;
  border-color: var(--color-jade);
}

.shop-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
  background: var(--color-white);
  color: var(--color-text);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.shop-filters input, .shop-filters select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
}

/* ---------- Shop ---------- */
.product-single {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 20px;
}

.product-main-image {
  width: 100%;
  border-radius: var(--radius);
}

.product-description img {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  border-radius: var(--radius);
  margin: 12px 0;
  cursor: zoom-in;
}

.product-thumb {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  margin-inline-end: 8px;
}

.product-main-image, .product-thumb {
  cursor: zoom-in;
}

/* ---------- Image lightbox ---------- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-overlay.active { display: flex; }

.lightbox-overlay img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
}

.price strong {
  font-size: 1.4rem;
  color: var(--color-jade-dark);
}

.product-badge {
  display: inline-block;
  background: var(--color-gold);
  color: var(--color-jade-dark);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.shop-card-badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  background: var(--color-gold);
  color: var(--color-jade-dark);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  z-index: 2;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.qty-stepper button {
  background: #f0efe9;
  color: var(--color-jade-dark);
  border: none;
  box-shadow: none;
  padding: 6px 12px;
  font-weight: 700;
  border-radius: 0;
}

.qty-stepper button:hover {
  background: var(--color-jade);
  color: #fff;
  transform: none;
}

.qty-stepper input {
  width: 46px;
  text-align: center;
  border: none;
  padding: 6px 0;
  -moz-appearance: textfield;
}

.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.checkout-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-top: 20px;
  align-items: start;
}

.order-summary {
  background: var(--color-white);
  color: var(--color-text);
  border-radius: var(--radius);
  padding: 20px;
}

.manual-transfer-box {
  background: var(--color-white);
  color: var(--color-text);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .product-single, .checkout-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Responsive ---------- */
.site-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--color-text);
  padding: 4px 8px;
}

#mini-cart-dropdown {
  left: auto !important;
  right: 0 !important;
  width: min(300px, calc(100vw - 32px)) !important;
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .site-nav-toggle {
    display: block;
  }
  .main-nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 10px;
    order: 10;
    padding-top: 10px;
  }
  .main-nav.open {
    display: flex;
  }
}
