/* ========== RESPONSIVE PARA TABLETS ========== */
@media (max-width: 900px) {
  main {
    max-width: 95%;
  }

  .container {
    padding: 20px;
  }

  /* Ajustar grid de tarjetas en tablets */
  .tarjeta {
    grid-template-columns: repeat(2, 1fr) auto;
    gap: 12px;
  }

  .tarjeta label:nth-of-type(1),
  .tarjeta label:nth-of-type(2) {
    grid-column: span 1;
  }

  .tarjeta label:nth-of-type(3),
  .tarjeta label:nth-of-type(4),
  .tarjeta label:nth-of-type(5) {
    grid-column: span 2;
  }

  .tarjeta .btn-rojo {
    grid-column: 3;
    grid-row: 1 / -1;
    align-self: center;
  }

  /* Section titles smaller on tablets */
  .seccion h2 {
    font-size: 1.2em;
  }
}

/* ========== RESPONSIVE PARA MÓVILES ========== */
@media (max-width: 600px) {
  body {
    padding: 8px;
  }

  header.encabezado h1 {
    font-size: 1.3em;
  }

  header.encabezado p {
    font-size: 0.8em;
  }

  .container {
    padding: 15px;
    border-radius: 8px;
  }

  /* Section titles on mobile */
  .seccion h2 {
    font-size: 1.1em;
    margin-bottom: 12px;
  }

  /* Tarjetas en móviles - una sola columna */
  .tarjeta {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .tarjeta label:nth-of-type(1),
  .tarjeta label:nth-of-type(2),
  .tarjeta label:nth-of-type(3),
  .tarjeta label:nth-of-type(4),
  .tarjeta label:nth-of-type(5) {
    grid-column: 1;
  }

  .tarjeta .btn-rojo {
    grid-column: 1;
    justify-self: stretch;
    margin-top: 4px;
  }

  .tarjeta select,
  .tarjeta input.copy-input {
    width: 100%;
    box-sizing: border-box;
  }

  /* Tarjeta select e inputs: touch-friendly */
  .tarjeta select,
  .tarjeta input.copy-input {
    height: 44px;
    font-size: 16px;
    padding: 8px 10px;
  }

  /* Inputs de formulario: evitar zoom en iOS */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  select {
    font-size: 16px;
    padding: 10px;
    min-height: 44px;
  }

  /* Botones en móviles - apilados */
  .button-row {
    flex-direction: column;
    gap: 10px;
  }

  .button-row > button {
    margin-bottom: 0;
    min-height: 44px;
    flex: none;
  }

  /* Landing page en móviles */
  .landing__title {
    font-size: 1.2em;
  }

  /* Formulario de pago en móviles */
  .form-row-group {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .payment-form {
    padding: 16px;
  }

  .cargo {
    font-size: 1.1em;
    padding: 14px;
  }

  /* Opciones de envío en móviles */
  .shipping-options label {
    padding: 12px;
  }

  .shipping-options span {
    font-size: 14px;
  }

  .shipping-options span small {
    font-size: 14px;
  }

  .shipping-options input[type="radio"] {
    margin-right: 10px;
  }

  /* Pasos en móviles - 2 columnas */
  .pasos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, auto);
    gap: 4px 8px;
    font-size: 0.8em;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }

  .pasos li {
    padding-left: 14px;
  }

  /* Footer responsive */
  footer {
    flex-wrap: wrap !important;
    gap: 4px !important;
    line-height: 1.6 !important;
  }

  /* Success page button */
  #btnDownloadSummary {
    width: 60% !important;
    max-width: none !important;
  }

  /* Presupuesto responsive */
  #presupuesto {
    font-size: 0.85em;
  }

  /* Info text */
  .file-help-text {
    font-size: 0.8em !important;
    line-height: 1.5 !important;
  }

  /* Security notice */
  .security-notice {
    font-size: 0.9em;
    padding: 10px;
  }
}

/* ========== RESPONSIVE PARA MÓVILES PEQUEÑOS ========== */
@media (max-width: 400px) {
  body {
    padding: 5px;
  }

  .container {
    padding: 10px;
  }

  header.encabezado h1 {
    font-size: 1.15em;
  }

  header.encabezado p {
    font-size: 0.75em;
  }

  .seccion h2 {
    font-size: 1em;
  }

  /* Botones touch-friendly pero compactos */
  .btn-blue,
  #btnAdd,
  .btn-green,
  .btn-orange,
  .btn-gray {
    padding: 10px;
    font-size: 0.9em;
    min-height: 44px;
  }

  /* Tarjetas más compactas */
  .tarjeta {
    padding: 10px;
  }

  /* Pasos en una columna en móviles muy pequeños */
  .pasos {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    font-size: 0.8em;
  }

  /* Reset grid positions for single column */
  .pasos li:nth-child(1),
  .pasos li:nth-child(2),
  .pasos li:nth-child(3),
  .pasos li:nth-child(4),
  .pasos li:nth-child(5),
  .pasos li:nth-child(6) {
    grid-column: 1;
    grid-row: auto;
  }

  /* Footer on very small screens */
  footer span[style*="margin"] {
    display: none !important;
  }

  footer {
    font-size: 0.75em !important;
    padding: 10px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 4px 8px !important;
  }
}

/* ========== RESPONSIVE PARA PANTALLAS GRANDES ========== */
@media (min-width: 1200px) {
  main {
    max-width: 1000px;
  }

  .container {
    padding: 40px;
  }

  /* Tarjetas más espaciosas en pantallas grandes */
  .tarjeta {
    padding: 15px 20px;
    grid-template-columns: 120px 120px repeat(3, 1fr) auto;
    column-gap: 15px;
  }

  /* Botones más grandes */
  .btn-blue,
  #btnAdd,
  .btn-green {
    padding: 12px;
    font-size: 1.1em;
  }

  /* Formulario de pago más espacioso */
  .payment-form {
    padding: 32px;
  }

  .form-row-group {
    grid-template-columns: 2fr 1fr;
    gap: 24px;
  }
}

/* ========== RESPONSIVE PARA ALTURA BAJA ========== */
@media (max-height: 600px) {
  body {
    padding: 5px;
  }

  .container {
    padding: 15px;
  }

  header.encabezado {
    margin-bottom: 10px;
  }

  .pasos {
    margin-bottom: 8px;
  }
}

/* ========== MEJORAS PARA TOUCH ========== */
@media (hover: none) and (pointer: coarse) {
  /* Dispositivos táctiles */
  .tarjeta .btn-rojo,
  .btn-blue,
  .btn-green,
  .btn-orange,
  .btn-gray {
    min-height: 44px; /* Mínimo recomendado para touch */
  }

  .shipping-options label {
    min-height: 44px;
  }

  /* Mejor feedback táctil */
  .tarjeta:active,
  .shipping-options label:active {
    transform: scale(0.98);
  }
}
