/*
Theme Name: مستطیل شاپ
Theme URI: https://moostatill.ir
Author: Mostatil Shop
Description: قالب اختصاصی فروشگاه لوازم‌التحریر مستطیل — سازگار با WooCommerce
Version: 1.0
Text Domain: mostatil-shop
*/

@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap");

:root {
  --primary: #2b3a67;
  --primary-dark: #1e2a4d;
  --accent: #f2994a;
  --accent-dark: #d9822f;
  --bg: #f7f8fb;
  --card: #ffffff;
  --text: #23272f;
  --muted: #6b7280;
  --success: #27ae60;
  --danger: #e0554f;
  --border: #e6e8ee;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Topbar */
.topbar {
  background: var(--primary-dark);
  color: #dfe4f2;
  font-size: 13px;
  padding: 6px 0;
}
.topbar .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }

/* Header */
header.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  flex-wrap: wrap;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 22px;
  color: var(--primary);
  white-space: nowrap;
}
.logo span.mark {
  background: var(--primary);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.search-box {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  gap: 8px;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}
.header-actions { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.badge {
  position: absolute;
  top: -6px;
  left: -6px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Category nav */
.category-nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.category-nav .container {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
}
.cat-tab {
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.cat-tab.active,
.cat-tab:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  margin: 24px auto 0;
  padding: 40px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.hero h1 { font-size: 28px; margin: 0 0 8px; }
.hero p { margin: 0; color: #cfd6ea; font-size: 15px; }
.hero .hero-icon { font-size: 64px; }

/* Section title */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 32px 0 16px;
}
.section-title h2 { font-size: 20px; margin: 0; }
.section-title .count { color: var(--muted); font-size: 13px; }

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  padding-bottom: 40px;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}
.product-card:hover {
  box-shadow: 0 8px 24px rgba(43, 58, 103, 0.12);
  transform: translateY(-2px);
}
.product-thumb {
  height: 140px;
  background: #eef1fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
  overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.discount-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.product-link { display: block; color: inherit; }
.product-link:hover .product-name { color: var(--primary); }
.product-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-cat { font-size: 11px; color: var(--muted); }
.product-name { font-size: 14.5px; font-weight: 600; line-height: 1.5; min-height: 42px; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.price { font-weight: 700; color: var(--primary); font-size: 15px; }
.old-price { text-decoration: line-through; color: var(--muted); font-size: 12px; }
.stock { font-size: 11px; color: var(--success); }
.add-btn {
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.add-btn:hover { background: var(--accent-dark); }
.add-btn:disabled { background: #c9ccd4; cursor: not-allowed; }

/* Cart drawer */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 38, 0.45);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 92vw;
  height: 100%;
  background: var(--card);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease;
  box-shadow: -6px 0 24px rgba(0,0,0,0.15);
}
.cart-drawer.open { right: 0; }
.cart-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-header h3 { margin: 0; font-size: 17px; }
.close-btn {
  background: var(--bg);
  width: 34px; height: 34px;
  border-radius: 8px;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.cart-items { flex: 1; overflow-y: auto; padding: 12px 20px; display: flex; flex-direction: column; gap: 12px; }
.cart-item { display: flex; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.cart-item .thumb {
  width: 56px; height: 56px; background: #eef1fa; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; overflow: hidden;
}
.cart-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.cart-item .info .name { font-size: 13.5px; font-weight: 600; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button {
  width: 26px; height: 26px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); font-size: 15px;
}
.qty-control .qty-val { font-size: 13px; min-width: 18px; text-align: center; }
.remove-link { color: var(--danger); font-size: 12px; margin-right: auto; }
.cart-item .item-total { font-size: 13px; font-weight: 700; color: var(--primary); }
.empty-cart { text-align: center; color: var(--muted); padding: 40px 0; }
.cart-footer { border-top: 1px solid var(--border); padding: 16px 20px 20px; }
.cart-total-row { display: flex; justify-content: space-between; font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.checkout-btn {
  width: 100%; background: var(--primary); color: #fff; font-weight: 700;
  padding: 13px; border-radius: 10px; font-size: 15px;
}
.checkout-btn:disabled { background: #c9ccd4; }

/* Footer */
footer.site-footer {
  background: var(--primary-dark);
  color: #cfd6ea;
  margin-top: 40px;
  padding: 32px 0 18px;
  font-size: 13.5px;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; }
.footer-grid h4 { color: #fff; font-size: 15px; margin: 0 0 10px; }
.footer-grid li { margin-bottom: 6px; opacity: 0.9; }
.footer-bottom { text-align: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.1); opacity: 0.7; }

/* Product detail (single product) */
.breadcrumb { font-size: 13px; color: var(--muted); margin: 18px 0; }
.breadcrumb a { color: var(--primary); }
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 40px;
}
.product-detail-thumb {
  background: #eef1fa;
  border-radius: var(--radius);
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 110px;
  position: relative;
  overflow: hidden;
}
.product-detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-detail-info h1 { font-size: 22px; margin: 0 0 6px; }
.product-detail-info .product-cat { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.product-detail-info .price-row { margin: 14px 0; gap: 12px; }
.product-detail-info .price { font-size: 22px; }
.product-detail-info .old-price { font-size: 14px; }
.product-detail-info .desc { color: var(--text); font-size: 14.5px; line-height: 1.9; margin: 14px 0; }
.detail-stock { font-size: 13px; margin-bottom: 6px; }

.qty-selector { display: flex; align-items: center; gap: 12px; margin: 18px 0; }
.qty-selector button {
  width: 34px; height: 34px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); font-size: 17px;
}
.qty-selector .qty-num { font-size: 15px; min-width: 20px; text-align: center; font-weight: 600; }

.detail-add-btn {
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  padding: 13px 28px; border-radius: 10px; width: 100%;
}
.detail-add-btn:hover { background: var(--accent-dark); }

@media (max-width: 760px) {
  .product-detail { grid-template-columns: 1fr; }
  .product-detail-thumb { height: 220px; font-size: 80px; }
}

@media (max-width: 860px) {
  .search-box { order: 3; flex-basis: 100%; }
  .hero { flex-direction: column; text-align: center; }
}

/* پیام موقت وقتی ووکامرس هنوز فعال نشده */
.wc-missing-notice {
  background: #fff8e6; border: 1px solid #f2c94c; color: #7a5b00;
  padding: 16px 20px; border-radius: var(--radius); margin: 24px 0; font-size: 14px;
}
