/* ========================================================================
   Media Queries - Diseño Responsive
   ======================================================================== */

/* Tablets y Pantallas Pequeñas (768px y menor) */
@media (max-width: 768px) {
  :root {
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.375rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --spacing-2xl: 2rem;
  }

  body {
    padding: var(--spacing-md);
  }

  .container {
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
  }

  .title {
    font-size: 1.75rem;
  }

  .section-title {
    font-size: 1.125rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Móviles Grandes (640px y menor) */
@media (max-width: 640px) {
  .container {
    padding: var(--spacing-lg);
  }

  .header {
    margin-bottom: var(--spacing-xl);
  }

  .logo {
    width: 60px;
    height: 60px;
  }

  .title {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.875rem;
  }

  .form-section {
    padding: var(--spacing-md);
  }

  .section-title {
    font-size: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
  }

  .photo-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }

  .photo-upload-container {
    min-height: 160px;
  }

  .camera-icon,
  .ticket-icon {
    width: 40px;
    height: 40px;
  }

  .btn {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 0.9375rem;
  }
}

/* Móviles Pequeños (480px y menor) */
@media (max-width: 480px) {
  body {
    padding: 0;
    align-items: flex-start;
    /* Mantener el fondo azul oscuro en móviles */
    background: #0f172a;
  }

  .container {
    max-width: 100%;
    border-radius: 0;
    /* Mantener efecto glass en móviles */
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
    min-height: 100vh;
    padding: var(--spacing-md);
  }

  .header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    backdrop-filter: blur(10px);
    margin: calc(-1 * var(--spacing-md));
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-xl) var(--spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .header .title {
    color: white;
  }

  .header .subtitle {
    color: rgba(255, 255, 255, 0.9);
  }

  .logo {
    width: 90px;
    height: 100px;
    background: transparent !important;
    padding: 8px;
    border-radius: var(--radius-md);
  }

  .form-input,
  .form-select {
    padding: 0.875rem 1rem;
    font-size: 16px; /* Previene zoom en iOS */
    background: rgba(255, 255, 255, 0.1);
    color: white;
  }

  .photo-upload-container {
    min-height: 140px;
  }

  .photo-preview {
    height: 120px;
  }

  .location-status {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .btn-retry-location {
    width: 100%;
    justify-content: center;
    margin-top: var(--spacing-sm);
  }

  .alert {
    border-radius: 0;
    margin-left: calc(-1 * var(--spacing-md));
    margin-right: calc(-1 * var(--spacing-md));
    padding: var(--spacing-md);
  }
}

/* Pantallas muy pequeñas (360px y menor) */
@media (max-width: 360px) {
  .title {
    font-size: 1.25rem;
  }

  .subtitle {
    font-size: 0.8125rem;
  }

  .form-label {
    font-size: 0.8125rem;
  }

  .form-input,
  .form-select {
    padding: 0.75rem;
    font-size: 16px;
  }

  .btn {
    padding: 0.875rem var(--spacing-md);
    font-size: 0.875rem;
  }
}

/* Orientación Landscape en Móviles */
@media (max-height: 600px) and (orientation: landscape) {
  body {
    padding: var(--spacing-sm);
  }

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

  .logo {
    width: 40px;
    height: 40px;
  }

  .title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-xs);
  }

  .subtitle {
    display: none;
  }

  .form-section {
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
  }

  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .photo-upload-container {
    min-height: 120px;
  }

  .camera-icon,
  .ticket-icon {
    width: 32px;
    height: 32px;
  }
}

/* Pantallas grandes (1024px y mayor) */
@media (min-width: 1024px) {
  .container {
    padding: var(--spacing-2xl);
  }

  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
  }

  .form-row {
    gap: var(--spacing-xl);
  }
}

/* Pantallas muy grandes (1440px y mayor) */
@media (min-width: 1440px) {
  .container {
    max-width: 800px;
  }

  .title {
    font-size: 2.25rem;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    padding: 0;
  }

  .container {
    box-shadow: none;
    padding: 0;
  }

  .btn,
  .photo-remove,
  .page-loader {
    display: none !important;
  }

  .photo-upload-container {
    page-break-inside: avoid;
  }

  .alert {
    page-break-inside: avoid;
  }
}

/* Modo Alto Contraste */
@media (prefers-contrast: high) {
  .form-input,
  .form-select {
    border-width: 3px;
  }

  .btn-primary {
    background: var(--primary-color);
  }

  .photo-upload-container {
    border-width: 3px;
  }
}

/* Modo Oscuro (Dark Mode) - Ya aplicado por defecto */
@media (prefers-color-scheme: dark) {
  /* El diseño ya es oscuro por defecto, no se necesitan cambios adicionales */
  .form-select option {
    background: #1e293b;
    color: white;
  }
}

/* Animaciones reducidas para accesibilidad */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .container {
    animation: none;
  }

  .alert {
    animation: none;
  }

  .loader-spinner,
  .btn-loader {
    animation: none;
    opacity: 0.5;
  }
}

/* Touch Devices */
@media (hover: none) and (pointer: coarse) {
  .photo-upload-container {
    min-height: 180px;
  }

  .btn {
    min-height: 48px; /* Área táctil mínima recomendada */
  }

  .photo-remove {
    width: 36px;
    height: 36px;
  }
}

/* Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .logo {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

