/*
Theme Name: DigiKala Pro (دیجی‌کالا پرو)
Description: پوسته حرفه‌ای شبیه دیجی‌کالا برای ووکامرس، راست‌چین، تمام‌عیار و آسان برای ویرایش
Version: 2.0.0
Requires at least: 5.8
Requires PHP: 7.4
Text Domain: digikala-pro
License: GPLv2 or later
*/

:root {
  --primary: #ee3333;
  --dark: #1a1a1a;
  --light: #f5f5f5;
  --gray: #999;
  --border: #e0e0e0;
  --white: #fff;
  --success: #21a940;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #ff4444;
    --dark: #f5f5f5;
    --light: #222;
    --gray: #999;
    --white: #1a1a1a;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  padding: 0;
  background: var(--white);
  color: var(--dark);
  font-family: IRANSansX, Vazirmatn, Tahoma, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.8;
  direction: rtl;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding-inline: 12px;
}

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.header-top {
  padding: 8px 0;
  background: #f9f9f9;
  font-size: 12px;
  color: var(--gray);
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.header-top a {
  color: var(--gray);
}

.header-top a:hover {
  color: var(--primary);
}

.header-main {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 0;
  justify-content: space-between;
}

.logo {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  min-width: 140px;
}

.logo a {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-bar {
  flex: 1;
  max-width: 500px;
  display: flex;
  background: var(--light);
  border-radius: 4px;
  overflow: hidden;
}

.search-bar input {
  border: 0;
  background: transparent;
  padding: 10px 16px;
  width: 100%;
  color: var(--dark);
  font-size: 14px;
}

.search-bar input::placeholder {
  color: var(--gray);
}

.search-bar button {
  background: var(--primary);
  color: white;
  border: 0;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
}

.header-icons {
  display: flex;
  gap: 16px;
  align-items: center;
}

.icon-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--dark);
  position: relative;
}

.cart-count {
  position: absolute;
  top: -8px;
  inset-inline-start: -8px;
  background: var(--primary);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

/* Category Menu */
.category-menu {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.category-menu ul {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  justify-content: center;
}

.category-menu a {
  display: block;
  padding: 8px 0;
  font-size: 13px;
  color: var(--dark);
  border-bottom: 2px solid transparent;
}

.category-menu a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Slider */
.slider {
  position: relative;
  width: 100%;
  max-height: 400px;
  overflow: hidden;
  border-radius: 4px;
  margin-bottom: 24px;
}

.slider-item {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, #ff6666 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  min-height: 200px;
  font-size: 32px;
  font-weight: 800;
  animation: slideshow 10s ease-in-out;
}

@keyframes slideshow {
  0% { opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; }
}

/* Product Grid */
.woocommerce ul.products,
.woocommerce-page ul.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  list-style: none;
  margin: 0 0 30px;
  padding: 0;
}

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
  float: none;
  width: auto;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.woocommerce ul.products li.product:hover,
.woocommerce-page ul.products li.product:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.woocommerce ul.products li.product a img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  margin: 0;
  background: var(--light);
}

.woocommerce ul.products li.product .product-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  margin: 0 0 8px;
  padding: 0;
  color: var(--dark);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.woocommerce ul.products li.product .price {
  font-size: 14px;
  color: var(--dark);
  margin: 0 0 8px;
}

.woocommerce ul.products li.product .price del {
  color: var(--gray);
  font-size: 12px;
  margin-inline-start: 8px;
}

.woocommerce ul.products li.product .star-rating {
  font-size: 12px;
  margin-bottom: 8px;
}

.woocommerce ul.products li.product .button {
  background: var(--primary);
  color: white;
  border: 0;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: auto;
}

.woocommerce ul.products li.product .button:hover {
  background: #cc2929;
}

.woocommerce span.onsale {
  background: var(--primary);
  color: white;
  border-radius: 0;
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  inset-inline-end: auto;
  right: auto;
  padding: 4px 8px;
  font-size: 12px;
  min-width: 0;
  min-height: 0;
  line-height: 1.5;
}

/* Single Product */
.woocommerce div.product {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding: 0;
}

@media (max-width: 768px) {
  .woocommerce div.product {
    grid-template-columns: 1fr;
  }
}

.woocommerce div.product .woocommerce-product-gallery {
  margin: 0;
}

.woocommerce div.product .woocommerce-product-gallery img {
  border-radius: 4px;
  border: 1px solid var(--border);
}

.woocommerce div.product .product_title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.6;
  margin-bottom: 12px;
}

.woocommerce div.product .price {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}

.woocommerce div.product .star-rating {
  margin-bottom: 12px;
}

.woocommerce div.product .woocommerce-product-details__short-description {
  color: var(--gray);
  margin-bottom: 20px;
  line-height: 1.8;
}

/* Buttons */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
  background: var(--primary);
  color: white;
  border: 0;
  border-radius: 4px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover {
  background: #cc2929;
}

/* Forms */
.woocommerce form .form-row input,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  font-size: 14px;
  width: 100%;
}

/* Footer */
.site-footer {
  background: #f5f5f5;
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 60px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.footer-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-section li {
  margin-bottom: 8px;
}

.footer-section a {
  color: var(--gray);
  font-size: 13px;
}

.footer-section a:hover {
  color: var(--primary);
}

.footer-bottom {
  text-align: center;
  color: var(--gray);
  font-size: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
  .header-main {
    gap: 12px;
  }

  .search-bar {
    max-width: none;
  }

  .header-icons {
    gap: 12px;
  }

  .woocommerce ul.products,
  .woocommerce-page ul.products {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }

  .slider-item {
    font-size: 20px;
    min-height: 150px;
  }
}
