/* Additional Responsive Improvements */

/* Navbar Scroll Effect */
.navbar.scrolled {
    padding: 15px 0;
    background: rgba(10, 14, 39, 0.98) !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Smooth transitions for all elements */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Improved touch targets for mobile */
@media (max-width: 968px) {
    .btn {
        min-height: 48px;
    }
    
    .nav-links a {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

/* Landscape mode for tablets */
@media (max-width: 968px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 100px 0 60px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .section {
        padding: 50px 0;
    }
}

/* Contact form improvements for mobile */
@media (max-width: 640px) {
    .form-group input,
    .form-group textarea {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: 10px;
    }
    
    .form-group input:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: var(--primary-color);
    }
}

/* Better hover states for touch devices */
@media (hover: none) {
    .service-card:hover,
    .portfolio-item:hover,
    .team-member:hover,
    .stat-card:hover {
        transform: none;
    }
    
    .service-card:active,
    .portfolio-item:active,
    .team-member:active,
    .stat-card:active {
        transform: scale(0.98);
    }
}

/* Improved floating cards for tablets */
@media (max-width: 968px) and (min-width: 641px) {
    .floating-card {
        position: relative !important;
        margin: 15px auto;
        max-width: 300px;
    }
    
    .card-1, .card-2, .card-3 {
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
    }
    
    .hero-image {
        display: flex;
        flex-direction: column;
        gap: 20px;
        height: auto;
    }
}

/* Optimize animations for lower-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Improve readability on small screens */
@media (max-width: 640px) {
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    p {
        line-height: 1.8;
    }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .modal {
        -webkit-overflow-scrolling: touch;
    }
    
    .navbar {
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Landscape improvements for phones */
@media (max-width: 640px) and (orientation: landscape) {
    .hero {
        padding: 80px 0 40px;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .modal-body {
        padding: 15px;
    }
}

/* Better portfolio grid for tablets */
@media (min-width: 641px) and (max-width: 968px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .portfolio-item {
        height: 280px;
    }
}

/* Improved team grid for tablets */
@media (min-width: 641px) and (max-width: 968px) {
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* Better stats layout for tablets */
@media (min-width: 641px) and (max-width: 968px) {
    .about-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile menu improvements */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--card-bg);
        flex-direction: column;
        padding: 80px 30px 30px;
        gap: 20px;
        transition: left 0.3s ease;
        z-index: 999;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .nav-links.active {
        left: 0;
    }
    
    .nav-links a {
        font-size: 18px;
        padding: 12px 0;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Ensure images don't overflow on mobile */
@media (max-width: 640px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    .portfolio-item img {
        object-fit: cover;
        width: 100%;
        height: 100%;
    }
}

/* Improve button spacing on mobile */
@media (max-width: 480px) {
    .hero-buttons {
        gap: 12px;
    }
    
    .btn {
        padding: 14px 28px;
        font-size: 15px;
    }
}

/* Better service cards on mobile */
@media (max-width: 640px) {
    .service-card {
        min-height: auto;
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
}

/* Optimize contact section for mobile */
@media (max-width: 640px) {
    .contact-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .info-item {
        padding: 20px;
        text-align: center;
    }
    
    .info-icon {
        margin: 0 auto 12px;
    }
}

/* Fix footer on mobile */
@media (max-width: 640px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    .footer-section h3 {
        margin-bottom: 15px;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
    max-width: 100vw;
}

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

/* Better touch feedback */
@media (max-width: 768px) {
    .btn:active,
    .portfolio-link:active,
    .back-button:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
    
    .gallery-item:active {
        transform: scale(0.98);
    }
}
