/* ============================================
   Cooperativa La Purisima - E-Commerce Styles
   shop.php, product.php, cart pages
   ============================================ */

/* --- Hero Banner --- */
.shop-hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, #a31b15 100%);
  color: #fff;
  padding: 3.5rem 0 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.shop-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.shop-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  position: relative;
}

.shop-hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

/* --- Breadcrumbs --- */
.shop-breadcrumb {
  background: var(--bg-light);
  padding: 0.75rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #e9ecef;
}

.shop-breadcrumb a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-speed);
}

.shop-breadcrumb a:hover {
  color: #a31b15;
  text-decoration: underline;
}

.shop-breadcrumb .separator {
  color: #adb5bd;
  margin: 0 0.4rem;
}

.shop-breadcrumb .current {
  color: var(--text-color);
  font-weight: 500;
}

/* --- Categories Sidebar --- */
.categories-sidebar .category-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary-color);
}

.categories-sidebar .category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: 8px;
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-speed);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.95rem;
}

.categories-sidebar .category-link:hover,
.categories-sidebar .category-link.active {
  background-color: #fef2f1;
  color: var(--primary-color);
}

.categories-sidebar .category-link .badge {
  background-color: #f1f3f5;
  color: #6c757d;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 0.25rem 0.6rem;
}

.categories-sidebar .category-link:hover .badge,
.categories-sidebar .category-link.active .badge {
  background-color: var(--primary-color);
  color: #fff;
}

.categories-sidebar .sub-products {
  list-style: none;
  padding-left: 1.5rem;
  margin: 0;
}

.categories-sidebar .sub-products li a {
  display: block;
  padding: 0.35rem 0.75rem;
  color: #6c757d;
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 6px;
  transition: all var(--transition-speed);
}

.categories-sidebar .sub-products li a:hover {
  color: var(--primary-color);
  background-color: #fef2f1;
}

/* Mobile off-canvas filter button */
.btn-filter-mobile {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1040;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(220, 36, 28, 0.4);
  transition: all var(--transition-speed);
}

.btn-filter-mobile:hover {
  background: #a31b15;
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 36, 28, 0.5);
}

@media (max-width: 991.98px) {
  .btn-filter-mobile {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }
}

/* --- Product Cards --- */
.product-card {
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  transition: all var(--transition-speed);
  border: 1px solid #f0f0f0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.product-card .card-img-wrapper {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #f8f9fa;
}

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

.product-card:hover .card-img-wrapper img {
  transform: scale(1.05);
}

.product-card .card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card .product-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .product-name a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-speed);
}

.product-card .product-name a:hover {
  color: var(--primary-color);
}

.product-card .product-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.product-card .product-price-label {
  font-size: 0.78rem;
  color: #6c757d;
  margin-bottom: 1rem;
}

.product-card .btn-ver-producto {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: all var(--transition-speed);
  margin-top: auto;
  width: 100%;
  text-align: center;
}

.product-card .btn-ver-producto:hover {
  background: #a31b15;
  color: #fff;
  transform: translateY(-1px);
}

/* --- Mayoreo Badge --- */
.badge-mayoreo {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--primary-color);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(220, 36, 28, 0.3);
}

.badge-mayoreo-sm {
  display: inline-block;
  background: #fef2f1;
  color: var(--primary-color);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  margin-bottom: 0.5rem;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #6c757d;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state p {
  font-size: 1.1rem;
}

/* --- Product Detail Page --- */
.product-detail-section {
  padding: 2rem 0 3rem;
}

.product-img-main {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  background: #f8f9fa;
}

.product-img-main img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.product-info-card {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
  height: 100%;
}

.product-info-card .product-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.product-info-card .product-category {
  font-size: 0.9rem;
  color: #6c757d;
  margin-bottom: 1.25rem;
}

.product-info-card .product-category a {
  color: var(--primary-color);
  text-decoration: none;
}

.product-info-card .product-description {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* Stock status */
.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  margin-bottom: 1.25rem;
}

.stock-badge.in-stock {
  background: #e6f4ea;
  color: var(--success-color);
}

.stock-badge.low-stock {
  background: #fff8e1;
  color: #e67e00;
}

.stock-badge.out-of-stock {
  background: #fef2f1;
  color: var(--primary-color);
}

/* --- Box Size Selector --- */
.box-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.box-option {
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-speed);
  background: #fff;
  position: relative;
}

.box-option:hover {
  border-color: #fca5a1;
  background: #fffafa;
}

.box-option.active {
  border-color: var(--primary-color);
  background: #fef2f1;
  box-shadow: 0 0 0 1px var(--primary-color);
}

.box-option .box-icon {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.box-option .box-label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

.box-option .box-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
}

.box-option .box-unit-price {
  font-size: 0.75rem;
  color: #6c757d;
  display: block;
  margin-top: 0.15rem;
}

.box-option .check-icon {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.box-option.active .check-icon {
  display: flex;
}

/* --- Quantity Selector --- */
.qty-selector {
  display: inline-flex;
  align-items: center;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.qty-selector .qty-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  cursor: pointer;
  transition: all var(--transition-speed);
}

.qty-selector .qty-btn:hover {
  background: #e9ecef;
  color: var(--primary-color);
}

.qty-selector .qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qty-selector .qty-value {
  width: 60px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  border-left: 2px solid #e9ecef;
  border-right: 2px solid #e9ecef;
  background: #fff;
}

/* --- Price Summary --- */
.price-summary {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.price-summary .price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.95rem;
  color: #555;
}

.price-summary .price-row.total {
  border-top: 2px solid #dee2e6;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-color);
}

.price-summary .price-row.total .price-value {
  color: var(--primary-color);
  font-size: 1.3rem;
}

/* --- Add to Cart Button --- */
.btn-add-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  background: var(--success-color);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.btn-add-cart:hover {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.35);
}

.btn-add-cart:disabled {
  background: #adb5bd;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-add-cart i {
  font-size: 1.15rem;
}

/* --- Toast Notification --- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast-notification {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  min-width: 300px;
  max-width: 420px;
  animation: toastSlideIn 0.4s ease-out;
  border-left: 4px solid var(--success-color);
}

.toast-notification.toast-error {
  border-left-color: var(--primary-color);
}

.toast-notification .toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.toast-notification .toast-icon.success {
  background: #e6f4ea;
  color: var(--success-color);
}

.toast-notification .toast-icon.error {
  background: #fef2f1;
  color: var(--primary-color);
}

.toast-notification .toast-body {
  flex-grow: 1;
}

.toast-notification .toast-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-color);
  margin-bottom: 0.1rem;
}

.toast-notification .toast-message {
  font-size: 0.82rem;
  color: #6c757d;
}

.toast-notification .toast-close {
  background: none;
  border: none;
  color: #adb5bd;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.toast-notification .toast-close:hover {
  color: var(--text-color);
}

.toast-notification.toast-out {
  animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* --- Shipping Info --- */
.shipping-info {
  background: #e8f5e9;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: #2e7d32;
}

.shipping-info i {
  font-size: 1.2rem;
}

/* --- Cart Styles --- */
.cart-table {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

.cart-table th {
  background: var(--bg-light);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
  padding: 1rem;
  border: none;
}

.cart-table td {
  padding: 1rem;
  vertical-align: middle;
  border-color: #f0f0f0;
}

.cart-item-img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
}

.cart-item-name {
  font-weight: 600;
  color: var(--text-color);
}

.cart-item-box-type {
  font-size: 0.82rem;
  color: #6c757d;
}

.btn-remove-item {
  background: none;
  border: none;
  color: #adb5bd;
  font-size: 1.1rem;
  cursor: pointer;
  transition: color var(--transition-speed);
  padding: 0.25rem;
}

.btn-remove-item:hover {
  color: var(--primary-color);
}

/* --- Cart Summary --- */
.cart-summary {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
  position: sticky;
  top: 2rem;
}

.cart-summary h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #f0f0f0;
}

.cart-summary .summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

.cart-summary .summary-row.total {
  border-top: 2px solid var(--text-color);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.btn-checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: var(--success-color);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-speed);
  margin-top: 1.25rem;
}

.btn-checkout:hover {
  background: #218838;
  color: #fff;
}

/* --- Checkout Step Indicator --- */
.checkout-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin-bottom: 2.5rem;
  padding: 0;
  list-style: none;
}

.checkout-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  position: relative;
}

.checkout-step .step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: #e9ecef;
  color: #6c757d;
  flex-shrink: 0;
  transition: all var(--transition-speed);
}

.checkout-step .step-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: #6c757d;
  transition: color var(--transition-speed);
}

.checkout-step.active .step-number {
  background: var(--primary-color);
  color: #fff;
}

.checkout-step.active .step-label {
  color: var(--text-color);
  font-weight: 700;
}

.checkout-step.completed .step-number {
  background: var(--success-color);
  color: #fff;
}

.checkout-step-divider {
  width: 40px;
  height: 2px;
  background: #e9ecef;
  flex-shrink: 0;
}

.checkout-step-divider.completed {
  background: var(--success-color);
}

/* --- Shipping Option Cards --- */
.shipping-options {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.shipping-option {
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fff;
}

.shipping-option:hover {
  border-color: #fca5a1;
}

.shipping-option.active {
  border-color: var(--primary-color);
  background: #fef2f1;
}

.shipping-option .shipping-radio {
  width: 20px;
  height: 20px;
  border: 2px solid #ced4da;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: all var(--transition-speed);
}

.shipping-option.active .shipping-radio {
  border-color: var(--primary-color);
}

.shipping-option.active .shipping-radio::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-color);
}

.shipping-option .shipping-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--primary-color);
  flex-shrink: 0;
}

.shipping-option .shipping-details {
  flex-grow: 1;
}

.shipping-option .shipping-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-color);
}

.shipping-option .shipping-time {
  font-size: 0.82rem;
  color: #6c757d;
}

.shipping-option .shipping-cost {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-color);
  flex-shrink: 0;
}

/* --- Loading Skeleton --- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* --- No Products --- */
.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
}

.no-products i {
  font-size: 3.5rem;
  color: #dee2e6;
  margin-bottom: 1rem;
}

.no-products h3 {
  font-weight: 600;
  color: #6c757d;
  margin-bottom: 0.5rem;
}

.no-products p {
  color: #adb5bd;
}

/* --- Responsive --- */
@media (max-width: 575.98px) {
  .shop-hero h1 {
    font-size: 1.75rem;
  }

  .shop-hero p {
    font-size: 0.95rem;
  }

  .product-card .card-body {
    padding: 1rem;
  }

  .product-info-card {
    padding: 1.5rem;
  }

  .product-info-card .product-title {
    font-size: 1.4rem;
  }

  .box-selector {
    grid-template-columns: 1fr;
  }

  .toast-notification {
    min-width: unset;
    max-width: calc(100vw - 3rem);
  }

  .toast-container {
    right: 1rem;
    left: 1rem;
  }

  .checkout-step .step-label {
    display: none;
  }

  .checkout-step-divider {
    width: 24px;
  }

  .shipping-option {
    flex-wrap: wrap;
  }
}

@media (min-width: 576px) and (max-width: 767.98px) {
  .shop-hero h1 {
    font-size: 2rem;
  }
}

@media (max-width: 991.98px) {
  .product-detail-section .row > .col-lg-5 {
    margin-bottom: 1.5rem;
  }
}
