/* ========================================================================
 * XTRAVEL CARRITO - Estilos CSS
 * ========================================================================
 * Estilos personalizados que complementan las clases de Tailwind
 * ======================================================================== */

/* ========== VARIABLES CSS ========== */
:root {
  --xt-gray-50: #f8fafc;
  --xt-gray-100: #f1f5f9;
  --xt-gray-200: #e2e8f0;
  --xt-gray-300: #cbd5e1;
  --xt-gray-400: #94a3b8;
  --xt-gray-500: #64748b;
  --xt-gray-600: #475569;
  --xt-gray-700: #334155;
  --xt-gray-900: #0f172a;
  --xt-white: #ffffff;
  --xt-primary: #4f46e5;
  --xt-primary-hover: #4338ca;
}

/* ========== UTILIDADES GLOBALES ========== */
.hidden {
  display: none !important;
}

.xt-transition {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Focus visible para accesibilidad */
.xt-ring-focus:focus-visible {
  outline: 2px solid var(--xt-primary);
  outline-offset: 2px;
}

/* Scrollbar personalizado */
.xt-scrollbar::-webkit-scrollbar {
  width: 8px;
}

.xt-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.xt-scrollbar::-webkit-scrollbar-thumb {
  background: var(--xt-gray-200);
  border-radius: 6px;
}

.xt-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--xt-gray-300);
}

/* ========== OVERLAY ========== */
#xtCartOverlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#xtCartOverlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

/* ========== DRAWER ========== */
#xtCartDrawer {
  position: fixed;
  top: var(--site-header-height, 70px);
  right: 0;
  bottom: 0;
  z-index: 101;
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  background: #f0f7ff;
  border-left: 1px solid var(--xt-gray-200);
  box-shadow: 0 10px 30px -12px rgba(2, 6, 23, 0.25);
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

#xtCartDrawer[aria-hidden="false"] {
  transform: translateX(0);
}

/* ========== HEADER DEL DRAWER ========== */
#xtCartDrawer header {
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--xt-gray-200);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

#xtCartDrawer header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--xt-gray-900);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

#xtCartDrawer header p {
  font-size: 0.625rem;
  color: var(--xt-gray-500);
  margin: 0.1875rem 0 0 0;
}

#xtCartDrawer header .xt-icon-badge {
  display: inline-flex;
  width: 1.5rem;
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--xt-primary);
}

#xtCartDrawer header .xt-icon-badge i {
  font-size: 0.875rem;
}

#xtCartDrawer header button {
  padding: 0.5rem;
  border-radius: 6px;
  background: #dc2626;
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

#xtCartDrawer header button:hover {
  background: #b91c1c;
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
  transform: scale(1.05);
}

#xtCartDrawer header i {
  font-size: 20px;
}

/* ========== CONTENIDO SCROLLEABLE ========== */
.xt-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

/* ========== ESTADO VACÍO ========== */
#xt-empty {
  text-align: center;
  padding: 2.5rem 0.75rem;
}

#xt-empty .xt-empty-icon {
  margin: 0 auto;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--xt-gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--xt-gray-300);
}

#xt-empty .xt-empty-icon i {
  font-size: 1.5rem;
}

#xt-empty .xt-empty-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--xt-gray-700);
  margin-top: 0.75rem;
  margin-bottom: 0.375rem;
}

#xt-empty .xt-empty-subtitle {
  font-size: 0.625rem;
  color: var(--xt-gray-500);
}

/* ========== LISTA DE ITEMS ========== */
#xt-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Item del carrito */
.xt-cart-item {
  display: flex;
  padding: 0.375rem 0.25rem;
  margin-bottom: 0.1875rem;
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.xt-cart-item:hover {
  background: var(--xt-gray-50);
}

/* Imagen del item - MICRO */
.xt-item-image {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 0.1875rem;
  border: 1px solid var(--xt-gray-200);
  background: var(--xt-gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
}

.xt-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xt-item-img-placeholder {
  font-size: 0.875rem;
  color: var(--xt-gray-300);
}

/* Contenido del item */
.xt-item-content {
  margin-left: 0.375rem;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* Header (título + precio) */
.xt-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.25rem;
  margin-bottom: 0;
}

.xt-item-title {
  flex: 1;
  min-width: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--xt-gray-900);
  margin: 0;
  line-height: 1.2;
}

.xt-item-title a {
  color: inherit;
  text-decoration: none;
  display: block;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.xt-item-title a:hover {
  text-decoration: underline;
}

.xt-item-price {
  flex-shrink: 0;
  margin-left: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--xt-gray-900);
  white-space: nowrap;
}

/* Información del servicio */
.xt-item-service {
  font-size: 0.5625rem;
  font-weight: 500;
  color: var(--xt-gray-600);
  margin: 0;
  line-height: 1.2;
}

.xt-item-service i {
  color: var(--xt-primary);
  font-size: 0.625rem;
}

/* Categorías */
.xt-item-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem;
  margin: 0.0625rem 0;
}

.xt-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.0625rem;
  padding: 0.03125rem 0.1875rem;
  border-radius: 9999px;
  background: var(--xt-gray-100);
  border: 1px solid var(--xt-gray-200);
  font-size: 0.5625rem;
  font-weight: 500;
  color: var(--xt-gray-600);
}

.xt-category-badge i {
  color: var(--xt-gray-400);
  font-size: 0.5625rem;
}

/* Acciones (qty controls + cálculo + eliminar) */
.xt-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.1875rem;
  font-size: 0.5625rem;
}

/* Controles de cantidad */
.xt-qty-controls {
  display: flex;
  align-items: center;
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--xt-gray-300);
  background: var(--xt-white);
  height: 1.375rem;
}

.xt-qty-controls button {
  padding: 0 0.3125rem;
  background: transparent;
  border: none;
  color: var(--xt-gray-700);
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 0.75rem;
  font-weight: 600;
  height: 100%;
}

.xt-qty-controls button:hover:not(:disabled) {
  background: var(--xt-gray-100);
}

.xt-qty-controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.xt-qty-value {
  padding: 0 0.3125rem;
  font-weight: 600;
  color: var(--xt-gray-900);
  font-size: 0.625rem;
  min-width: 1.125rem;
  text-align: center;
}

/* Cálculo del precio */
.xt-item-calc {
  font-weight: 500;
  color: var(--xt-gray-500);
  font-size: 0.5625rem;
}

/* Botón eliminar */
.xt-remove {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.0625rem;
  padding: 0.0625rem 0.1875rem;
  border-radius: 3px;
  background: transparent;
  border: 1px solid var(--xt-gray-200);
  color: var(--xt-gray-600);
  font-size: 0.5625rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 1.375rem;
}

.xt-remove:hover {
  background: var(--xt-gray-100);
  border-color: #dc2626;
  color: #dc2626;
}

.xt-remove i {
  font-size: 0.75rem;
}

/* Detalles expandibles */
.xt-item-details {
  margin-top: 0.1875rem;
  border-radius: 3px;
  border: 1px solid var(--xt-gray-200);
  background: var(--xt-gray-50);
  padding: 0.125rem 0.1875rem;
}

.xt-item-details summary {
  cursor: pointer;
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--xt-gray-700);
  padding: 0.0625rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.0625rem;
  transition: color 0.2s ease;
}

.xt-item-details summary:hover {
  color: var(--xt-primary);
}

.xt-item-details summary::-webkit-details-marker {
  display: none;
}

.xt-item-details summary i {
  color: var(--xt-primary);
  font-size: 0.625rem;
}

.xt-item-details[open] summary {
  margin-bottom: 0.1875rem;
}

/* Contenido de los detalles */
.xt-details-content {
  font-size: 0.5rem;
  line-height: 1.2;
  color: var(--xt-gray-600);
}

.xt-details-summary {
  margin-bottom: 0.3125rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.xt-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.125rem;
  margin-bottom: 0.3125rem;
}

.xt-detail-card {
  padding: 0.125rem 0.1875rem;
  border-radius: 3px;
  background: var(--xt-white);
  border: 1px solid var(--xt-gray-200);
  text-align: center;
}

.xt-detail-value {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--xt-gray-800);
  margin: 0 0 0.0625rem 0;
}

.xt-detail-label {
  font-size: 0.5rem;
  color: var(--xt-gray-500);
  margin: 0;
}

.xt-details-link {
  display: inline-flex;
  align-items: center;
  gap: 0.0625rem;
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--xt-primary);
  text-decoration: none;
}

.xt-details-link:hover {
  text-decoration: underline;
}

.xt-details-link i {
  font-size: 0.625rem;
}

/* ========== FOOTER DEL CARRITO ========== */
#xt-footer {
  padding: 0.875rem 1rem;
  background: #f8fafc;
  border-top: 1px solid var(--xt-gray-200);
}

#xt-footer .xt-subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
}

#xt-footer .xt-subtotal-label {
  font-weight: 600;
  color: var(--xt-gray-900);
  font-size: 0.875rem;
}

#xt-footer #xt-subtotal {
  font-weight: 700;
  color: var(--xt-primary);
  font-size: 1.125rem;
}

#xt-footer .xt-subtotal-note {
  font-size: 0.625rem;
  color: var(--xt-gray-500);
  margin-bottom: 0.875rem;
}

.xt-checkout-wrapper {
  margin-top: 0.875rem;
}

/* ========== BOTÓN DE CHECKOUT ========== */
#xt-checkout-btn {
  width: 100%;
  padding: 0.625rem 1rem;
  border-radius: 8px;
  background: var(--xt-primary);
  color: white;
  font-weight: 600;
  font-size: 0.8125rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  transition: background-color 0.2s ease;
}

#xt-checkout-btn:hover {
  background: var(--xt-primary-hover);
}

#xt-checkout-btn i {
  font-size: 0.9375rem;
}

.xt-continue {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.6875rem;
  color: var(--xt-gray-500);
}

.xt-continue button {
  background: none;
  border: none;
  font-weight: 500;
  font-size: 0.6875rem;
  color: var(--xt-primary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.xt-continue button:hover {
  color: var(--xt-primary-hover);
}

/* ========== MENSAJES ========== */
#xt-messages {
  padding: 0 1.5rem 1rem;
}

#xt-messages > div {
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  animation: xtFadeSlide 0.5s ease;
  box-shadow: 0 4px 18px -4px rgba(0, 0, 0, 0.18);
}

@keyframes xtFadeSlide {
  0% {
    transform: translateY(-6px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========== TOAST NOTIFICATIONS ========== */
#xt-toast {
  position: fixed;
  right: 1rem;
  top: calc(var(--site-header-height, 70px) + 12px);
  z-index: 105;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

#xt-toast .xt-toast-card {
  pointer-events: auto;
  padding: 0.875rem 1rem;
  border-radius: 10px;
  background: #fff;
  color: var(--xt-gray-900);
  border: 1px solid var(--xt-gray-200);
  border-left-width: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#xt-toast .xt-toast-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

#xt-toast .xt-ok {
  border-left-color: #16a34a;
}

#xt-toast .xt-warn {
  border-left-color: #f59e0b;
}

#xt-toast .xt-err {
  border-left-color: #dc2626;
}

#xt-toast .xt-info {
  border-left-color: #3b82f6;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
  #xtCartDrawer {
    max-width: 22rem;
  }
  
  /* Hacer items MICRO en móvil */
  .xt-cart-item {
    padding: 0.25rem 0.1875rem;
    margin-bottom: 0.125rem;
  }
  
  .xt-item-image {
    width: 2rem;
    height: 2rem;
  }
  
  .xt-item-content {
    margin-left: 0.3125rem;
    gap: 0.0625rem;
  }
  
  .xt-item-title {
    font-size: 0.625rem;
    line-height: 1.15;
  }
  
  .xt-item-price {
    font-size: 0.6875rem;
  }
  
  .xt-item-service {
    font-size: 0.5rem;
  }
  
  .xt-category-badge {
    font-size: 0.5rem;
    padding: 0.03125rem 0.125rem;
  }
  
  .xt-item-actions {
    gap: 0.1875rem;
    margin-top: 0.125rem;
  }
  
  .xt-qty-controls {
    height: 1.25rem;
  }
  
  .xt-qty-controls button {
    padding: 0 0.1875rem;
    font-size: 0.625rem;
  }
  
  .xt-qty-value {
    padding: 0 0.1875rem;
    font-size: 0.5625rem;
  }
  
  .xt-item-calc {
    font-size: 0.5rem;
  }
  
  .xt-remove {
    padding: 0.0625rem 0.125rem;
    font-size: 0.5rem;
    height: 1.25rem;
  }
  
  .xt-item-details {
    padding: 0.0625rem 0.125rem;
  }
  
  .xt-item-details summary {
    font-size: 0.46875rem;
  }
  
  .xt-details-content {
    font-size: 0.46875rem;
  }
  
  .xt-detail-value {
    font-size: 0.5625rem;
  }
  
  .xt-detail-label {
    font-size: 0.46875rem;
  }
}
