/* Responsive Design para CMB Construcciones */

/* Pantallas grandes (1200px y más) */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
  
  .hero-title {
    font-size: 4.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.6rem;
  }
}

/* Tablets y pantallas medianas (992px - 1199px) */
@media (max-width: 1199px) {
  .hero-title {
    font-size: 3.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.3rem;
  }
  
  .section-padding {
    padding: 100px 0 70px 0;
  }
  
  .certification-card {
    padding: 2.5rem;
  }
}

/* Tablets pequeñas (768px - 991px) */
@media (max-width: 991px) {
  body {
    padding-top: 70px;
  }
  
  .navbar {
    height: 70px;
    background-color: rgba(36, 40, 48, 0.95) !important;
    backdrop-filter: blur(10px);
  }
  
  .hero {
    margin-top: -70px;
    padding-top: 70px;
  }
  
  section[id] {
    scroll-margin-top: 90px;
  }
  
  .hero-title {
    font-size: 3rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }
  
  .section-padding {
    padding: 90px 0 60px 0;
  }
  
  .certification-card {
    padding: 2rem;
  }
  
  .portfolio-item {
    height: 280px;
  }
  
  .contact-card {
    margin-bottom: 2rem;
  }
  
  .navbar-nav {
    text-align: center;
    padding-top: 1rem;
    background-color: rgba(36, 40, 48, 0.98);
    border-radius: 10px;
    margin-top: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem !important;
    color: #ffffff !important;
    border-radius: 5px;
    margin: 0.25rem;
  }
  
  .navbar-nav .nav-link:hover {
    background-color: rgba(61, 201, 179, 0.2);
    color: var(--primary-color) !important;
  }
  
  .navbar-brand img {
    height: 60px;
    max-height: 60px;
  }
}

/* Móviles grandes (576px - 767px) */
@media (max-width: 767px) {
  body {
    padding-top: 60px;
  }
  
  .navbar {
    height: 60px;
    background-color: rgba(36, 40, 48, 0.98) !important;
    backdrop-filter: blur(15px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
  }
  
  .hero {
    margin-top: -60px;
    padding-top: 60px;
  }
  
  section[id] {
    scroll-margin-top: 80px;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .hero-buttons .btn {
    display: block;
    width: 100%;
    margin-bottom: 1rem;
  }
  
  .hero-buttons .btn:last-child {
    margin-bottom: 0;
  }
  
  .section-padding {
    padding: 80px 0 50px 0;
  }
  
  .section-title {
    font-size: 2rem;
  }
  
  .certification-card {
    padding: 1.5rem;
  }
  
  .portfolio-item {
    height: 250px;
    margin-bottom: 2rem;
  }
  
  .contact-card {
    margin-bottom: 2rem;
  }
  
  .contact-icon {
    width: 70px;
    height: 70px;
    font-size: 1.3rem;
  }
  
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
  }
  
  .hero-scroll {
    bottom: 20px;
  }
}

/* Móviles pequeños (hasta 575px) */
@media (max-width: 575px) {
  body {
    padding-top: 60px;
  }
  
  .navbar {
    height: 60px;
    background-color: rgba(36, 40, 48, 0.98) !important;
    backdrop-filter: blur(15px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
  }
  
  .hero {
    margin-top: -60px;
    padding-top: 60px;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  h4 { font-size: 1.25rem; }
  h5 { font-size: 1.1rem; }
  h6 { font-size: 1rem; }
  
  .section-padding {
    padding: 70px 0 40px 0;
  }
  
  .section-title {
    font-size: 1.75rem;
  }
  
  .certification-card {
    padding: 1.25rem;
  }
  
  .portfolio-item {
    height: 200px;
  }
  
  .contact-icon {
    width: 60px;
    height: 60px;
    font-size: 1.2rem;
  }
  
  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  .navbar-brand img {
    height: 50px;
    max-height: 50px;
  }
  
  .back-to-top {
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
  }
}

/* Móviles muy pequeños (hasta 375px) */
@media (max-width: 375px) {
  body {
    padding-top: 60px;
  }
  
  .navbar {
    height: 60px;
  }
  
  .hero {
    margin-top: -60px;
    padding-top: 60px;
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
  
  .hero-subtitle {
    font-size: 0.9rem;
  }
  
  .section-padding {
    padding: 60px 0 30px 0;
  }
  
  .certification-card {
    padding: 1rem;
  }
  
  .portfolio-item {
    height: 180px;
  }
  
  .contact-card {
    padding: 1.5rem;
  }
  
  .contact-icon {
    width: 50px;
    height: 50px;
    font-size: 1rem;
  }
}

/* Orientación landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: 100vh;
    padding: 2rem 0;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .hero-buttons {
    margin-top: 1rem;
  }
  
  .section-padding {
    padding: 50px 0 30px 0;
  }
}

/* Mejoras para pantallas de alta densidad */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero {
    background-image: url('../img/fondo.jpg');
    background-size: cover;
  }
}

/* Modo oscuro (si el usuario lo prefiere) */
@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #e0e0e0;
    --text-light: #b0b0b0;
    --light-color: #1a1a1a;
  }
  
  .certification-card,
  .contact-card {
    background: #2a2a2a;
    color: var(--text-color);
  }
}

/* Reducción de movimiento para usuarios que lo prefieren */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .scroll-down {
    animation: none;
  }
  
  .hero::before {
    display: none;
  }
}

/* Estilos de impresión */
@media print {
  .navbar,
  .back-to-top,
  .hero-scroll,
  .btn {
    display: none !important;
  }
  
  .hero {
    min-height: auto;
    padding: 2rem 0;
    background: none !important;
  }
  
  .hero-title,
  .hero-subtitle {
    color: var(--text-color) !important;
    text-shadow: none !important;
  }
  
  .section-padding {
    padding: 1rem 0;
  }
  
  .portfolio-item {
    height: auto;
    page-break-inside: avoid;
  }
  
  .contact-card {
    border: 1px solid #ddd;
    margin-bottom: 1rem;
  }
}

/* Contenedor de mapa responsive */
.map-container {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
  border-radius: var(--border-radius);
}

.map-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Ajustes para navegación móvil */
.navbar-toggler {
  border: none;
  padding: 0.25rem 0.5rem;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 3px rgba(61, 201, 179, 0.3);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-collapse {
  transition: all 0.3s ease;
}

/* Mejoras de accesibilidad */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0066cc;
    --text-color: #000000;
    --text-light: #333333;
  }
  
  .btn-primary {
    background: #0066cc;
    border: 2px solid #000000;
  }
  
  .btn-outline-primary {
    border: 2px solid #0066cc;
    color: #0066cc;
  }
}

/* Focus states mejorados para accesibilidad */
.btn:focus,
.nav-link:focus,
.back-to-top:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

/* Mejoras para lectores de pantalla */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
