/* CreativeCR - Estilos Principales */
/* Sistema de diseño unificado para todo el sitio */

/* ===== VARIABLES CSS ===== */
:root {
  /* Colores principales CreativeCR */
  --primary-orange: #f5aa5f;
  --secondary-brown: #736a3d;
  --dark-bg: #1a202c;
  --light-bg: #ffffff;
  --text-dark: #2d3748;
  --text-light: #f7fafc;
  
  /* Gradientes */
  --gradient-primary: linear-gradient(135deg, #f5aa5f 0%, #736a3d 100%);
  --gradient-dark: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Transiciones */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;
  
  /* Bordes */
  --border-radius-sm: 0.375rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;
  
  /* Espaciado */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
}

/* ===== RESET Y BASE ===== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Rufina', serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--light-bg);
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ===== MODO OSCURO ===== */
[data-theme="dark"] {
  --light-bg: var(--dark-bg);
  --text-dark: var(--text-light);
}

[data-theme="dark"] body {
  background-color: var(--dark-bg);
  color: var(--text-light);
}

/* ===== TIPOGRAFÍA ===== */
.font-batman {
  font-family: 'Batman Forever', cursive;
}

.font-rufina {
  font-family: 'Rufina', serif;
}

.font-rufina-bold {
  font-family: 'Rufina', serif;
  font-weight: bold;
}

.font-great-vibes {
  font-family: 'Great Vibes', cursive;
}

/* ===== UTILIDADES ===== */
.glow {
  text-shadow: 0 0 10px rgba(245, 170, 95, 0.5);
}

.text-orange {
  color: var(--primary-orange) !important;
}

.bg-gradient-primary {
  background: var(--gradient-primary);
}

.bg-gradient-dark {
  background: var(--gradient-dark);
}

/* ===== COMPONENTES ===== */
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  padding: var(--spacing-md) var(--spacing-xl);
  border: none;
  border-radius: var(--border-radius-lg);
  font-family: 'Rufina', serif;
  font-weight: bold;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius-xl);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .card {
  background: rgba(60, 60, 60, 0.8);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root {
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
  }
}

/* ===== ANIMACIONES ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* ===== LOADING STATES ===== */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary-orange);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Spinner para carga de productos */
.spinner {
  border: 4px solid rgba(245, 170, 95, 0.2);
  border-top: 4px solid var(--primary-orange);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== BLURRY LOADING ===== */
.blurry-loading-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(245, 170, 95, 0.05), rgba(115, 106, 61, 0.05));
}

.blurry-loading-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(245, 170, 95, 0.1), rgba(115, 106, 61, 0.1));
  filter: blur(20px);
  transform: scale(1.1);
  transition: opacity 0.5s ease;
  z-index: 1;
  animation: pulse-blur 2s ease-in-out infinite;
}

@keyframes pulse-blur {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.8;
  }
}

img[data-src] {
  opacity: 0;
  filter: blur(20px);
  transform: scale(1.1);
  transition: opacity 0.5s ease, filter 0.5s ease, transform 0.5s ease;
}

img.loaded {
  opacity: 1 !important;
  filter: none !important;
  transform: scale(1) !important;
}

/* Optimización de imágenes */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Skeleton loading para contenido */
.skeleton {
  background: linear-gradient(90deg, 
    rgba(245, 170, 95, 0.1) 25%, 
    rgba(245, 170, 95, 0.2) 50%, 
    rgba(245, 170, 95, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--border-radius-md);
}

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

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-title {
  height: 2em;
  margin-bottom: 1em;
}

.skeleton-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--border-radius-lg);
}

/* Tarjetas de productos */
.producto-card {
  transition: all 0.3s ease;
}

.producto-card:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Line clamp para texto truncado */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Botones de filtro */
.filtro-btn {
  transition: all 0.3s ease;
}

.filtro-btn.active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 170, 95, 0.3);
}

.filtro-btn:hover {
  transform: translateY(-1px);
}

/* ===== ACCESIBILIDAD ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip navigation - Accesibilidad mejorada */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-orange);
  color: white;
  padding: 1rem 2rem;
  text-decoration: none;
  font-weight: bold;
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 9999;
  transition: top var(--transition-fast);
}

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

/* Focus states mejorados y más visibles */
*:focus-visible {
  outline: 3px solid var(--primary-orange);
  outline-offset: 3px;
  border-radius: var(--border-radius-sm);
}

/* Focus para botones y enlaces */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--primary-orange);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(245, 170, 95, 0.2);
  position: relative;
  z-index: 10;
}

/* Focus para inputs */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--primary-orange);
  outline-offset: 2px;
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 4px rgba(245, 170, 95, 0.15);
}

/* Focus para cards interactivas */
.card:focus-within {
  outline: 2px solid var(--primary-orange);
  outline-offset: 4px;
}

/* Estados de hover más accesibles */
a:hover:not(:focus-visible) {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* Contraste mejorado para modo claro */
body.light {
  color: #1a202c; /* Texto más oscuro */
}

body.light p,
body.light span:not(.material-symbols-outlined):not(.text-orange),
body.light li,
body.light div:not(.text-orange):not(.font-batman) {
  color: #1a202c; /* Mejora contraste WCAG AAA */
}

body.light .text-gray-600 {
  color: #4a5568 !important; /* Contraste mejorado */
}

body.light .text-gray-700 {
  color: #2d3748 !important; /* Contraste mejorado */
}

body.light .text-gray-800 {
  color: #1a202c !important; /* Contraste máximo */
}

/* Contraste para enlaces en modo claro */
body.light a:not(.btn):not(.text-orange) {
  color: #2563eb; /* Azul con mejor contraste */
  font-weight: 500;
}

body.light a:not(.btn):not(.text-orange):hover {
  color: #1e40af;
}

/* Mejora de legibilidad en fondos claros */
body.light .bg-white {
  color: #1a202c !important;
}

body.light .bg-white * {
  color: inherit;
}

/* Indicadores visuales para usuarios de teclado */
.keyboard-navigation *:focus-visible {
  animation: pulse-focus 0.6s ease-in-out;
}

@keyframes pulse-focus {
  0%, 100% {
    outline-width: 3px;
  }
  50% {
    outline-width: 5px;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc;
  }
}
