/* =====================================================
   4D Gestión - Mobile Optimizations
   ===================================================== */

/* Touch-friendly improvements */
@media (max-width: 768px) {
    
    /* Increase touch targets */
    .btn {
        min-height: 48px;
        padding: 12px 24px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .nav-link {
        padding: 16px 20px;
        font-size: 16px;
    }
    
    /* Improve form inputs for mobile */
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 16px;
    }
    
    /* Mobile-specific hero adjustments */
    .hero-section {
        padding: 60px 0 40px;
        text-align: center;
    }
    
    .hero-content {
        padding: 20px 0;
    }
    
    .hero-stats {
        margin: 30px 0;
    }
    
    .hero-stats .row {
        gap: 20px;
    }
    
    .hero-stats .col-4 {
        flex: 1;
        min-width: 100px;
    }
    
    /* Mobile navigation improvements */
    .navbar-toggler {
        border: none;
        padding: 8px 12px;
        font-size: 18px;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
    
    .navbar-collapse {
        background: white;
        border-top: 1px solid #eee;
        margin-top: 10px;
        padding: 20px 0;
        border-radius: 10px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    .navbar-nav {
        gap: 10px;
    }
    
    .navbar-nav .nav-item:last-child {
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid #eee;
    }
    
    /* Service cards mobile layout */
    .service-card {
        margin-bottom: 30px;
        padding: 30px 20px;
    }
    
    .service-icon {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
    
    /* Contact form mobile optimizations */
    .contact-form-container {
        padding: 30px 20px;
        margin: 20px 0;
    }
    
    .contact-form .row {
        margin: 0;
    }
    
    .contact-form .row > div {
        padding: 0 0 20px 0;
    }
    
    /* Footer mobile layout */
    footer .row > div {
        margin-bottom: 30px;
        text-align: center;
    }
    
    footer .social-links {
        justify-content: center;
        margin-top: 20px;
    }
    
    /* Workflow mobile adjustments */
    .workflow-steps {
        padding: 20px;
    }
    
    .workflow-step {
        margin-bottom: 30px;
    }
    
    .workflow-arrow {
        margin: 20px 0;
    }
    
    .step-number {
        width: 50px;
        height: 50px;
        font-size: 1.1rem;
    }
    
    /* Back to top button mobile */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    /* Typography mobile adjustments */
    .display-4 {
        font-size: 2.2rem;
        line-height: 1.2;
    }
    
    .display-5 {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    .lead {
        font-size: 1.1rem;
    }
    
    h4 {
        font-size: 1.3rem;
    }
    
    h5 {
        font-size: 1.1rem;
    }
    
    /* About section mobile */
    .about-content {
        padding: 20px 0;
        text-align: center;
    }
    
    .feature-item {
        flex-direction: column;
        text-align: center;
        margin-bottom: 30px;
    }
    
    .feature-icon-small {
        margin: 0 auto 15px;
    }
    
    /* Tech cards mobile */
    .tech-card {
        margin-bottom: 20px;
        padding: 30px 20px;
    }
    
    .tech-icon {
        font-size: 2.5rem;
    }
    
    /* CTA section mobile */
    .cta-section {
        padding: 60px 0;
        text-align: center;
    }
    
    .cta-buttons {
        margin-top: 30px;
    }
    
    .cta-buttons .btn {
        display: block;
        width: 100%;
        margin: 10px 0;
    }
    
    /* Contact info mobile */
    .contact-info-item {
        margin-bottom: 40px;
    }
    
    .contact-icon {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
    
    /* Feature cards mobile */
    .feature-card {
        margin-bottom: 30px;
        padding: 30px 20px;
    }
    
    .feature-icon {
        font-size: 2.5rem;
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    
    /* Typography for very small screens */
    .display-4 {
        font-size: 1.8rem;
    }
    
    .display-5 {
        font-size: 1.5rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    /* Container padding adjustments */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Section padding */
    section {
        padding: 40px 0 !important;
    }
    
    /* Hero section very small screens */
    .hero-section {
        padding: 40px 0 30px;
    }
    
    .hero-stats .col-4 {
        flex: 1 1 100%;
        margin-bottom: 20px;
    }
    
    .hero-stats h3 {
        font-size: 1.5rem;
    }
    
    /* Service cards very small */
    .service-card {
        padding: 25px 15px;
    }
    
    .service-features {
        font-size: 0.9rem;
    }
    
    /* Contact form very small */
    .contact-form-container {
        padding: 25px 15px;
    }
    
    /* Workflow very small */
    .step-number {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .step-content h5 {
        font-size: 0.9rem;
    }
    
    .step-content p {
        font-size: 0.8rem;
    }
    
    /* Footer very small */
    footer {
        padding: 40px 0 20px;
    }
    
    .footer-brand h4 {
        font-size: 1.3rem;
    }
    
    /* Back to top very small */
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        padding: 40px 0;
        min-height: auto;
    }
    
    .hero-content {
        padding: 20px 0;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .hero-stats {
        margin: 20px 0;
    }
    
    .hero-buttons {
        margin-top: 20px;
    }
    
    .hero-buttons .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .service-icon,
    .contact-icon,
    .feature-icon,
    .tech-icon {
        transform: scale(0.9);
    }
}

/* Dark mode mobile adjustments */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .navbar-collapse {
        background: #1a1a1a;
        border-top-color: #333;
    }
    
    .nav-link {
        color: #fff !important;
    }
    
    .navbar-nav .nav-item:last-child {
        border-top-color: #333;
    }
}

/* Reduced motion for mobile */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .service-card:hover,
    .feature-card:hover,
    .btn:hover {
        transform: none;
    }
    
    .hero-image img:hover {
        transform: none;
    }
}

/* Touch interaction improvements */
@media (hover: none) and (pointer: coarse) {
    .service-card:hover,
    .feature-card:hover,
    .tech-card:hover {
        transform: none;
        box-shadow: var(--box-shadow);
    }
    
    .btn:hover {
        transform: none;
    }
    
    .hero-image img:hover {
        transform: none;
    }
    
    /* Add touch feedback */
    .btn:active {
        transform: scale(0.98);
    }
    
    .service-card:active,
    .feature-card:active {
        transform: scale(0.98);
    }
}

/* Safe area adjustments for devices with notch */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .container {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    
    .back-to-top {
        right: max(20px, env(safe-area-inset-right));
        bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* iOS specific improvements */
@supports (-webkit-touch-callout: none) {
    .form-control,
    .form-select {
        border-radius: 8px; /* Better for iOS */
    }
    
    .btn {
        border-radius: 8px;
    }
    
    /* Fix iOS zoom on input focus */
    .form-control:focus,
    .form-select:focus {
        font-size: 16px;
    }
}

/* Android specific improvements */
@media (max-width: 768px) {
    input[type="email"],
    input[type="tel"],
    input[type="text"],
    textarea {
        font-size: 16px !important; /* Prevent zoom */
    }
}

/* Print styles for mobile */
@media print and (max-width: 768px) {
    .hero-section {
        page-break-inside: avoid;
    }
    
    .service-card {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .contact-form-container {
        display: none;
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    /* Larger focus indicators */
    .btn:focus,
    .form-control:focus,
    .nav-link:focus {
        outline: 3px solid var(--primary-color);
        outline-offset: 2px;
    }
    
    /* Better contrast for small screens */
    .text-muted {
        color: #495057 !important;
    }
    
    /* Ensure sufficient color contrast */
    .text-white-50 {
        color: rgba(255, 255, 255, 0.8) !important;
    }
}
