/*
Theme Name: COD Store | متجر الدفع عند الاستلام
Theme URI: https://example.com/
Author: Your Name
Description: قالب ووردبريس عربي (RTL) مخصص لمتاجر الدفع عند الاستلام في السعودية. صفحة منتج بنموذج طلب سريع، صفحة رئيسية Landing، زر واتساب عائم، وشريط طلب ثابت للجوال. يعمل مع WooCommerce.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: cod-store
Tags: rtl-language-support, e-commerce, one-column, custom-colors, custom-logo
*/

:root {
  --cod-primary: #22c55e;
  --cod-primary-dark: #16a34a;
  --cod-dark: #0f172a;
  --cod-text: #1e293b;
  --cod-muted: #64748b;
  --cod-bg: #f8fafc;
  --cod-card: #ffffff;
  --cod-border: #e2e8f0;
  --cod-radius: 14px;
  --cod-shadow: 0 6px 24px rgba(15, 23, 42, .07);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Tajawal', 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background: var(--cod-bg);
  color: var(--cod-text);
  line-height: 1.8;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--cod-primary-dark); text-decoration: none; }
a:hover { color: var(--cod-primary); }

.cod-container { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- Header ---------- */
.cod-topbar {
  background: var(--cod-dark);
  color: #fff;
  text-align: center;
  font-size: 14px;
  padding: 8px 12px;
}
.cod-header {
  background: #fff;
  border-bottom: 1px solid var(--cod-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.cod-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}
.cod-logo { font-size: 22px; font-weight: 800; color: var(--cod-dark); }
.cod-logo img { max-height: 46px; width: auto; }
.cod-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; }
.cod-nav a { color: var(--cod-text); font-weight: 500; }
.cod-nav a:hover { color: var(--cod-primary-dark); }
.cod-cart-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cod-bg); border: 1px solid var(--cod-border);
  padding: 6px 14px; border-radius: 999px; font-weight: 700; color: var(--cod-dark);
}
.cod-menu-toggle { display: none; background: none; border: 0; font-size: 26px; cursor: pointer; }

/* ---------- Buttons ---------- */
.cod-btn, .button, button.single_add_to_cart_button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--cod-primary); color: #fff !important;
  border: 0; border-radius: 12px; padding: 13px 26px;
  font-family: inherit; font-size: 17px; font-weight: 700; cursor: pointer;
  transition: transform .15s, background .15s, box-shadow .15s;
  box-shadow: 0 6px 16px rgba(34, 197, 94, .3);
}
.cod-btn:hover, .button:hover { background: var(--cod-primary-dark); transform: translateY(-1px); color: #fff; }
.cod-btn-outline {
  background: transparent; color: var(--cod-dark) !important;
  border: 2px solid var(--cod-border); box-shadow: none;
}
.cod-btn-outline:hover { background: #fff; border-color: var(--cod-primary); }

/* ---------- Hero ---------- */
.cod-hero {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #fff 100%);
  padding: 64px 0 56px;
}
.cod-hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.cod-hero h1 { font-size: clamp(28px, 4.5vw, 46px); line-height: 1.3; margin: 0 0 16px; color: var(--cod-dark); }
.cod-hero p { font-size: 18px; color: var(--cod-muted); margin: 0 0 26px; }
.cod-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.cod-hero-img img { border-radius: 24px; box-shadow: var(--cod-shadow); margin-inline: auto; }
.cod-hero-badge {
  display: inline-block; background: #fff; border: 1px solid #bbf7d0; color: var(--cod-primary-dark);
  padding: 4px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; margin-bottom: 14px;
}

/* ---------- Features ---------- */
.cod-section { padding: 56px 0; }
.cod-section-title { text-align: center; font-size: 30px; margin: 0 0 8px; color: var(--cod-dark); }
.cod-section-sub { text-align: center; color: var(--cod-muted); margin: 0 0 36px; }
.cod-features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.cod-feature {
  background: var(--cod-card); border: 1px solid var(--cod-border); border-radius: var(--cod-radius);
  padding: 26px 20px; text-align: center; box-shadow: var(--cod-shadow);
}
.cod-feature .ico { font-size: 34px; margin-bottom: 8px; }
.cod-feature h3 { margin: 0 0 6px; font-size: 18px; }
.cod-feature p { margin: 0; color: var(--cod-muted); font-size: 15px; }

/* ---------- Products grid ---------- */
ul.products {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
ul.products li.product {
  background: var(--cod-card); border: 1px solid var(--cod-border); border-radius: var(--cod-radius);
  padding: 12px; text-align: center; position: relative; box-shadow: var(--cod-shadow);
  transition: transform .15s;
}
ul.products li.product:hover { transform: translateY(-3px); }
ul.products li.product img { border-radius: 10px; margin-bottom: 10px; width: 100%; }
.woocommerce-loop-product__title { font-size: 16px !important; margin: 6px 0; color: var(--cod-dark); }
.price { color: var(--cod-primary-dark); font-weight: 800; font-size: 18px; }
.price del { color: var(--cod-muted); font-weight: 400; font-size: 14px; margin-inline-start: 6px; }
.price ins { text-decoration: none; }
.onsale {
  position: absolute; top: 10px; inset-inline-start: 10px; background: #ef4444; color: #fff;
  border-radius: 999px; padding: 2px 12px; font-size: 13px; font-weight: 700; z-index: 2;
}
ul.products li.product .button { width: 100%; padding: 10px; font-size: 15px; margin-top: 8px; }

/* ---------- Single product ---------- */
.cod-single { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; padding: 36px 0; align-items: start; }
.single-product div.product .woocommerce-product-gallery { margin: 0; }
.single-product .product_title { font-size: 28px; margin: 0 0 8px; color: var(--cod-dark); }
.single-product .summary .price { font-size: 26px; display: block; margin-bottom: 12px; }
.single-product .woocommerce-product-details__short-description { color: var(--cod-muted); margin-bottom: 16px; }
.cod-trust { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0; font-size: 14px; color: var(--cod-muted); }
.cod-trust span::before { content: "✔ "; color: var(--cod-primary-dark); font-weight: 800; }

/* ---------- Order form ---------- */
.cod-order-box {
  background: #fff; border: 2px solid var(--cod-primary); border-radius: 18px;
  padding: 22px; margin-top: 18px; box-shadow: 0 10px 30px rgba(34, 197, 94, .12);
}
.cod-order-box h3 { margin: 0 0 4px; font-size: 20px; text-align: center; color: var(--cod-dark); }
.cod-order-box .sub { text-align: center; color: var(--cod-muted); margin: 0 0 16px; font-size: 14px; }
.cod-field { margin-bottom: 12px; }
.cod-field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.cod-field input, .cod-field select, .cod-field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--cod-border); border-radius: 10px;
  font-family: inherit; font-size: 16px; background: #fff; color: var(--cod-text);
}
.cod-field input:focus, .cod-field select:focus, .cod-field textarea:focus {
  outline: none; border-color: var(--cod-primary); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18);
}
.cod-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cod-qty { display: inline-flex; border: 1.5px solid var(--cod-border); border-radius: 10px; overflow: hidden; }
.cod-qty button { width: 44px; border: 0; background: var(--cod-bg); font-size: 20px; cursor: pointer; }
.cod-qty input { width: 56px; border: 0; text-align: center; border-radius: 0; padding: 10px 0; }
.cod-summary { background: var(--cod-bg); border-radius: 10px; padding: 12px 14px; margin: 14px 0; font-size: 15px; }
.cod-summary div { display: flex; justify-content: space-between; padding: 3px 0; }
.cod-summary .total { border-top: 1px dashed var(--cod-border); margin-top: 6px; padding-top: 8px; font-weight: 800; font-size: 18px; color: var(--cod-primary-dark); }
.cod-submit { width: 100%; font-size: 19px; padding: 15px; }
.cod-submit[disabled] { opacity: .6; cursor: wait; }
.cod-msg { margin-top: 12px; padding: 12px; border-radius: 10px; display: none; font-weight: 700; text-align: center; }
.cod-msg.ok { display: block; background: #dcfce7; color: #166534; }
.cod-msg.err { display: block; background: #fee2e2; color: #991b1b; }
.cod-pay-note { text-align: center; font-size: 13px; color: var(--cod-muted); margin-top: 10px; }
.cod-hp { position: absolute; left: -9999px; opacity: 0; height: 0; }

/* ---------- Sticky mobile bar ---------- */
.cod-sticky-bar {
  display: none; position: fixed; bottom: 0; inset-inline: 0; z-index: 60;
  background: #fff; border-top: 1px solid var(--cod-border); padding: 10px 14px;
  box-shadow: 0 -6px 20px rgba(0,0,0,.08);
}
.cod-sticky-bar .cod-btn { width: 100%; }

/* ---------- WhatsApp float ---------- */
.cod-whatsapp {
  position: fixed; bottom: 20px; inset-inline-start: 18px; z-index: 70;
  width: 56px; height: 56px; border-radius: 50%; background: #25d366; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
}
.cod-whatsapp:hover { color: #fff; transform: scale(1.06); }

/* ---------- Footer ---------- */
.cod-footer { background: var(--cod-dark); color: #cbd5e1; padding: 36px 0 20px; margin-top: 40px; }
.cod-footer a { color: #e2e8f0; }
.cod-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.cod-footer h4 { color: #fff; margin: 0 0 10px; }
.cod-footer ul { list-style: none; margin: 0; padding: 0; }
.cod-footer li { margin-bottom: 6px; }
.cod-copy { border-top: 1px solid #334155; margin-top: 24px; padding-top: 14px; text-align: center; font-size: 14px; }

/* ---------- Generic content ---------- */
.cod-content { background: #fff; border: 1px solid var(--cod-border); border-radius: var(--cod-radius); padding: 26px; margin: 28px 0; }
.cod-content h1 { margin-top: 0; }

/* ---------- One-page sales layout ---------- */
.cod-sales { max-width: 680px; margin: 0 auto; padding: 16px 0 32px; }
.cod-gallery { margin-bottom: 14px; }
.cod-gallery-main {
  position: relative; background: #fff; border: 1px solid var(--cod-border);
  border-radius: 18px; overflow: hidden; touch-action: pan-y;
}
.cod-gallery-main img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #fff; }
.cod-disc {
  position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2;
  background: #ef4444; color: #fff; font-weight: 800; padding: 3px 12px; border-radius: 999px; font-size: 14px;
}
.cod-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.9); box-shadow: 0 2px 10px rgba(0,0,0,.18); font-size: 26px; line-height: 1;
}
.cod-arrow.prev { inset-inline-end: 10px; }
.cod-arrow.next { inset-inline-start: 10px; }
.cod-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: thin; }
.cod-thumb {
  flex: 0 0 64px; height: 64px; padding: 0; border: 2px solid var(--cod-border);
  border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer;
}
.cod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cod-thumb.active { border-color: var(--cod-primary); }

.cod-title { font-size: clamp(22px, 5vw, 30px); line-height: 1.5; margin: 10px 0 6px; color: var(--cod-dark); }
.cod-price-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.cod-price-row .price { font-size: 30px; }
.cod-chip {
  background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--cod-primary-dark);
  border-radius: 999px; padding: 2px 12px; font-size: 14px; font-weight: 700;
}
.cod-stock {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  border-radius: 10px; padding: 8px 14px; margin-bottom: 10px; font-size: 15px; text-align: center;
}
.cod-countdown {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--cod-dark); color: #fff; border-radius: 10px; padding: 8px 14px; margin-bottom: 10px;
  font-size: 15px; direction: ltr;
}
.cod-countdown span { direction: rtl; margin-inline-end: 8px; }
.cod-countdown b { background: #fff; color: var(--cod-dark); border-radius: 6px; padding: 1px 8px; min-width: 34px; text-align: center; }
.cod-buy-btn { width: 100%; font-size: 20px; padding: 16px; margin: 6px 0; }
.cod-benefits { list-style: none; margin: 14px 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cod-benefits li {
  background: #fff; border: 1px solid var(--cod-border); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-weight: 700; text-align: center;
}
.cod-desc { margin-top: 26px; }
.cod-desc img { width: 100%; height: auto; margin: 0 auto; border-radius: 10px; }
.cod-desc p { margin: 0 0 12px; }
.cod-faq { margin: 26px 0 16px; }
.cod-faq h2 { text-align: center; font-size: 22px; margin: 0 0 12px; }
.cod-faq details { background: #fff; border: 1px solid var(--cod-border); border-radius: 10px; margin-bottom: 8px; padding: 12px 14px; }
.cod-faq summary { cursor: pointer; font-weight: 700; }
.cod-faq p { margin: 8px 0 0; color: var(--cod-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .cod-hero-grid, .cod-single, .cod-footer-grid { grid-template-columns: 1fr; }
  .cod-features, ul.products { grid-template-columns: repeat(2, 1fr); }
  .cod-menu-toggle { display: block; }
  .cod-nav { display: none; position: absolute; top: 68px; inset-inline: 0; background: #fff; border-bottom: 1px solid var(--cod-border); padding: 12px 16px; }
  .cod-nav.open { display: block; }
  .cod-nav ul { flex-direction: column; gap: 10px; }
  .cod-header-inner { position: relative; }
}
@media (max-width: 640px) {
  .cod-sticky-bar { display: block; }
  body.single-product { padding-bottom: 76px; }
  .cod-whatsapp { bottom: 84px; }
  .cod-row { grid-template-columns: 1fr; }
}
