/* ==========================================================================
   MANTENIMIENTO PAGE - ESTILO APPLE ULTRA PREMIUM
   Optimizado para 360x640px y todos los dispositivos móviles
   ========================================================================== */

/* ==========================================================================
   Variables CSS - Paleta Apple
   ========================================================================== */
:root {
  /* Colores Apple */
  --apple-blue: #007AFF;
  --apple-blue-dark: #0051D5;
  --apple-gray: #F5F5F7;
  --apple-gray-dark: #1D1D1F;
  --apple-text: #1D1D1F;
  --apple-text-secondary: #6E6E73;
  --apple-border: rgba(0, 0, 0, 0.08);
  --apple-white: #FFFFFF;
  --apple-shadow: rgba(0, 0, 0, 0.08);
  --apple-shadow-hover: rgba(0, 0, 0, 0.12);
  
  /* Gradientes Apple */
  --apple-gradient: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  --apple-gradient-light: linear-gradient(135deg, rgba(0, 122, 255, 0.05) 0%, rgba(88, 86, 214, 0.05) 100%);
  
  /* Espaciado Apple (8px base) */
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Bordes redondeados Apple */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  /* Tipografía Apple */
  --font-apple: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ==========================================================================
   Reset y Base
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-apple);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   Main Container - Estilo Apple
   ========================================================================== */
#maintenance-services {
  width: 100%;
  max-width: 100%;
  padding: var(--space-md);
  margin: 0 auto;
  background: var(--apple-gray);
  min-height: calc(100vh - 200px);
  
  /* Animación de entrada suave */
  opacity: 0;
  animation: fadeInContainer 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInContainer {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Grid de 2 Columnas Automático (Móviles)
   ========================================================================== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  width: 100%;
  margin: 0 auto;
}

/* Para pantallas muy pequeñas (menores a 360px) */
@media (max-width: 359px) {
  .services-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
}

/* ==========================================================================
   Section Box - Estilo Apple Card
   ========================================================================== */
.section-box {
  background: var(--apple-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  
  /* Sombra sutil estilo Apple */
  box-shadow: 
    0 2px 8px var(--apple-shadow),
    0 1px 2px rgba(0, 0, 0, 0.04);
  
  border: 1px solid var(--apple-border);
  
  /* Transición suave */
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  
  /* Animación de entrada escalonada */
  opacity: 0;
  animation: fadeInCard 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  
  /* Hover effect sutil */
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

/* Delays escalonados para animación */
.section-box:nth-child(1) { animation-delay: 0.1s; }
.section-box:nth-child(2) { animation-delay: 0.15s; }
.section-box:nth-child(3) { animation-delay: 0.2s; }
.section-box:nth-child(4) { animation-delay: 0.25s; }
.section-box:nth-child(5) { animation-delay: 0.3s; }
.section-box:nth-child(6) { animation-delay: 0.35s; }

@keyframes fadeInCard {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Barra superior de acento (opcional) */
.section-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--apple-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Hover effect estilo Apple */
.section-box:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 
    0 12px 24px var(--apple-shadow-hover),
    0 4px 8px rgba(0, 0, 0, 0.06);
}

.section-box:hover::before {
  opacity: 1;
}

/* Active state */
.section-box:active {
  transform: translateY(-2px) scale(1.01);
  transition: transform 0.1s ease;
}

/* ==========================================================================
   Iconos Decorativos (Estilo Apple)
   ========================================================================== */
.section-box-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-md) auto;
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: var(--apple-gradient-light);
  border-radius: var(--radius-md);
  
  font-size: 24px;
  color: var(--apple-blue);
}

/* ==========================================================================
   Títulos - Tipografía Apple
   ========================================================================== */
.title-box {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 600;
  color: var(--apple-text);
  margin-bottom: var(--space-sm);
  line-height: 1.2;
  letter-spacing: -0.02em;
  
  /* Estilo SF Pro Display */
  -webkit-font-smoothing: antialiased;
  text-align: center;
}

.subtitle-box {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 500;
  color: var(--apple-text);
  margin-bottom: var(--space-sm);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   Texto - Legibilidad Optimizada
   ========================================================================== */
.text-box {
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  line-height: 1.5;
  color: var(--apple-text-secondary);
  margin-bottom: var(--space-md);
  
  /* Optimización de lectura */
  letter-spacing: 0.01em;
  font-weight: 400;
}

/* ==========================================================================
   Listas - Estilo Apple
   ========================================================================== */
.list-box,
.steps-box {
  list-style: none;
  padding-left: 0;
  margin-top: var(--space-md);
}

.list-item-box {
  padding: var(--space-sm) 0;
  padding-left: var(--space-lg);
  position: relative;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  color: var(--apple-text-secondary);
  line-height: 1.5;
  transition: all 0.2s ease;
}

.list-item-box:hover {
  transform: translateX(4px);
  color: var(--apple-blue);
}

/* Checkmark estilo Apple */
.list-item-box::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: var(--space-sm);
  color: var(--apple-blue);
  font-weight: 600;
  font-size: 1rem;
}

/* Números para steps */
.steps-box {
  counter-reset: step-counter;
}

.steps-box .list-item-box {
  counter-increment: step-counter;
}

.steps-box .list-item-box::before {
  content: counter(step-counter);
  background: var(--apple-gradient);
  color: var(--apple-white);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ==========================================================================
   Story Grid - 2 Columnas en Móviles
   ========================================================================== */
.story-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.story-card {
  background: var(--apple-white);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--apple-blue);
  box-shadow: 0 2px 8px var(--apple-shadow);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px var(--apple-shadow-hover);
}

.story-card h4 {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--apple-text);
  margin-bottom: var(--space-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.story-card p {
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  color: var(--apple-text-secondary);
  line-height: 1.5;
  font-style: italic;
  margin-bottom: var(--space-sm);
}

.story-card h5 {
  font-size: clamp(0.8rem, 1.8vw, 0.9rem);
  color: var(--apple-blue);
  font-weight: 500;
  text-align: right;
}

/* ==========================================================================
   Botones - Estilo Apple
   ========================================================================== */
.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  
  background: var(--apple-blue);
  color: var(--apple-white);
  
  text-decoration: none;
  border-radius: var(--radius-md);
  
  font-weight: 500;
  font-size: clamp(0.9rem, 2.2vw, 1rem);
  letter-spacing: -0.01em;
  
  /* Sombra Apple */
  box-shadow: 
    0 4px 12px rgba(0, 122, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  
  /* Transición suave */
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  
  position: relative;
  overflow: hidden;
  cursor: pointer;
  
  /* Prevenir selección de texto */
  user-select: none;
  -webkit-user-select: none;
}

/* Efecto de brillo sutil */
.contact-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.contact-btn:hover::before {
  left: 100%;
}

.contact-btn:hover {
  background: var(--apple-blue-dark);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 8px 20px rgba(0, 122, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.contact-btn:active {
  transform: translateY(0) scale(0.98);
  transition: transform 0.1s ease;
}

/* ==========================================================================
   RESPONSIVE - 360x640px OPTIMIZADO
   ========================================================================== */

/* iPhone SE, Galaxy S8, etc. (360px-375px) */
@media (max-width: 375px) {
  #maintenance-services {
    padding: var(--space-sm);
  }
  
  .services-grid {
    gap: var(--space-sm);
  }
  
  .section-box {
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }
  
  .title-box {
    font-size: 1rem;
    margin-bottom: var(--space-xs);
  }
  
  .text-box {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: var(--space-sm);
  }
  
  .contact-btn {
    padding: 12px var(--space-md);
    font-size: 0.9rem;
  }
  
  .section-box-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
    margin-bottom: var(--space-sm);
  }
}

/* Pantallas muy pequeñas (320px) */
@media (max-width: 359px) {
  #maintenance-services {
    padding: var(--space-xs);
  }
  
  .section-box {
    padding: var(--space-sm);
  }
  
  .title-box {
    font-size: 0.95rem;
  }
  
  .text-box {
    font-size: 0.8rem;
  }
}

/* Tablets y pantallas medianas (576px - 768px) */
@media (min-width: 576px) and (max-width: 768px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
  
  .section-box {
    padding: var(--space-xl);
  }
}

/* Desktop (769px+) */
@media (min-width: 769px) {
  #maintenance-services {
    max-width: 1200px;
    padding: var(--space-2xl) var(--space-xl);
  }
  
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
  }
  
  .section-box {
    padding: var(--space-2xl);
  }
  
  .title-box {
    font-size: 1.5rem;
    text-align: left;
  }
  
  .text-box {
    font-size: 1rem;
  }
  
  .contact-btn {
    width: auto;
    padding: var(--space-md) var(--space-xl);
  }
  
  .section-box-icon {
    margin: 0 0 var(--space-lg) 0;
  }
}

/* Large Desktop (1024px+) */
@media (min-width: 1024px) {
  .services-grid {
    gap: var(--space-2xl);
  }
  
  .section-box {
    padding: var(--space-2xl) var(--space-xl);
  }
}

/* ==========================================================================
   Dark Mode - Estilo Apple
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --apple-gray: #000000;
    --apple-text: #F5F5F7;
    --apple-text-secondary: #A1A1A6;
    --apple-border: rgba(255, 255, 255, 0.1);
    --apple-white: #1C1C1E;
    --apple-shadow: rgba(0, 0, 0, 0.3);
    --apple-shadow-hover: rgba(0, 0, 0, 0.5);
  }
  
  .section-box {
    background: var(--apple-white);
  }
  
  .story-card {
    background: var(--apple-white);
  }
}

/* Dark mode manual (con clase) */
.dark #maintenance-services {
  background: #000000;
}

.dark .section-box {
  background: #1C1C1E;
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .title-box,
.dark .subtitle-box,
.dark .story-card h4 {
  color: #F5F5F7;
}

.dark .text-box,
.dark .list-item-box,
.dark .story-card p {
  color: #A1A1A6;
}

/* ==========================================================================
   Animaciones Reducidas (Accesibilidad)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Optimizaciones de Performance
   ========================================================================== */
.section-box,
.contact-btn {
  will-change: transform;
}

/* Mejoras de rendering */
.section-box {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  #maintenance-services {
    background: white;
    padding: 0;
  }
  
  .section-box {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .contact-btn {
    display: none;
  }
}

/* ==========================================================================
   Focus States (Accesibilidad)
   ========================================================================== */
.contact-btn:focus-visible {
  outline: 3px solid var(--apple-blue);
  outline-offset: 2px;
}

.section-box:focus-within {
  box-shadow: 
    0 0 0 4px rgba(0, 122, 255, 0.2),
    0 12px 24px var(--apple-shadow-hover);
}

/* ==========================================================================
   Loading State (Opcional)
   ========================================================================== */
.section-box.loading {
  opacity: 0.6;
  pointer-events: none;
}

.section-box.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--apple-blue);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to { transform: rotate(360deg); }
}