/* ========================================
   ESTILOS RESPONSIVE PARA MÓVILES Y TABLETS
   ======================================== */

/* ===== CONFIGURACIÓN BASE ===== */
* {
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevenir scroll horizontal */
body {
    overflow-x: hidden;
}

/* ===== NAVBAR STICKY MEJORADO ===== */
@media (max-width: 991px) {
    /* Navbar scrolled permanece visible */
    .ftco_navbar.navbar-scrolled {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 9999 !important;
        background: rgba(0,0,0,0.98) !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;
        animation: slideInDown 0.3s ease-out;
    }
    
    @keyframes slideInDown {
        from {
            transform: translateY(-100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    /* Ajustar contenedor del navbar */
    .ftco_navbar .container {
        max-width: 100% !important;
        padding: 10px 15px !important;
    }
    
    /* Navbar normal (no scrolled) */
    .ftco_navbar:not(.navbar-scrolled) {
        background: rgba(0,0,0,0.8) !important;
    }
}

/* Prevenir zoom en inputs en iOS */
@media screen and (max-width: 991px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ===== TABLETS (768px - 991px) ===== */
@media (max-width: 991px) {
    /* Contenedor general */
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    /* Headings responsive */
    h1 {
        font-size: 2rem !important;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.75rem !important;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.5rem !important;
    }
    
    h4 {
        font-size: 1.25rem !important;
    }
    
    /* Hero/Banner */
    .hero-wrap,
    .banner-section {
        min-height: 400px !important;
        padding: 60px 0 !important;
    }
    
    .hero-wrap .slider-text,
    .banner-section .slider-text {
        padding: 40px 20px !important;
    }
    
    /* Secciones */
    section {
        padding: 60px 0 !important;
    }
    
    .ftco-section {
        padding: 4em 0 !important;
    }
    
    /* Cards de servicios/productos */
    .services,
    .product-item,
    .service-item {
        margin-bottom: 30px;
        padding: 20px;
    }
    
    .services-wrap {
        padding: 25px 20px !important;
    }
    
    /* Imágenes responsive */
    img {
        max-width: 100%;
        height: auto !important;
    }
    
    .img-fluid {
        width: 100%;
    }
    
    /* Botones */
    .btn {
        padding: 12px 25px !important;
        font-size: 14px !important;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Formularios */
    .form-control {
        padding: 12px 15px !important;
        font-size: 16px !important;
        min-height: 48px;
    }
    
    textarea.form-control {
        min-height: 120px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    /* Columnas a full width */
    .col-md-6,
    .col-md-4,
    .col-md-3,
    .col-lg-6,
    .col-lg-4,
    .col-lg-3 {
        margin-bottom: 30px;
    }
    
    /* Tablas responsive */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 14px;
    }
    
    /* Footer */
    .ftco-footer {
        padding: 40px 0 20px !important;
    }
    
    .ftco-footer .ftco-footer-widget {
        margin-bottom: 30px;
    }
    
    /* Espaciado */
    .mb-5 {
        margin-bottom: 2rem !important;
    }
    
    .mt-5 {
        margin-top: 2rem !important;
    }
    
    .py-5 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
}

/* ===== MÓVILES (hasta 767px) ===== */
@media (max-width: 767px) {
    /* Contenedor más ajustado */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Tipografía móvil */
    body {
        font-size: 15px;
        line-height: 1.6;
    }
    
    h1 {
        font-size: 1.75rem !important;
        margin-bottom: 15px;
    }
    
    h2 {
        font-size: 1.5rem !important;
        margin-bottom: 15px;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    h4 {
        font-size: 1.1rem !important;
    }
    
    p {
        margin-bottom: 15px;
    }
    
    /* Hero/Banner móvil */
    .hero-wrap,
    .banner-section {
        min-height: 300px !important;
        padding: 40px 0 !important;
    }
    
    .hero-wrap .slider-text,
    .banner-section .slider-text {
        padding: 30px 15px !important;
    }
    
    .hero-wrap h1,
    .banner-section h1 {
        font-size: 1.5rem !important;
    }
    
    /* Secciones móvil */
    section {
        padding: 40px 0 !important;
    }
    
    .ftco-section {
        padding: 3em 0 !important;
    }
    
    /* Cards más compactas */
    .services,
    .product-item,
    .service-item {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .services-wrap {
        padding: 20px 15px !important;
    }
    
    /* Botones táctiles */
    .btn {
        width: 100%;
        padding: 14px 20px !important;
        font-size: 15px !important;
        margin-bottom: 10px;
        min-height: 48px;
    }
    
    .btn-group .btn {
        width: auto;
        flex: 1;
    }
    
    /* Formularios móvil */
    .form-control {
        padding: 14px 15px !important;
        font-size: 16px !important;
        min-height: 48px;
        border-radius: 8px;
    }
    
    label {
        font-size: 14px;
        margin-bottom: 8px;
        font-weight: 600;
    }
    
    /* Grid a una columna */
    .row > [class*="col-"] {
        margin-bottom: 20px;
    }
    
    /* Navegación breadcrumb */
    .breadcrumb {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    /* Modales */
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-content {
        border-radius: 10px;
    }
    
    /* Footer compacto */
    .ftco-footer {
        padding: 30px 0 15px !important;
        text-align: center;
    }
    
    .ftco-footer .ftco-footer-widget {
        margin-bottom: 25px;
    }
    
    .ftco-footer h2 {
        font-size: 1.2rem !important;
    }
    
    /* Spacing móvil */
    .mb-5 {
        margin-bottom: 1.5rem !important;
    }
    
    .mt-5 {
        margin-top: 1.5rem !important;
    }
    
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .px-3 {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* ===== MÓVILES PEQUEÑOS (hasta 576px) ===== */
@media (max-width: 576px) {
    /* Tipografía extra pequeña */
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.3rem !important;
    }
    
    h3 {
        font-size: 1.15rem !important;
    }
    
    /* Banner mínimo */
    .hero-wrap,
    .banner-section {
        min-height: 250px !important;
        padding: 30px 0 !important;
    }
    
    /* Contenido compacto */
    section {
        padding: 30px 0 !important;
    }
    
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Cards ultra compactas */
    .services,
    .product-item,
    .service-item {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    /* Botones grandes táctiles */
    .btn {
        padding: 15px 20px !important;
        font-size: 14px !important;
        min-height: 50px;
    }
    
    /* Formularios optimizados */
    .form-control {
        padding: 15px !important;
        font-size: 16px !important;
        min-height: 50px;
    }
    
    /* Tablas apiladas */
    table {
        font-size: 12px;
    }
    
    table thead {
        display: none;
    }
    
    table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 5px;
        padding: 10px;
    }
    
    table td {
        display: block;
        text-align: left !important;
        padding: 5px 10px !important;
        border: none;
    }
    
    table td:before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        margin-right: 10px;
    }
}

/* ===== ELEMENTOS ESPECÍFICOS ===== */

/* About Us / Nosotros */
@media (max-width: 767px) {
    .about-section .img {
        height: 250px !important;
        margin-bottom: 20px;
    }
    
    .staff .img {
        height: 200px !important;
    }
}

/* Services / Servicios */
@media (max-width: 767px) {
    .services .icon {
        font-size: 2.5rem !important;
        margin-bottom: 15px;
    }
    
    .services h3 {
        font-size: 1.1rem !important;
    }
    
    .pricing-entry {
        padding: 20px 15px !important;
    }
}

/* Products / Productos */
@media (max-width: 767px) {
    .product .img {
        height: 200px !important;
    }
    
    .product-name {
        font-size: 1rem !important;
    }
    
    .price {
        font-size: 1.2rem !important;
    }
}

/* Contact / Contacto */
@media (max-width: 767px) {
    .contact-section .info-wrap {
        padding: 20px 15px !important;
    }
    
    .contact-section .dbox {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .contact-section .icon {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.5rem !important;
    }
}

/* Blog / News */
@media (max-width: 767px) {
    .blog-entry .text {
        padding: 20px 15px !important;
    }
    
    .blog-entry h3 {
        font-size: 1.15rem !important;
    }
    
    .meta {
        font-size: 12px;
    }
}

/* Galería */
@media (max-width: 767px) {
    .gallery .item {
        margin-bottom: 15px;
    }
    
    .gallery img {
        border-radius: 10px;
    }
}

/* ===== MEJORAS DE UX MÓVIL ===== */

/* Links táctiles */
@media (max-width: 991px) {
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Excluir navbar links */
    .navbar-nav a {
        min-height: auto;
    }
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Optimizar rendimiento en scroll */
@media (max-width: 991px) {
    * {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    img {
        transform: translateZ(0);
    }
}

/* Modales fullscreen en móvil */
@media (max-width: 576px) {
    .modal {
        padding: 0 !important;
    }
    
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }
    
    .modal-content {
        height: 100%;
        border: none;
        border-radius: 0;
    }
}

/* Animaciones suaves para móvil */
@media (max-width: 991px) {
    .btn,
    .form-control,
    .card,
    .nav-link {
        transition: all 0.3s ease;
    }
}

/* Evitar texto muy pequeño */
@media (max-width: 767px) {
    small,
    .small {
        font-size: 85% !important;
        line-height: 1.4;
    }
}

/* Ajustar video embeds */
@media (max-width: 767px) {
    iframe,
    embed,
    video {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* ===== ORIENTACIÓN LANDSCAPE EN MÓVILES ===== */
@media (max-width: 767px) and (orientation: landscape) {
    .hero-wrap,
    .banner-section {
        min-height: 200px !important;
        padding: 20px 0 !important;
    }
    
    section {
        padding: 30px 0 !important;
    }
}

/* ===== FIX PARA SAFARI iOS ===== */
@supports (-webkit-touch-callout: none) {
    /* Safari iOS specific fixes */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea {
        -webkit-appearance: none;
        border-radius: 0;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .footer,
    .btn,
    .social-media {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}
