/* ===== ESTILOS BASE Y COMPONENTES ===== */

/* ===== CLASES TAILWIND ESENCIALES ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.h-1 { height: 0.25rem; }
.min-h-screen { min-height: 100vh; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.ml-1 { margin-left: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }

.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-500 { background-color: #6b7280; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }

.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }
.border { border-width: 1px; }
.border-2 { border-width: 2px; }

.shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }

.transition { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }

.top-0 { top: 0px; }
.right-0 { right: 0px; }
.bottom-0 { bottom: 0px; }
.left-0 { left: 0px; }

.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Responsive utilities */
@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .md\:block { display: block; }
  .md\:flex { display: flex; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:p-8 { padding: 2rem; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Variables CSS globales */
:root {
  /* Colores de operadores */
  --color-movistar: #00579A;
  --color-vodafone: #E60000;
  --color-orange: #FF7900;
  
  /* Colores del tema claro */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.95);
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: rgba(255, 255, 255, 0.3);
  --shadow-color: rgba(0, 0, 0, 0.1);
  
  /* Espaciado */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Bordes */
  --border-radius: 0.75rem;
  --border-radius-lg: 1rem;
  --border-radius-xl: 1.5rem;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 var(--shadow-color);
  --shadow-md: 0 4px 6px -1px var(--shadow-color);
  --shadow-lg: 0 10px 15px -3px var(--shadow-color);
  --shadow-xl: 0 20px 25px -5px var(--shadow-color);
}

/* Reset y estilos base */
* {
  box-sizing: border-box;
}

.mobile-plans-container {
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
  min-height: 100vh;
}

/* ===== COMPONENTES PRINCIPALES ===== */

/* Loading Spinner */
.loading-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--color-movistar);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

/* Header */
.mobile-plans-header {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-lg) var(--spacing-md);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.mobile-plans-header h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-movistar);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-controls {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.theme-toggle,
.view-toggle {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--color-movistar);
  background: var(--bg-primary);
  color: var(--color-movistar);
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.theme-toggle:hover,
.view-toggle:hover {
  background: var(--color-movistar);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ===== SISTEMA DE FILTROS ===== */
.filter-system {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-xl);
  padding: var(--spacing-xl);
  margin: var(--spacing-xl) var(--spacing-md);
  box-shadow: var(--shadow-lg);
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--color-movistar);
}

.filter-header h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-movistar);
  margin: 0;
}

.btn-reset {
  padding: var(--spacing-sm) var(--spacing-md);
  background: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.btn-reset:hover {
  border-color: var(--color-vodafone);
  color: var(--color-vodafone);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.filter-group label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
}

.operator-filters,
.type-filters {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.operator-filters label,
.type-filters label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 400;
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--border-radius);
  transition: background 0.2s ease;
}

.operator-filters label:hover,
.type-filters label:hover {
  background: var(--bg-secondary);
}

.range-slider {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.range-slider input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-secondary);
  outline: none;
  cursor: pointer;
}

.range-value {
  font-weight: 600;
  color: var(--color-movistar);
  font-size: 0.9rem;
}

.filter-group select {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--bg-secondary);
  border-radius: var(--border-radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--color-movistar);
}

.filter-results {
  text-align: center;
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

.results-count {
  font-weight: 600;
  color: var(--color-movistar);
  font-size: 1.1rem;
}

/* ===== TARJETAS DE PRODUCTOS ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--spacing-xl);
  padding: var(--spacing-xl) var(--spacing-md);
}

.product-card {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  height: fit-content;
}

.product-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: var(--shadow-xl);
}

.product-card.popular::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ffd700, #ffed4e);
  z-index: 1;
}

.product-image-container {
  position: relative;
  width: 150px;
  height: 187px;
  margin: var(--spacing-lg) auto var(--spacing-md);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.1) 100%);
  pointer-events: none;
}

.product-info {
  padding: 0 var(--spacing-xl) var(--spacing-xl);
}

.product-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: var(--spacing-md);
}

.product-price {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.price-amount {
  font-family: 'Montserrat', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  color: var(--color-movistar);
  line-height: 1;
}

.price-suffix {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-left: var(--spacing-xs);
  vertical-align: top;
}

.product-description {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-lg);
  line-height: 1.6;
}

.product-features {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.05));
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.feature-item:last-child {
  margin-bottom: 0;
}

.feature-icon {
  font-size: 1.2rem;
}

.product-actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.btn-compare,
.btn-contract {
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--border-radius);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: block;
  position: relative;
  overflow: hidden;
}

.btn-compare {
  background: var(--bg-primary);
  border: 2px solid var(--color-movistar);
  color: var(--color-movistar);
}

.btn-compare:hover:not(:disabled) {
  background: var(--color-movistar);
  color: white;
  transform: translateY(-2px);
}

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

.btn-contract {
  background: linear-gradient(135deg, var(--color-movistar), #0066cc);
  border: none;
  color: white;
  box-shadow: var(--shadow-md);
}

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

.btn-contract::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  z-index: 0;
}

.btn-contract:hover::before {
  width: 300px;
  height: 300px;
}

.product-badges {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  z-index: 2;
}

.badge {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(10px);
}

.badge-popular {
  background: rgba(255, 215, 0, 0.9);
  color: #8b5a00;
}

.badge-offer {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

/* ===== COMPARADOR ===== */
.comparator-container {
  padding: var(--spacing-xl) var(--spacing-md);
}

.comparator-header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.comparator-header h2 {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-movistar);
  margin-bottom: var(--spacing-md);
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-xl);
  max-width: 1200px;
  margin: 0 auto;
}

.comparison-card {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-xl);
  padding: var(--spacing-xl);
  position: relative;
  box-shadow: var(--shadow-lg);
}

.comparison-remove {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: var(--color-vodafone);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.comparison-remove:hover {
  background: #cc0000;
  transform: scale(1.1);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--spacing-xl);
}

.comparison-table th,
.comparison-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== CALCULADORA ===== */
.calculator-container {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-md);
}

.calculator-form {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-xl);
  padding: var(--spacing-2xl);
  box-shadow: var(--shadow-lg);
}

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: var(--spacing-md);
  border: 2px solid var(--bg-secondary);
  border-radius: var(--border-radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-movistar);
}

.calculator-results {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.05));
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  margin-top: var(--spacing-xl);
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
  border-bottom: none;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-movistar);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .mobile-plans-header {
    flex-direction: column;
    text-align: center;
  }
  
  .mobile-plans-header h1 {
    font-size: 1.5rem;
  }
  
  .filters-grid {
    grid-template-columns: 1fr;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
    padding: var(--spacing-md);
  }
  
  .product-card {
    max-width: 100%;
  }
  
  .price-amount {
    font-size: 2.5rem;
  }
  
  .comparison-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .comparison-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1025px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .comparison-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}