/* ===== ESTILOS RESPONSIVOS ===== */

/* ===== TABLETS (768px - 1024px) ===== */
@media (max-width: 1024px) {
  .container {
    padding: 0 var(--spacing-md);
  }
  
  .quote-container {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
  }
  
  .types-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
  
  .materials-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
  
  .contact-container {
    grid-template-columns: 1fr;
    gap: var(--spacing-2xl);
  }
  
  .footer-content {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

/* ===== MÓVILES GRANDES (576px - 767px) ===== */
@media (max-width: 767px) {
  :root {
    --spacing-3xl: 2rem;
    --spacing-2xl: 1.5rem;
    --spacing-xl: 1rem;
    --spacing-lg: 0.75rem;
  }
  
  /* Header móvil */
  .header {
    padding: var(--spacing-4) 0;
  }
  
  .header-content {
    position: relative;
  }
  
  .logo img {
    width: 35px;
    height: 35px;
  }
  
  .logo-text {
    font-size: var(--font-size-lg);
  }
  
  /* Navegación móvil */
  .nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-color);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-6);
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 1000;
    padding: var(--spacing-8);
  }
  
  .nav.active {
    transform: translateX(0);
  }
  
  .nav-link {
    font-size: var(--font-size-lg);
    padding: var(--spacing-4);
    border-radius: var(--border-radius-lg);
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  
  .nav-link:hover {
    background: var(--background-color);
  }
  
  .nav-toggle {
    display: flex;
  }
  
  /* Hero móvil */
  .hero {
    min-height: 80vh;
    padding: var(--spacing-8) 0;
  }
  
  .hero-title {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-4);
  }
  
  .hero-subtitle {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-8);
  }
  
  .hero-buttons {
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-3);
  }
  
  .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
  
  /* Formularios móviles */
  .form-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
  }
  
  .form-section {
    margin-bottom: var(--spacing-6);
    padding-bottom: var(--spacing-4);
  }
  
  .form-section h3 {
    font-size: var(--font-size-lg);
  }
  
  .form-actions {
    flex-direction: column;
    gap: var(--spacing-3);
  }
  
  /* Resultados móviles */
  .results-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
  }
  
  .result-card {
    padding: var(--spacing-4);
  }
  
  .cost-breakdown {
    padding: var(--spacing-4);
  }
  
  .cost-grid {
    gap: var(--spacing-2);
  }
  
  /* Tipos móviles */
  .types-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
  }
  
  .type-card {
    padding: var(--spacing-4);
  }
  
  .type-icon {
    width: 60px;
    height: 60px;
  }
  
  /* Materiales móviles */
  .materials-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
  }
  
  .material-category {
    padding: var(--spacing-4);
  }
  
  .material-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-3);
  }
  
  .material-price {
    margin-left: 0;
    text-align: left;
    width: 100%;
  }
  
  .materials-footer {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
  }
  
  /* Contacto móvil */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-6);
  }
  
  .contact-info,
  .contact-form {
    padding: var(--spacing-4);
  }
  
  /* Footer móvil */
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-6);
    text-align: center;
  }
  
  .footer-section {
    margin-bottom: var(--spacing-4);
  }
  
  .footer-social {
    justify-content: center;
  }
}

/* ===== MÓVILES PEQUEÑOS (hasta 575px) ===== */
@media (max-width: 575px) {
  .container {
    padding: 0 var(--spacing-3);
  }
  
  /* Header móvil pequeño */
  .header {
    padding: var(--spacing-3) 0;
  }
  
  .logo img {
    width: 30px;
    height: 30px;
  }
  
  .logo-text {
    font-size: var(--font-size-base);
  }
  
  /* Hero móvil pequeño */
  .hero {
    min-height: 70vh;
    padding: var(--spacing-6) 0;
  }
  
  .hero-title {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-3);
  }
  
  .hero-subtitle {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-6);
  }
  
  .hero-buttons {
    gap: var(--spacing-2);
  }
  
  .btn {
    padding: var(--spacing-3) var(--spacing-4);
    font-size: var(--font-size-sm);
  }
  
  /* Secciones móvil pequeño */
  .section-header h2 {
    font-size: var(--font-size-xl);
  }
  
  .section-header p {
    font-size: var(--font-size-sm);
  }
  
  /* Formularios móvil pequeño */
  .solar-form {
    padding: var(--spacing-4);
  }
  
  .form-section {
    margin-bottom: var(--spacing-4);
    padding-bottom: var(--spacing-3);
  }
  
  .form-section h3 {
    font-size: var(--font-size-base);
  }
  
  .form-group input,
  .form-group select {
    padding: var(--spacing-3);
    font-size: var(--font-size-sm);
  }
  
  /* Resultados móvil pequeño */
  .results-section {
    padding: var(--spacing-4);
  }
  
  .result-card {
    padding: var(--spacing-3);
  }
  
  .result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-1);
  }
  
  .cost-breakdown {
    padding: var(--spacing-3);
  }
  
  /* Tipos móvil pequeño */
  .type-card {
    padding: var(--spacing-3);
  }
  
  .type-icon {
    width: 50px;
    height: 50px;
  }
  
  .type-card h3 {
    font-size: var(--font-size-base);
  }
  
  .type-card p {
    font-size: var(--font-size-sm);
  }
  
  /* Materiales móvil pequeño */
  .material-category {
    padding: var(--spacing-3);
  }
  
  .material-info h4 {
    font-size: var(--font-size-sm);
  }
  
  .material-info p {
    font-size: var(--font-size-xs);
  }
  
  .material-specs {
    gap: var(--spacing-1);
  }
  
  .material-specs span {
    font-size: var(--font-size-xs);
    padding: var(--spacing-1) var(--spacing-2);
  }
  
  /* Contacto móvil pequeño */
  .contact-info,
  .contact-form {
    padding: var(--spacing-3);
  }
  
  .contact-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-2);
  }
  
  /* Footer móvil pequeño */
  .footer {
    padding: var(--spacing-6) 0;
  }
  
  .footer-section h3,
  .footer-section h4 {
    font-size: var(--font-size-base);
  }
  
  .footer-section p,
  .footer-section li {
    font-size: var(--font-size-sm);
  }
}

/* ===== PREVENIR SCROLL HORIZONTAL ===== */
* {
  max-width: 100%;
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
}

.container {
  max-width: 100vw;
  overflow-x: hidden;
}

/* Asegurar que las imágenes no causen scroll horizontal */
img {
  max-width: 100%;
  height: auto;
}

/* Asegurar que las tablas sean responsivas */
table {
  width: 100%;
  overflow-x: auto;
  display: block;
  white-space: nowrap;
}

/* Asegurar que los elementos con texto largo no causen overflow */
p, span, div, h1, h2, h3, h4, h5, h6 {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Mejorar legibilidad en móviles */
@media (max-width: 767px) {
  body {
    font-size: 16px; /* Prevenir zoom automático en iOS */
    line-height: 1.5;
  }
  
  /* Mejorar contraste y legibilidad */
  .hero-title,
  .section-header h2,
  .result-card h4,
  .material-info h4 {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }
  
  /* Asegurar que los botones sean fáciles de tocar */
  .btn,
  .nav-link,
  .nav-toggle {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Mejorar espaciado para lectura */
  .form-group label,
  .result-item span:first-child,
  .material-info p {
    line-height: 1.4;
  }
  
  /* Asegurar que los inputs sean fáciles de usar */
  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 44px;
    font-size: 16px; /* Prevenir zoom automático */
  }
}

/* ===== ORIENTACIÓN LANDSCAPE EN MÓVILES ===== */
@media (max-width: 767px) and (orientation: landscape) {
  .header {
    padding: var(--spacing-4) 0;
  }
  
  .hero {
    min-height: 60vh;
    padding: var(--spacing-6) 0;
  }
  
  .hero-title {
    font-size: var(--font-size-2xl);
  }
  
  .hero-subtitle {
    font-size: var(--font-size-base);
  }
  
  .calculator {
    padding: var(--spacing-8) 0;
  }
  
  .types {
    padding: var(--spacing-8) 0;
  }
  
  .materials {
    padding: var(--spacing-8) 0;
  }
  
  .contact {
    padding: var(--spacing-8) 0;
  }
  
  .footer {
    padding: var(--spacing-8) 0;
  }
}

/* ===== DISPOSITIVOS DE ALTA RESOLUCIÓN ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .type-icon,
  .material-card,
  .quote-form,
  .quote-results {
    border-width: 0.5px;
  }
}

/* ===== DISPOSITIVOS CON PREFERENCIA DE REDUCIR MOVIMIENTO ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .preview-item:hover,
  .type-card:hover,
  .material-card:hover {
    transform: none;
  }
  
  .cta-btn:hover,
  .btn:hover {
    transform: none;
  }
}

/* ===== DISPOSITIVOS CON PREFERENCIA DE ALTO CONTRASTE ===== */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #000080;
    --primary-dark: #000060;
    --secondary-color: #006000;
    --secondary-dark: #004000;
    --accent-color: #804000;
    --gray-200: #404040;
    --gray-300: #606060;
    --gray-400: #808080;
    --gray-500: #a0a0a0;
    --gray-600: #c0c0c0;
    --gray-700: #e0e0e0;
    --gray-800: #f0f0f0;
    --gray-900: #ffffff;
  }
  
  .type-card,
  .quote-form,
  .quote-results,
  .material-card {
    border-width: 2px;
  }
}

/* ===== IMPRESIÓN ===== */
@media print {
  .header,
  .navbar,
  .hero,
  .construction-types,
  .materials-section,
  .contact-section,
  .footer,
  .form-actions,
  .results-actions {
    display: none !important;
  }
  
  .quote-section {
    padding: 0;
    background: white;
  }
  
  .quote-container {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: none;
  }
  
  .quote-form {
    display: none;
  }
  
  .quote-results {
    box-shadow: none;
    border: none;
    padding: 0;
    max-height: none;
    overflow: visible;
  }
  
  .total-section {
    border: 2px solid black;
    background: white;
  }
  
  .breakdown-item,
  .material-item,
  .observations-list li {
    border: 1px solid black;
    background: white;
  }
  
  .type-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  
  * {
    color: black !important;
    background: white !important;
  }
}
