/* ========================================
   Mini Cart Drawer - Estilo Quincho BBQ
   ======================================== */

:root {
  --quincho-orange: #ea580c;
  --quincho-orange-dark: #c2410c;
  --quincho-black: #1a1a1a;
  --quincho-gray: #6b7280;
  --quincho-gray-light: #f3f4f6;
  --drawer-width: 400px;
  --transition-speed: 300ms;
}

/* Prevenir scroll cuando el drawer está abierto */
body.drawer-open {
  overflow: hidden;
}

/* ========================================
   Botón Trigger del Carrito
   ======================================== */
.mini-cart-trigger {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--quincho-orange);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
  transition: all var(--transition-speed) ease;
  z-index: 999;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
}

.mini-cart-trigger:hover {
  background: var(--quincho-orange-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.4);
}

.mini-cart-trigger svg {
  flex-shrink: 0;
}

.mini-cart-trigger .cart-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.mini-cart-trigger .cart-total-display {
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .mini-cart-trigger {
    padding: 10px 14px;
  }

  .mini-cart-trigger .cart-total-display {
    display: none;
  }
}

/* ========================================
   Overlay
   ======================================== */
.mini-cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-speed) ease;
  z-index: 1000;
}

.mini-cart-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   Drawer Principal
   ======================================== */
.mini-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: var(--drawer-width);
  height: 100vh;
  background: white;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1001;
  display: flex;
  flex-direction: column;
}

.mini-cart-drawer.is-open {
  transform: translateX(0);
}

.mini-cart-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ========================================
   Header del Drawer
   ======================================== */
.mini-cart-header {
  background: var(--quincho-orange);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.mini-cart-header .header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-cart-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.close-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* ========================================
   Lista de Items del Carrito
   ======================================== */
.mini-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Scrollbar personalizado */
.mini-cart-items::-webkit-scrollbar {
  width: 8px;
}

.mini-cart-items::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.mini-cart-items::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.mini-cart-items::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Carrito vacío */
.empty-cart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--quincho-gray);
  text-align: center;
  padding: 40px 20px;
}

.empty-cart svg {
  opacity: 0.3;
  margin-bottom: 16px;
}

.empty-cart p {
  font-size: 18px;
  margin: 0;
}

/* Items del carrito */
#cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--quincho-gray-light);
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.cart-item.updating {
  opacity: 0.6;
  pointer-events: none;
}

.cart-item.removing {
  opacity: 0;
  transform: translateX(20px);
}

.cart-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.item-image {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
}

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

.item-details {
  flex: 1;
  min-width: 0;
}

.item-name {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--quincho-black);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-price {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--quincho-orange);
}

/* Controles de cantidad */
.quantity-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn,
.remove-item {
  background: #e5e7eb;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.qty-btn:hover {
  background: #d1d5db;
}

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

.qty-display {
  width: 32px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

.remove-item {
  margin-left: auto;
  color: #ef4444;
}

.remove-item:hover {
  background: #fee2e2;
}

/* ========================================
   Footer del Drawer
   ======================================== */
.mini-cart-footer {
  border-top: 1px solid #e5e7eb;
  padding: 20px;
  background: white;
  flex-shrink: 0;
}

.subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.subtotal-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--quincho-gray);
}

.subtotal-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--quincho-black);
}

.shipping-notice {
  font-size: 12px;
  color: var(--quincho-gray);
  text-align: center;
  margin: 0 0 16px 0;
}

/* Botones de acción */
.cart-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.btn-primary {
  background: var(--quincho-orange);
  color: white;
}

.btn-primary:hover {
  background: var(--quincho-orange-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

.btn-secondary {
  background: var(--quincho-gray-light);
  color: var(--quincho-black);
}

.btn-secondary:hover {
  background: #e5e7eb;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 640px) {
  .mini-cart-drawer {
    max-width: 100%;
  }

  .mini-cart-header {
    padding: 16px;
  }

  .mini-cart-items {
    padding: 16px;
  }

  .mini-cart-footer {
    padding: 16px;
  }

  .cart-item {
    padding: 12px;
  }

  .item-image {
    width: 70px;
    height: 70px;
  }
}

/* ========================================
   Animaciones
   ======================================== */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Animación de carga */
.cart-item.updating::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ========================================
   Estados de Loading y Error
   ======================================== */

/* Overlay de loading */
.mini-cart-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 8px;
}

/* Spinner */
.mini-cart-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: var(--quincho-orange);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Mensaje de error */
.mini-cart-error {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading en items del carrito */
.cart-item.loading {
  position: relative;
  overflow: hidden;
}

.cart-item.loading::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
  animation: shimmer 1.5s infinite;
  z-index: 10;
}

/* Skeleton loading para items */
.skeleton-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--quincho-gray-light);
  border-radius: 8px;
}

.skeleton-image {
  width: 80px;
  height: 80px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

.skeleton-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-line.medium {
  width: 80%;
}

.wc-forward {
  display: none !important;
}
