/* Enhanced Responsive Styles for Dastyarino */
/* This file contains additional responsive fixes and enhancements */

/* Critical Mobile Fixes */
.mobile-optimized {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Prevent horizontal scroll on mobile */
html, body {
    overflow-x: hidden !important;
    width: 100%;
    position: relative;
}

/* Better mobile navigation */
@media (max-width: 768px) {
    .navbar-modern {
        transition: transform 0.3s ease;
    }
    
    .nav-toggle {
        cursor: pointer;
        touch-action: manipulation;
    }
    
    /* Ensure navigation items are easily tappable */
    .nav-link {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
    
    /* Prevent body scroll when menu is open */
    body.nav-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
    }
    
    /* Better mobile menu styling */
    .nav-menu {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Improve menu backdrop */
    .nav-menu::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(5px);
        z-index: -1;
    }
}

/* Fix common layout issues on mobile */
@media (max-width: 480px) {
    /* Prevent text from being too small */
    body {
        font-size: 16px;
    }
    
    /* Ensure buttons are large enough for touch */
    .btn, button, input[type="submit"] {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    /* Better form inputs on mobile */
    input, textarea, select {
        font-size: 16px;
        padding: 12px;
        border-radius: 8px;
        min-height: 48px;
    }
    
    /* Improve readability */
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.3;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    p {
        line-height: 1.6;
        margin-bottom: 1rem;
    }
}

/* Fix for very small devices */
@media (max-width: 320px) {
    .container {
        padding: 0 10px;
    }
    
    .hero-title {
        font-size: 1.6rem !important;
    }
    
    .section-header h2 {
        font-size: 1.4rem !important;
    }
    
    .btn {
        font-size: 14px;
        padding: 10px 16px;
        min-height: 44px;
    }
}

/* Landscape orientation fixes */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero-ai {
        padding: 30px 0 !important;
    }
    
    .section-header {
        margin-bottom: 30px;
    }
    
    .nav-menu {
        padding-top: 20px;
    }
    
    .nav-menu .nav-list {
        gap: 15px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .service-icon-9,
    .feature-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark mode system preference support */
@media (prefers-color-scheme: dark) {
    body:not(.light-theme) {
        color-scheme: dark;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Print optimizations */
@media print {
    .nav-menu,
    .nav-toggle,
    .theme-toggle,
    .floating-elements {
        display: none !important;
    }
    
    .hero-title,
    .section-header h2 {
        page-break-after: avoid;
    }
    
    .service-card-9,
    .feature-card {
        page-break-inside: avoid;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}

/* Accessibility improvements */
@media (min-width: 769px) {
    .nav-link:focus,
    .btn:focus,
    button:focus {
        outline: 2px solid #4F46E5;
        outline-offset: 2px;
    }
}

/* Better touch targets for mobile */
@media (max-width: 768px) {
    .social-links a,
    .nav-toggle,
    .faq-toggle {
        min-height: 48px;
        min-width: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Ensure adequate spacing between interactive elements */
    .hero-buttons > * + * {
        margin-top: 12px;
    }
    
    .nav-buttons > * + * {
        margin-right: 12px;
    }
    
    /* Better spacing for mobile forms */
    .contact-form .form-group + .form-group {
        margin-top: 20px;
    }
}

/* Fix potential overflow issues */
.service-card-9,
.feature-card,
.contact-card {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure videos are responsive */
.video-wrapper,
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
}

.video-wrapper iframe,
.video-wrapper video,
.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Better mobile chat interface */
@media (max-width: 480px) {
    .ai-chat-box {
        position: relative;
        width: 100%;
        margin: 10px 0;
    }
    
    .chat-messages {
        height: 200px;
        max-height: 40vh;
    }
    
    .chat-input-container input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}
