/* ============================
   labandurria.css - Estilos Mejorados
   ============================ */

/* Variables CSS para fácil personalización */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #06b6d4;
  --dark-color: #1e293b;
  --light-bg: #f8fafc;
  --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --card-shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --transition-speed: 0.3s;
  --border-radius: 1rem;
}

/* Estilos generales */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: 100vh;
  color: #1e293b;
  line-height: 1.6;
}

/* Skip to content - Accesibilidad */
.visually-hidden-focusable:focus {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 9999;
  padding: 10px 20px;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
}

/* Encabezado principal */
main header h1 {
  background: linear-gradient(135deg, var(--primary-color), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: -0.02em;
}

main header .lead {
  font-size: 1.125rem;
  color: var(--secondary-color);
  font-weight: 400;
}

/* Tarjetas de productos - Diseño mejorado */
.card-labandurria {
  background: white;
  border: none;
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: var(--card-shadow);
}

.card-labandurria::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), #7c3aed, var(--info-color));
  transform: scaleX(0);
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: left;
}

.card-labandurria:hover {
  transform: translateY(-12px);
  box-shadow: var(--card-shadow-hover);
}

.card-labandurria:hover::before {
  transform: scaleX(1);
}

/* Wrapper de imagen */
.card-img-wrapper {
  position: relative;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 0.75rem;
  padding: 1rem;
  transition: all var(--transition-speed) ease;
}

.card-labandurria:hover .card-img-wrapper {
  background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 100%);
}

.card-img-wrapper img {
  transition: transform var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.card-labandurria:hover .card-img-wrapper img {
  transform: scale(1.1) rotate(2deg);
}

/* Enlaces de imagen */
.card-img-wrapper a {
  display: block;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img-wrapper a:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 4px;
  border-radius: 0.5rem;
}

/* Cuerpo de la tarjeta */
.card-body {
  padding: 1.5rem 1rem 1rem;
}

.card-title {
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
  transition: color var(--transition-speed) ease;
}

.card-labandurria:hover .card-title {
  color: var(--primary-color);
}

.card-text {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #64748b;
}

/* Botones mejorados */
.btn {
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn-outline-success {
  color: var(--success-color);
  border-color: var(--success-color);
}

.btn-outline-success:hover {
  background: var(--success-color);
  color: white;
  border-color: var(--success-color);
}

.btn-outline-dark {
  color: var(--dark-color);
  border-color: var(--dark-color);
}

.btn-outline-dark:hover {
  background: var(--dark-color);
  color: white;
  border-color: var(--dark-color);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(30, 41, 59, 0.3);
}

.btn-outline-secondary {
  color: var(--secondary-color);
  border-color: var(--secondary-color);
}

.btn-outline-secondary:hover {
  background: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
}

.btn-outline-info {
  color: var(--info-color);
  border-color: var(--info-color);
}

.btn-outline-info:hover {
  background: var(--info-color);
  color: white;
  border-color: var(--info-color);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(6, 182, 212, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:focus {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 2px;
}

/* Badge de estado */
.badge {
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge.bg-info {
  background: linear-gradient(135deg, var(--info-color), #0891b2) !important;
}

/* Sección de contacto */
section[aria-labelledby="contact-heading"] {
  background: white;
  padding: 3rem 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

section[aria-labelledby="contact-heading"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), #7c3aed, var(--info-color));
}

#contact-heading {
  color: var(--dark-color);
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.contact-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  position: relative;
  transition: all var(--transition-speed) ease;
  padding-bottom: 2px;
}

.contact-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width var(--transition-speed) ease;
}

.contact-link:hover {
  color: var(--primary-hover);
  transform: translateX(3px);
}

.contact-link:hover::after {
  width: 100%;
}

/* Animaciones */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-labandurria {
  animation: fadeInUp 0.6s ease-out backwards;
}

.card-labandurria:nth-child(1) { animation-delay: 0.1s; }
.card-labandurria:nth-child(2) { animation-delay: 0.2s; }
.card-labandurria:nth-child(3) { animation-delay: 0.3s; }
.card-labandurria:nth-child(4) { animation-delay: 0.4s; }
.card-labandurria:nth-child(5) { animation-delay: 0.5s; }

/* Responsive mejoras */
@media (max-width: 768px) {
  main header h1 {
    font-size: 2rem;
  }
  
  .card-labandurria {
    margin-bottom: 1rem;
  }
  
  section[aria-labelledby="contact-heading"] {
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 576px) {
  .card-body {
    padding: 1rem 0.75rem 0.75rem;
  }
  
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================
   NUEVAS CARACTERÍSTICAS UX
   ============================ */

/* Page Loader */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Category Badge */
.category-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 0.35rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dark-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 10;
  transition: all var(--transition-speed) ease;
}

.card-labandurria:hover .category-badge {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Filter Buttons */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.filter-btn {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  transition: all var(--transition-speed) ease;
  border: 2px solid #e2e8f0;
  background: white;
  color: var(--secondary-color);
}

.filter-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

.filter-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

/* Contact Card Mejorada */
.contact-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.contact-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), #7c3aed, var(--info-color));
}

.contact-method {
  padding: 1.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  transition: all var(--transition-speed) ease;
}

.contact-method:hover {
  background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 100%);
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.contact-icon {
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
}

.contact-method h3 {
  color: var(--dark-color);
  font-weight: 700;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--transition-speed) ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

/* Fade In Animation */
.fade-in {
  animation: fadeInUp 0.8s ease-out;
}

/* External Link Icon */
.btn svg {
  vertical-align: middle;
  transition: transform var(--transition-speed) ease;
}

.btn:hover svg {
  transform: translateX(2px) translateY(-2px);
}

/* No Results Message */
#no-results {
  animation: fadeInUp 0.5s ease-out;
}

/* Product Item Transitions */
.product-item {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive Improvements */
@media (max-width: 992px) {
  .back-to-top {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 45px;
    height: 45px;
  }
  
  .contact-method {
    margin-bottom: 1rem;
  }
}

@media (max-width: 768px) {
  .category-filters {
    gap: 0.4rem;
  }
  
  .filter-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
  
  .contact-icon {
    width: 50px;
    height: 50px;
  }
  
  .contact-icon svg {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 576px) {
  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
  
  .category-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
  }
  
  .contact-card {
    padding: 1.5rem 1rem !important;
  }
}

/* Loading State for Images */
img[loading] {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

/* Hover States Mejorados */
.contact-link {
  display: inline-block;
  position: relative;
}

.contact-link::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), #7c3aed);
  transition: width var(--transition-speed) ease;
}

.contact-link:hover::before {
  width: 100%;
}

/* Performance Optimization */
.card-labandurria,
.btn,
.contact-method {
  will-change: transform;
}

/* Print Styles */
@media print {
  .back-to-top,
  .page-loader,
  .category-filters {
    display: none !important;
  }
  
  .card-labandurria {
    page-break-inside: avoid;
  }
}

/* Modo oscuro (opcional) */
@media (prefers-color-scheme: dark) {
  :root {
    --dark-color: #e2e8f0;
    --light-bg: #1e293b;
  }
  
  body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
  }
  
  .card-labandurria {
    background: #1e293b;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  }
  
  .card-img-wrapper {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
  }
  
  .card-title {
    color: #e2e8f0;
  }
  
  .card-text {
    color: #94a3b8;
  }
  
  section[aria-labelledby="contact-heading"] {
    background: #1e293b;
  }
  
  main header .lead {
    color: #94a3b8;
  }
}

/* Efectos de loading para imágenes */
.card-img-wrapper img {
  opacity: 0;
  animation: fadeIn 0.5s ease-in forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Focus visible mejorado */
*:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Mejora de selección de texto */
::selection {
  background-color: var(--primary-color);
  color: white;
}

::-moz-selection {
  background-color: var(--primary-color);
  color: white;
}