/* static/css/product/list.css */
/* دُرج | محصولات - یکپارچه */

/* ========================================
   Layout
   ======================================== */
.product-page {
  min-height: 100vh;
  padding: var(--space-xl) var(--space-md);
}

.product-page__header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.product-page__title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--dark-jade);
  margin-bottom: var(--space-xs);
}

.product-page__subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ========================================
   Filters
   ======================================== */
.product-filters {
  max-width: 1400px;
  margin: 0 auto var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(201,162,77,0.1);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  align-items: center;
}

.filter-group {
  flex: 1;
  min-width: 180px;
}

.filter-select {
  width: 100%;
  padding: 12px 36px 12px 16px;
  border: 2px solid rgba(201,162,77,0.2);
  border-radius: var(--radius-full);
  background: white;
  font-family: inherit;
  font-size: 0.9rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234A7856' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,77,0.1);
}

.filter-actions {
  text-align: center;
  margin-top: var(--space-sm);
}

.clear-filters {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  transition: all 0.3s ease;
  font-family: inherit;
}

.clear-filters:hover { background: rgba(220,38,38,0.06); }

/* ========================================
   Product Grid
   ======================================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  max-width: 1400px;
  margin: 0 auto var(--space-2xl);
}

/* ========================================
   Product Card
   ======================================== */
.product-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(201,162,77,0.08);
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  animation: cardUp 0.45s ease forwards;
  opacity: 0;
}

@keyframes cardUp {
  to { opacity: 1; transform: translateY(0); }
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  border-color: var(--gold);
}

.product-card__image {
  aspect-ratio: 1;
  overflow: hidden;
  background: linear-gradient(145deg, var(--dark-jade), #1a3a1f);
  cursor: pointer;
  position: relative;
}

.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .product-card__image img { transform: scale(1.06); }

.product-card__no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  opacity: 0.25;
}

/* ── Badges ── */
.product-card__badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  z-index: 2;
}

.badge {
  padding: 5px 12px;
  border-radius: var-radius-full;
  font-size: 0.7rem;
  font-weight: 700;
}

.badge--stock { background: var(--royal-jade); color: white; }
.badge--nostock { background: #ef4444; color: white; }
.badge--wage { background: rgba(255,255,255,0.9); color: var(--gold); border: 1px solid rgba(201,162,77,0.3); }

/* ── Body ── */
.product-card__body {
  padding: var(--space-md) var(--space-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.product-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-jade);
  cursor: pointer;
  line-height: 1.5;
}

.product-card__specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: var(--space-sm) 0;
  border-top: 1px solid rgba(0,0,0,0.04);
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.product-card__spec {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.product-card__spec strong { color: var(--text-dark); font-weight: 600; }

.product-card__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.product-card__cat {
  background: rgba(74,120,86,0.06);
  color: var(--royal-jade);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 500;
}

/* ── Footer ── */
.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid #f0f0f0;
}

.product-card__price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--royal-jade);
}

.product-card__price small {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
}

.product-card__btn {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--gold), var(--dark-gold));
  color: var(--dark-jade);
  text-decoration: none;
  transition: all 0.3s ease;
}

.product-card__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(201,162,77,0.3);
}

/* ========================================
   Pagination
   ======================================== */
.pagination-container {
  display: flex;
  justify-content: center;
  margin-top: var(--space-xl);
}

.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: white;
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.page-btn {
  background: var(--royal-jade);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.page-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(74,120,86,0.3); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.page-info { color: var(--dark-jade); font-weight: 600; font-size: 0.9rem; }

/* ========================================
   Modal
   ======================================== */
.product-detail-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.product-detail-modal.active { display: block; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.modal-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 900px;
  max-height: 90vh;
  background: white;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: var(--space-md) var(--space-xl);
  background: linear-gradient(135deg, var(--dark-jade), var(--royal-jade));
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h2 { margin: 0; font-size: 1.2rem; }

.modal-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.modal-close:hover { background: rgba(255,255,255,0.25); transform: rotate(90deg); }

.modal-body {
  padding: var(--space-xl);
  overflow-y: auto;
  flex: 1;
}

/* ── Detail Layout ── */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

.detail-gallery { display: flex; flex-direction: column; gap: var(--space-sm); }

.detail-image {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #f5f5f5;
}

.detail-image img { width: 100%; height: 100%; object-fit: cover; }

.detail-thumbnails { display: flex; gap: var(--space-xs); flex-wrap: wrap; }

.detail-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.detail-thumb.active,
.detail-thumb:hover { border-color: var(--gold); }

.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Info ── */
.detail-info { display: flex; flex-direction: column; gap: var(--space-md); }

.detail-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--dark-jade);
  line-height: 1.5;
}

.detail-specs { display: flex; flex-direction: column; gap: 2px; }

.detail-spec {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #eee;
  font-size: 0.9rem;
}

.detail-spec__label { color: var(--text-muted); }
.detail-spec__value { color: var(--dark-jade); font-weight: 700; }
.detail-spec__value--price {
  color: var(--royal-jade);
  font-size: 1.15rem;
  font-weight: 800;
}

.detail-description {
  background: #f9fafb;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-muted);
}

.detail-description h3 { color: var(--dark-jade); margin-bottom: var(--space-xs); font-size: 1rem; }

/* ── Actions ── */
.detail-actions { display: flex; gap: var(--space-sm); margin-top: auto; }

.add-to-cart-btn {
  flex: 1;
  background: linear-gradient(135deg, var(--royal-jade), var(--dark-jade));
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.add-to-cart-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(74,120,86,0.3); }
.add-to-cart-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.favorite-btn {
  width: 50px;
  height: 50px;
  border: 2px solid rgba(201,162,77,0.2);
  background: white;
  border-radius: var(--radius-md);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.favorite-btn:hover { border-color: #ef4444; }
.favorite-btn.liked { background: #fef2f2; border-color: #ef4444; }

/* ── Similar ── */
.similar-products { margin-top: var(--space-lg); }
.similar-products h3 { color: var(--dark-jade); margin-bottom: var(--space-md); font-size: 1rem; }

.similar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-sm);
}

.similar-card {
  background: #f9fafb;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid #eee;
}

.similar-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); border-color: var(--gold); }
.similar-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.similar-card h4 { padding: 8px 8px 2px; margin: 0; font-size: 0.8rem; color: var(--dark-jade); }
.similar-card p { padding: 0 8px 8px; margin: 0; font-size: 0.7rem; color: var(--text-muted); }

/* ========================================
   States
   ======================================== */
.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-3xl);
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(201,162,77,0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto var(--space-md);
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-3xl) var(--space-md);
}

.empty-icon { font-size: 3.5rem; margin-bottom: var(--space-md); opacity: 0.6; }
.empty-state h3 { color: var(--dark-jade); margin-bottom: var(--space-xs); }
.empty-state p { color: var(--text-muted); }

.retry-btn {
  margin-top: var(--space-md);
  padding: 10px 24px;
  background: var(--gold);
  color: var(--dark-jade);
  border: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* ========================================
   Notification
   ======================================== */
.notification-container {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.notification {
  background: white;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
  border-right: 4px solid;
  cursor: pointer;
}

.notification.success { border-color: var(--royal-jade); }
.notification.error { border-color: #dc2626; }
.notification.info { border-color: var(--gold); }

.notification-icon { font-size: 1.3rem; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 991px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-md); }
}

@media (max-width: 767px) {
  .product-page { padding: var(--space-md) var(--space-sm); }
  .filter-row { flex-direction: column; }
  .filter-group { min-width: 100%; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .product-card__body { padding: var(--space-sm); }
  .product-card__title { font-size: 0.9rem; }
  .product-card__specs { grid-template-columns: 1fr; }
  .product-card__footer { padding: var(--space-sm); flex-wrap: wrap; gap: var(--space-xs); }
  .product-card__btn { width: 100%; text-align: center; }
  .pagination { padding: var(--space-xs) var(--space-md); gap: var(--space-sm); }
  .page-btn { padding: 8px 16px; font-size: 0.8rem; }
  .modal-container { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; }
  .product-detail { grid-template-columns: 1fr; gap: var(--space-md); }
  .detail-title { font-size: 1.2rem; }
  .modal-body { padding: var(--space-md); }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .product-card__badges { top: 6px; left: 6px; right: 6px; }
  .badge { padding: 3px 8px; font-size: 0.65rem; }
  .detail-actions { flex-direction: column; }
  .favorite-btn { width: 100%; height: 44px; }
  .similar-grid { grid-template-columns: repeat(2, 1fr); }
  .notification-container { left: 10px; right: 10px; max-width: none; }
}

/* ── Size Selector ── */
.detail-sizes {
    margin: var(--space-md) 0;
    padding: var(--space-md);
    background: #f9fafb;
    border-radius: var(--radius-md);
    border: 1px solid rgba(201,162,77,0.15);
}

.detail-sizes__title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dark-jade);
    margin-bottom: var(--space-sm);
}

.detail-sizes__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: var(--space-xs);
}

.size-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 10px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    text-align: center;
}

.size-btn:hover:not(:disabled):not(.size-btn--disabled) {
    border-color: var(--gold);
    background: rgba(201,162,77,0.04);
}

.size-btn--active {
    border-color: var(--gold) !important;
    background: rgba(201,162,77,0.1) !important;
    box-shadow: 0 0 0 3px rgba(201,162,77,0.12);
}

.size-btn--disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f5f5f5;
}

.size-btn__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark-jade);
}

.size-btn__weight {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dark);
}

.size-btn__price {
    font-size: 0.75rem;
    color: var(--royal-jade);
    font-weight: 600;
}

.size-btn__nostock {
    font-size: 0.7rem;
    color: #ef4444;
    font-weight: 500;
}

.size-btn__stock {
    font-size: 0.7rem;
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .detail-sizes__grid {
        grid-template-columns: 1fr 1fr;
    }
}
/* ── لینک صفحه کامل ── */
.detail-full-link {
    display: block;
    text-align: center;
    padding: var(--space-sm);
    color: var(--gold);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border-top: 1px solid rgba(201,162,77,0.1);
    margin-top: var(--space-sm);
    transition: all 0.3s ease;
}

.detail-full-link:hover {
    color: var(--dark-gold);
    background: rgba(201,162,77,0.04);
}