/* ==============================================
   Responsive Styles
   ============================================== */

/* Tablet Styles - 768px to 980px */
@media screen and (max-width: 980px) {
    .container {
        width: 90%;
    }
    
    /* Header */
    #main-header {
        padding: 10px 0;
    }
    
    /* Carousel Adjustments */
    .carousel-container {
        height: 550px;
    }
    
    .carousel-content h1 {
        font-size: 42px;
    }
    
    .carousel-content p {
        font-size: 22px;
    }
    
    .header-content {
        padding: 15px 0;
    }
    
    #nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        max-height: 100vh;
        background: var(--white);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 30px 30px;
        gap: 20px;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transition: var(--transition);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        z-index: 9999;
    }
    
    #nav-menu.active {
        right: 0;
    }
    
    #nav-menu li {
        width: 100%;
    }
    
    #nav-menu a {
        padding: 15px 0;
        font-size: 16px;
        border-bottom: 1px solid #eee;
    }
    
    .language-selector {
        width: 100%;
    }
    
    .language-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f5f5f5;
        margin-top: 10px;
        display: none;
    }
    
    .language-selector.active .language-dropdown {
        display: block;
    }
    
    .mobile-menu-toggle {
        display: flex;
        z-index: 100000;
        position: relative;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* Hero Section */
    .hero-section {
        margin-top: 70px;
        height: 500px;
    }
    
    .hero-title {
        font-size: 42px;
    }
    
    .hero-subtitle {
        font-size: 20px;
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    
    .service-item {
        padding: 30px 15px;
    }
    
    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* Industries */
    .industries-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Sections Padding */
    .services-section,
    .video-section,
    .gallery-section,
    .about-section,
    .industries-section {
        padding: 60px 0;
    }
    
    .cta-section {
        padding: 80px 0;
    }
}

/* Mobile Styles - 768px and below */
@media screen and (max-width: 767px) {
    /* Typography */
    h1 { font-size: 36px; }
    h2 { font-size: 28px; }
    h3 { font-size: 20px; }
    h4 { font-size: 16px; }
    
    /* Carousel Mobile Adjustments */
    .carousel-container {
        height: 450px;
        margin-top: -70px;
        padding-top: 70px;
    }
    
    .carousel-content h1 {
        font-size: 32px;
        line-height: 1.2;
    }
    
    .carousel-content p {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .carousel-arrow {
        display: none; /* Hide arrows on mobile */
    }
    
    .carousel-nav {
        bottom: 20px;
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .service-item {
        padding: 30px 20px;
    }
    
    /* Gallery */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .gallery-item img {
        height: 200px;
    }
    
    /* Industries */
    .industries-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-column {
        margin-bottom: 30px;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* Mobile Menu Scrolling Fix */
@media screen and (max-width: 980px) {
    /* Ensure menu content is scrollable */
    #nav-menu {
        display: flex !important;
        flex-direction: column !important;
        /* Add bottom padding to ensure last item is visible */
        padding-bottom: 50px !important;
    }
    
    /* Allow the menu itself to scroll */
    #nav-menu.active {
        overflow-y: scroll !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        /* Ensure menu doesn't exceed viewport */
        max-height: 100vh !important;
        max-height: 100dvh !important; /* Dynamic viewport height for mobile */
    }
    
    /* Optional: Add scrollbar styling for better visibility */
    #nav-menu::-webkit-scrollbar {
        width: 4px;
    }
    
    #nav-menu::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
    }
    
    #nav-menu::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 2px;
    }
}

/* Small Mobile Styles - 480px and below */
@media screen and (max-width: 479px) {
    .container {
        width: 95%;
    }
    
    /* Header */
    #logo {
        max-height: 40px;
    }
    
    #nav-menu {
        width: 100%;
        right: -100%;
        max-height: 100vh;
        height: 100vh;
    }
    
    /* Hero Section */
    .hero-section {
        height: 400px;
        margin-top: 60px;
    }
    
    .hero-title {
        font-size: 32px;
        margin-bottom: 15px;
    }
    
    .hero-subtitle {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .btn {
        padding: 10px 25px;
        font-size: 13px;
    }
    
    /* Services */
    .service-icon {
        font-size: 36px;
    }
    
    /* About */
    .about-content p {
        font-size: 14px;
    }
    
    /* CTA */
    .cta-section {
        padding: 60px 0;
        background-attachment: scroll;
    }
    
    .cta-content h2 {
        font-size: 28px;
    }
    
    .cta-content p {
        font-size: 16px;
    }
    
    /* Sections Padding */
    .services-section,
    .video-section,
    .gallery-section,
    .about-section,
    .industries-section {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 28px;
        margin-bottom: 30px;
    }
}

/* Extra Small Devices - 320px and below */
@media screen and (max-width: 320px) {
    .hero-title {
        font-size: 26px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .service-item {
        padding: 25px 15px;
    }
    
    .btn {
        padding: 8px 20px;
        font-size: 12px;
    }
}

/* Mobile Touch Device Fixes - Ensures arrows are accessible on actual mobile devices */
@media (hover: none) and (pointer: coarse) {
    /* Fix for gallery pagination buttons on touch devices */
    .gallery-pagination {
        padding: 0 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .pagination-btn {
        min-width: 55px !important;
        min-height: 50px !important;
        padding: 15px !important;
        background: rgba(0, 123, 255, 1) !important;
        border: 2px solid white !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
        position: relative !important;
        z-index: 100 !important;
    }
    
    .pagination-btn:active {
        transform: scale(0.95);
        background: rgba(0, 100, 200, 1) !important;
    }
    
    /* Ensure prev/next buttons stay within viewport */
    .pagination-btn.prev-btn {
        margin-left: 0;
    }
    
    .pagination-btn.next-btn {
        margin-right: 0;
    }
}

/* Samsung and other Android device specific fixes */
@media screen and (max-width: 412px) {
    /* Galaxy S23 and similar devices */
    .gallery-pagination {
        padding: 0 10px;
    }
    
    .pagination-btn {
        position: relative;
        flex-shrink: 0;
    }
}

/* Landscape Mode Adjustments */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .hero-section {
        height: 100vh;
        min-height: 400px;
    }
    
    #nav-menu {
        padding-top: 60px;
    }
}

/* High Resolution Displays */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    /* Ensure crisp images on retina displays */
    #logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    #main-header,
    .mobile-menu-toggle,
    .video-section,
    .cta-section,
    #main-footer .social-links {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }
    
    .container {
        width: 100%;
        max-width: none;
    }
    
    .hero-section {
        height: auto;
        margin-top: 0;
        padding: 30px 0;
        background: none !important;
    }
    
    .hero-overlay {
        display: none;
    }
    
    .hero-content {
        color: #000;
    }
    
    .hero-title,
    .hero-subtitle {
        color: #000;
        text-shadow: none;
    }
    
    .btn {
        display: none;
    }
    
    section {
        page-break-inside: avoid;
        padding: 20px 0;
    }
    
    h1, h2, h3, h4 {
        page-break-after: avoid;
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}
