/* ==========================================================================
   Woodmart-like Lite CSS - النسخة الكاملة والنهائية والمستقرة
   ========================================================================== */

/* ---------------------------------- المتغيرات ---------------------------------- */
:root {
  --container: 1200px;
  --gutter: 1rem;
  --radius-product: 12px;
  --shadow-1: 0 4px 15px rgba(0,0,0,.08);
  --border-1: 1px solid #f0f0f0;
  --bg: #ffffff;
  --bg-soft: #f9f9f9;
  --text: #222;
  --text-2: #555;
  --muted: #999;
  --accent: #3aa77a;
  --accent-2: #245f49;
  --sale-badge-bg: #e74c3c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --border-1: 1px solid #333;
    --bg: #1e1e1e;
    --bg-soft: #121212;
    --text: #f5f5f5;
    --text-2: #bbb;
    --muted: #888;
    --shadow-1: 0 4px 15px rgba(0,0,0,.3);
  }
}

/* ---------------------------------- الأساس والتخطيط --------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg-soft);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; }
img { max-width: 100%; display: block; }
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: 2rem; }

/* ---------------------------------- الهيدر والفوتر --------------------------------- */
.header { position: sticky; top: 0; z-index: 1000; background: var(--bg); border-bottom: 1px solid var(--border-1); }
.header__inner { height: 70px; display: flex; align-items: center; }
.header__logo { font-size: 1.3rem; font-weight: 700; }
.header__spacer { flex: 1; }
.main-nav { display: flex; gap: 1.5rem; }
.main-nav a { font-weight: 600; color: var(--text-2); transition: color .2s; }
.main-nav a:hover { color: var(--accent); }

.footer { background: var(--bg); }
.footer-nav { display: flex; justify-content: center; gap: 2rem; padding: 1rem; border-top: 1px solid var(--border-1); }
.footer-nav a { font-weight: 600; color: var(--text-2); }
.footer-nav a:hover { color: var(--accent); }
.footer__bottom { padding: 1rem; text-align: center; color: #999; border-top: 1px solid var(--border-1); margin-top: 1rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }

@media (max-width: 768px) { 
  .main-nav { display: none; } 
  .footer__bottom { justify-content: center; } 
}

/* ------------------------------- شبكة عرض المنتجات ------------------------------ */
.products { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); margin-top: 1.5rem;}
@media (min-width: 768px) { .products { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }
@media (min-width: 992px) { .products { grid-template-columns: repeat(4, 1fr); gap: 1.5rem; } }

/* --------------------------------- بطاقة المنتج -------------------------------- */
.product { background: var(--bg); border-radius: var(--radius-product); border: 1px solid var(--border-1); overflow: hidden; transition: all .3s ease; }
.product:hover { transform: translateY(-5px); box-shadow: var(--shadow-1); }
.product__media { position: relative; overflow: hidden; }
.product__media img { aspect-ratio: 1 / 1; object-fit: cover; transition: transform .35s ease; }
.product:hover .product__media img { transform: scale(1.05); }

.product__badge {
  position: absolute;
  top: 10px;
  background-color: var(--sale-badge-bg);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 20px;
  z-index: 2;
  display: inline-block;
}
html[dir="rtl"] .product__badge { left: 10px; right: auto; }

.product__body { padding: 0.8rem; text-align: center; }
.product__title { margin: 0 0 0.5rem; font-size: 0.95rem; font-weight: 600; line-height: 1.4; color: var(--text-2); height: 50px; }
.price { display: flex; justify-content: center; align-items: baseline; gap: 0.5rem; font-size: 1.05rem; font-weight: 700; color: var(--text); }
.price s { font-size: 0.85rem; color: var(--muted); font-weight: 500; }

/* ------------------------------ صفحة تفاصيل المنتج ----------------------------- */
.product-details { display: grid; grid-template-columns: 1fr 1.2fr; gap: 2rem; align-items: start; }
.product-gallery img { border-radius: var(--radius-product); box-shadow: var(--shadow-1); }
.product-info h1 { margin: 0 0 1rem; font-size: 1.8rem; }
.product-info .price-container { margin-block: 0.5rem 1rem; display: flex; flex-direction: column; align-items: flex-start; }
.product-info .current-price { color: var(--accent); font-weight: 900; font-size: 2rem; }
.product-info .old-price { color: #999; text-decoration: line-through; font-size: 1.2rem; }
.product-description { margin-top: 1.5rem; line-height: 1.7; color: var(--text-2); white-space: pre-wrap; }

.btn-group { display: flex; flex-direction: column; gap: 1rem; margin-top: 2rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.75rem; width: 100%; padding: 0.9rem; font-size: 1.1rem; border: none; border-radius: 10px; cursor: pointer; font-weight: 700; text-align: center; transition: all .2s ease; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.15); }
.btn.btn-buy { background-color: var(--accent, #3aa77a); color: white; }
.btn.btn-whatsapp { background-color: #25D366; color: white; }
.btn.btn-whatsapp.btn-small { padding: 0.6rem 1rem; font-size: 0.95rem; width: auto; }
.btn-whatsapp:hover { background-color: #128C7E; }
.btn-whatsapp svg { width: 20px; height: 20px; fill: currentColor; }

@media (max-width: 768px) { 
  .product-details { grid-template-columns: 1fr; }
  .product-info .price-container { align-items: center; }
  .product-info { text-align: center; }
}

/* ------------------------------ الصفحات الثابتة والمدونة ----------------------------- */
.static-page { max-width: 800px; margin-inline: auto; padding-block: 2rem; }
.static-page h1 { margin-bottom: 1.5rem; }
.static-page p, .static-page li { line-height: 1.8; color: var(--text-2); }

#blog-posts-container { margin-top: 2rem; }
.blog-post-summary { display: flex; gap: 1.5rem; align-items: flex-start; border-bottom: 1px solid var(--border-1); padding-block: 2rem; }
.blog-post-summary:first-of-type { padding-top: 1rem; }
.blog-post-summary:last-of-type { border-bottom: none; }
.blog-post-thumb { flex: 0 0 200px; }
.blog-post-thumb img { aspect-ratio: 1/1; object-fit: cover; border-radius: 12px; }
.blog-post-content h2 { margin: 0 0 0.5rem; font-size: 1.3rem; }
.blog-post-content h2 a:hover { color: var(--accent); }
.blog-post-actions { margin-top: 1rem; display: flex; gap: 1rem; }

@media(max-width: 600px) { .blog-post-summary { flex-direction: column; } .blog-post-thumb { width: 100%; flex: auto; } }

/* --------------------------------- أزرار مساعدة --------------------------------- */
#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  transform: translateY(10px);
}
#back-to-top.show { opacity: 1; transform: translateY(0); display: flex; }

.btn-return-home {
    background: var(--accent-2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}
.btn-return-home:hover { background: var(--accent); }
