* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: #032335;
  min-height: 100vh;
  direction: rtl;
  color: #333;
}

.header {
  background: #023649;
  padding: 1rem 2rem;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
  z-index: 100;
}

.header img {
  max-width: 180px;
}

.category {
  margin: 2rem;
}

.category h2 {
  color: white;
  margin-bottom: 1.5rem;
  font-size: 2rem;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card.out-of-stock {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.card.out-of-stock::before {
  content: 'ناموجود';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-20deg);
  background: rgba(220, 53, 69, 0.9);
  color: white;
  padding: 15px 60px;
  font-size: 2rem;
  font-weight: bold;
  z-index: 10;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card.out-of-stock .order-controls {
  opacity: 0.3;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.product-thumbnail {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 15px;
  margin-bottom: 1rem;
}

.content .title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
}

.content .description {
  color: #666;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.content .price {
  font-size: 1.4rem;
  font-weight: bold;
  color: #27ae60;
  margin-bottom: 1rem;
}

.content .price::after {
  content: ' تومان';
  font-size: 0.8rem;
  color: #666;
}

.order-controls {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 1rem;
  margin-top: 1rem;
  border: 2px solid #e9ecef;
}

.quantity-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.quantity-label {
  font-weight: 600;
  color: #495057;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quantity-btn {
  background: #34495e;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.quantity-btn:hover {
  background: #2c3e50;
  transform: scale(1.05);
}

.quantity-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.quantity-display {
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: bold;
  font-size: 1.1rem;
  min-width: 80px;
  text-align: center;
  color: #495057;
}

.total-price {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 2px solid #dee2e6;
  margin-top: 1rem;
}

.total-label {
  font-weight: 600;
  color: #495057;
}

.total-amount {
  font-size: 1.3rem;
  font-weight: bold;
  color: #dc3545;
}

.total-amount::after {
  content: ' تومان';
  font-size: 0.9rem;
  color: #666;
}

.card-placeholder {
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 3rem;
  text-align: center;
  color: white;
  font-size: 1.2rem;
  backdrop-filter: blur(10px);
}

.order-summary {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(52, 73, 94, 0.95);
  backdrop-filter: blur(10px);
  padding: 0.5rem;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  border-top: 3px solid #34495e;
}

.summary-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.summary-info {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.summary-item {
  text-align: center;
}

.summary-item .label {
  display: block;
  font-size: 0.85rem;
  color: #ecf0f1;
  margin-bottom: 0.25rem;
}

.summary-item .value {
  font-size: 1.2rem;
  font-weight: bold;
  color: white;
}

.continue-btn {
  background: linear-gradient(45deg, #28a745, #20c997);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.continue-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.continue-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* ==========================================
   استایل‌های اسکرول افقی دسته‌بندی‌ها
   ========================================== */

/* نوار دسته‌بندی شناور */
.category-tabs-wrapper {
  position: sticky;
  top: 0;
  background: #023649;
  z-index: 999;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  padding: 10px 0;
  margin-bottom: 20px;
}

.category-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 15px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  border: 2px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.category-tab:hover {
  background: rgba(255, 255, 255, 0.2);
}

.category-tab.active {
  background: linear-gradient(45deg, #28a745, #20c997);
  border-color: white;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

/* دسته‌بندی با اسکرول افقی */
.category-section {
  margin-bottom: 30px;
  scroll-margin-top: 80px;
}

.category-title {
  color: white;
  font-size: 22px;
  font-weight: 700;
  margin: 0 15px 15px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #073249FF 0%, #08628EFF 100%);
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* کانتینر اسکرول افقی */
.horizontal-scroll-container {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 15px 15px;
}

.horizontal-scroll-container::-webkit-scrollbar {
  display: none;
}

.card-container {
  display: flex;
  gap: 15px;
  width: max-content;
  grid-template-columns: unset;
}

/* کارت محصول - نمایش عمودی در اسکرول افقی */
.card {
  flex-shrink: 0;
  width: 280px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.product-thumbnail {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 15px;
  margin-bottom: 12px;
}

.content .title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
  line-height: 1.3;
  min-height: 40px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.content .description {
  color: #666;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.4;
  min-height: 38px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.content .price {
  font-size: 18px;
  font-weight: bold;
  color: #27ae60;
  margin-bottom: 12px;
}

.order-controls {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 10px;
  margin-top: auto;
  border: 2px solid #e9ecef;
}

.quantity-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.quantity-label {
  font-size: 13px;
  font-weight: 600;
  color: #495057;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quantity-btn {
  background: #34495e;
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 14px;
}

.quantity-btn:hover {
  background: #2c3e50;
  transform: scale(1.05);
}

.quantity-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.quantity-display {
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  padding: 6px 14px;
  font-weight: bold;
  font-size: 15px;
  min-width: 50px;
  text-align: center;
  color: #495057;
}

.total-price {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 2px solid #dee2e6;
  margin-top: 8px;
}

.total-label {
  font-size: 13px;
  font-weight: 600;
  color: #495057;
}

.total-amount {
  font-size: 16px;
  font-weight: bold;
  color: #dc3545;
}

/* محصول ناموجود */
.card.out-of-stock {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.card.out-of-stock::before {
  content: 'ناموجود';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  background: rgba(220, 53, 69, 0.9);
  color: white;
  padding: 10px 40px;
  font-size: 18px;
  font-weight: bold;
  z-index: 10;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card.out-of-stock .order-controls {
  opacity: 0.3;
}

/* پلیس‌هولدر */
.card-placeholder {
  flex-shrink: 0;
  width: 280px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 3rem;
  text-align: center;
  color: white;
  font-size: 1.2rem;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* خلاصه سفارش */
.order-summary {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(52, 73, 94, 0.95);
  backdrop-filter: blur(10px);
  padding: 12px;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  border-top: 3px solid #34495e;
}

.summary-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.summary-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.summary-item {
  text-align: center;
}

.summary-item .label {
  display: block;
  font-size: 11px;
  color: #ecf0f1;
  margin-bottom: 4px;
}

.summary-item .value {
  font-size: 16px;
  font-weight: bold;
  color: white;
}

.continue-btn {
  background: linear-gradient(45deg, #28a745, #20c997);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.continue-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.continue-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* موبایل */
@media (max-width: 768px) {
  .header {
    padding: 12px 15px;
  }

  .header img {
    max-width: 140px;
  }

  .category-title {
    font-size: 18px;
    margin: 0 10px 12px;
    padding: 10px 15px;
  }

  .horizontal-scroll-container {
    padding: 0 10px 12px;
  }

  .card {
    width: 260px;
  }

  .product-thumbnail {
    height: 160px;
  }

  .card-placeholder {
    width: 260px;
    padding: 2rem;
    font-size: 1rem;
  }

  .summary-content {
    flex-direction: column;
    gap: 10px;
  }

  .summary-info {
    width: 100%;
    justify-content: center;
  }

  .continue-btn {
    width: 100%;
    justify-content: center;
  }

  body {
    padding-bottom: 110px;
  }

  .category-tab {
    font-size: 13px;
    padding: 10px 20px;
  }

  .category {
    margin: 1rem;
  }

  .card-container {
    grid-template-columns: 1fr;
  }
}

/* تبلت */
@media (min-width: 769px) and (max-width: 1024px) {
  .card {
    width: 300px;
  }

  .product-thumbnail {
    height: 200px;
  }
}

/* دسکتاپ */
@media (min-width: 1025px) {
  .category-tabs {
    justify-content: center;
    padding: 0 30px;
  }

  .horizontal-scroll-container {
    padding: 0 30px 20px;
  }

  .card {
    width: 320px;
  }

  .product-thumbnail {
    height: 200px;
  }

  /* نمایش scrollbar برای دسکتاپ */
  .horizontal-scroll-container::-webkit-scrollbar {
    display: block;
    height: 8px;
  }

  .horizontal-scroll-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 0 30px;
  }

  .horizontal-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
  }

  .horizontal-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
  }
}

/* انیمیشن */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* اسکرول نرم */
html {
  scroll-behavior: smooth;
}

/* بهبود تجربه لمسی */
@media (hover: none) and (pointer: coarse) {
  .quantity-btn {
    width: 40px;
    height: 40px;
  }

  .category-tab {
    padding: 12px 22px;
  }
}