/* ========================================
   APP NATIVE FEATURES CSS
   Mejoras visuales para PWA instalada
   ======================================== */

/* ====== DETECCIÓN DE APP INSTALADA ====== */
/* Estas reglas solo se aplican cuando la app está instalada */
@media (display-mode: standalone) {
  
  /* Ocultar scroll bar en app (más limpio) */
  ::-webkit-scrollbar {
    width: 4px;
  }
  
  ::-webkit-scrollbar-track {
    background: rgba(212, 175, 55, 0.05);
  }
  
  ::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 10px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
  }

  /* Padding superior para evitar el notch en móviles */
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Indicador visual de que es app */
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
      transparent, 
      #d4af37, 
      transparent);
    z-index: 9999;
    animation: appIndicator 3s ease-in-out infinite;
  }

  @keyframes appIndicator {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.5; }
  }
}

/* ====== TRANSICIONES DE PÁGINA ====== */
/* Animación al cambiar de página */
.page-transition-enter {
  animation: pageSlideIn 0.4s ease-out;
}

@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ====== MEJORAS EN BOTONES ====== */
/* Feedback táctil en todos los botones */
.btn,
button,
.nav-link,
.card-link {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Efecto ripple al tocar */
.btn::before,
button::before,
.nav-link::before,
.card-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.4);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before,
button:active::before,
.nav-link:active::before,
.card-link:active::before {
  width: 300px;
  height: 300px;
}

/* Efecto de presión */
.btn:active,
button:active,
.nav-link:active,
.card-link:active {
  transform: scale(0.96);
}

/* ====== CARDS MEJORADAS ====== */
.reflexion-card,
.hero-image-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.reflexion-card:active,
.hero-image-card:active {
  transform: scale(0.98);
}

/* Hover para desktop */
@media (hover: hover) {
  .reflexion-card:hover,
  .hero-image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.3);
  }
}

/* ====== PULL TO REFRESH VISUAL ====== */
.pull-to-refresh {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.9);
  border-radius: 50%;
  z-index: 9998;
  transition: top 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pull-to-refresh.visible {
  top: 20px;
}

.pull-to-refresh::after {
  content: '↓';
  color: #0b0b0c;
  font-size: 1.5rem;
  font-weight: bold;
  animation: pullArrow 1s ease-in-out infinite;
}

@keyframes pullArrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* ====== NAVEGACIÓN MEJORADA ====== */
.main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Efecto en link activo */
.nav-link.active {
  position: relative;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  background: #d4af37;
  border-radius: 10px;
  animation: activeIndicator 2s ease-in-out infinite;
}

@keyframes activeIndicator {
  0%, 100% { width: 30px; opacity: 1; }
  50% { width: 40px; opacity: 0.7; }
}

/* ====== INPUTS MEJORADOS ====== */
.interactive-input,
input[type="text"],
input[type="email"],
textarea {
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.interactive-input:focus,
input:focus,
textarea:focus {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
  outline: none;
  border-color: #d4af37;
}

/* ====== ANIMACIONES DE SCROLL ====== */
/* Elementos que aparecen al hacer scroll */
.fade-in-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.fade-in-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

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

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #d4af37;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ====== VIBRACIÓN VISUAL EN ACCIONES ====== */
@keyframes vibrate {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.error-shake {
  animation: vibrate 0.3s ease-in-out;
}

/* ====== TOAST NOTIFICATIONS ====== */
.toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(212, 175, 55, 0.95);
  color: #0b0b0c;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-family: 'Crimson Pro', serif;
  font-weight: 600;
  z-index: 9999;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast.show {
  bottom: 30px;
}

/* ====== OPTIMIZACIONES DE RENDIMIENTO ====== */
/* GPU acceleration para animaciones suaves */
.btn,
.nav-link,
.reflexion-card,
.hero-image-card {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ====== MODO OSCURO MEJORADO ====== */
@media (prefers-color-scheme: dark) {
  /* Ya está en dark por defecto, pero reforzamos */
  body {
    background: #0b0b0c;
  }
}

/* ====== ANIMACIONES SUTILES DE FONDO ====== */
.halo {
  animation: pulseHalo 8s ease-in-out infinite;
}

@keyframes pulseHalo {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.3;
  }
  33% {
    transform: translate(-45%, -55%) scale(1.3);
    opacity: 0.2;
  }
  66% {
    transform: translate(-55%, -45%) scale(1.2);
    opacity: 0.25;
  }
}

/* ====== RESPONSIVE MEJORADO ====== */
@media (max-width: 768px) {
  /* En móvil, hacer botones más grandes para fácil toque */
  .btn,
  button,
  .nav-link {
    min-height: 44px; /* Recomendación de Apple para touch targets */
    padding: 0.75rem 1.5rem;
  }
  
  /* Espaciado mejor en móvil */
  .reflexiones-grid {
    gap: 1.5rem;
  }
}

/* ====== ACCESIBILIDAD ====== */
/* Reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}