/**
 * Superprecio Visual Improvements
 * Mejoras visuales aplicadas directamente sobre clases existentes
 */

/* =================================
   NAVBAR OPTIMIZATION
   ================================= */

/* Reducir altura del navbar de 95px a 64px en mobile */
.navbar.fixed-top {
  min-height: 64px !important;
  padding: 0.5rem 1rem !important;
}

.navbar .container-fluid,
.sp-navbar__container {
  padding: 0 !important;
}

.sp-navbar__main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

/* Logo más compacto */
.navbar .navbar-brand img,
.sp-navbar__logo img {
  height: 40px !important;
  width: auto;
}

/* Search input más prominente */
.sp-navbar__search {
  flex: 1;
  max-width: 600px;
}

.sp-navbar__search-input,
.navbar input[type="search"],
.navbar input[name="search"] {
  height: 44px !important;
  padding: 0.5rem 1rem !important;
  font-size: 1rem !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  width: 100% !important;
}

.sp-navbar__search-input:focus,
.navbar input[type="search"]:focus,
.navbar input[name="search"]:focus {
  border-color: white !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2) !important;
  background: white !important;
  outline: none !important;
}

/* Botones con mejor touch target (44x44px mínimo) */
.sp-navbar__button,
.navbar .btn,
.navbar button {
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0.5rem !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(255, 255, 255, 0.2) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  color: white !important;
  transition: all 0.2s ease !important;
}

.sp-navbar__button:hover,
.navbar .btn:hover,
.navbar button:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  border-color: white !important;
  transform: translateY(-2px) !important;
}

.sp-navbar__button:active,
.navbar .btn:active,
.navbar button:active {
  transform: translateY(0) !important;
}

/* Botón de escanear - corregir transparencia */
.navbar button[aria-label*="Escanear"],
.sp-navbar__scan-button {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #136213 !important;
  border-color: white !important;
}

.navbar button[aria-label*="Escanear"]:hover,
.sp-navbar__scan-button:hover {
  background: white !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Iconos en botones */
.navbar button i,
.sp-navbar__button i {
  font-size: 1.25rem !important;
}

/* Cart badge más visible */
.sp-navbar__cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 2px 6px;
  background: #dc3545 !important;
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive */
@media (min-width: 768px) {
  .navbar.fixed-top {
    min-height: 72px !important;
    padding: 0.75rem 1rem !important;
  }

  .navbar .navbar-brand img,
  .sp-navbar__logo img {
    height: 48px !important;
  }
}

/* =================================
   BACKGROUND PATTERN FIX
   ================================= */

/* Ocultar o hacer más sutil el patrón de fondo */
body {
  background-image: none !important;
  background-color: #f8f9fa !important;
}

/* Si existe un contenedor con background */
[style*="background3.webp"] {
  opacity: 0.03 !important;
}

/* =================================
   PRODUCT CARDS (si existen)
   ================================= */

.product-card,
.card.h-100 {
  border-radius: 12px !important;
  overflow: hidden !important;
  transition: all 0.3s ease !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.product-card:hover,
.card.h-100:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12) !important;
}

/* Imágenes de productos */
.product-card img,
.card-img-top {
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  background: white !important;
}

/* =================================
   BUTTONS GLOBAL
   ================================= */

.btn {
  border-radius: 10px !important;
  font-weight: 600 !important;
  padding: 0.5rem 1.25rem !important;
  transition: all 0.2s ease !important;
}

.btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.btn:active {
  transform: translateY(0) !important;
}

.btn-success {
  background: linear-gradient(135deg, #136213 0%, #0a4a0a 100%) !important;
  border: none !important;
}

.btn-success:hover {
  background: linear-gradient(135deg, #157347 0%, #0f4424 100%) !important;
}

/* =================================
   MODAL IMPROVEMENTS
   ================================= */

.modal-content {
  border-radius: 16px !important;
  border: none !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2) !important;
}

.modal-header {
  border-radius: 16px 16px 0 0 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
  border-radius: 0 0 16px 16px !important;
}

/* =================================
   LOADING STATES
   ================================= */

.loading,
.spinner-border {
  animation: spin 1s linear infinite !important;
}

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

/* =================================
   ACCESSIBILITY
   ================================= */

/* Focus visible mejorado */
*:focus-visible {
  outline: 3px solid #136213 !important;
  outline-offset: 2px !important;
  border-radius: 4px !important;
}

/* Skip links */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #136213;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid white;
  outline-offset: 2px;
}

/* =================================
   MOBILE OPTIMIZATIONS
   ================================= */

@media (max-width: 576px) {
  /* Reducir padding en mobile */
  .container,
  .container-fluid {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Cards en grid de 2 columnas */
  .row > [class*="col-"] {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }

  /* Cart page: override to force full width on mobile */
  .sp-cart-page .row > .col-12 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* Textos más pequeños en mobile */
  h1 { font-size: 1.75rem !important; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.25rem !important; }
}

/* =================================
   SAFE AREAS (notched devices)
   ================================= */

@supports (padding: max(0px)) {
  .navbar.fixed-top {
    padding-left: max(1rem, env(safe-area-inset-left)) !important;
    padding-right: max(1rem, env(safe-area-inset-right)) !important;
  }

  body {
    padding-left: env(safe-area-inset-left) !important;
    padding-right: env(safe-area-inset-right) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
}

/* =================================
   ANIMATIONS
   ================================= */

/* Fade in para contenido */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease-out !important;
}

/* =================================
   PRINT STYLES
   ================================= */

@media print {
  .navbar,
  .modal,
  button,
  .btn {
    display: none !important;
  }
}
