/* ============================================
   XENONLABS RESPONSIVE STYLES
   Mobile-First Responsive Design System
   ============================================ */

/* Base Responsive Utilities */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Enhanced Container System */
.container-80 {
    width: 100%;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Prevent horizontal scroll on all screens */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    position: relative;
}

/* Mobile: < 768px */
@media (max-width: 767px) {
    /* Typography Adjustments */
    h1 {
        font-size: 1.875rem !important; /* 30px */
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.5rem !important; /* 24px */
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 1.25rem !important; /* 20px */
        line-height: 1.4 !important;
    }
    
    h4 {
        font-size: 1.125rem !important; /* 18px */
    }
    
    p, li, span {
        font-size: 0.9375rem !important; /* 15px */
        line-height: 1.6 !important;
    }
    
    /* Navigation Mobile Specific */
    nav .container-80 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Logo Sizing */
    nav img {
        height: 4rem !important; /* Larger logo on mobile for better visibility */
        width: auto;
        max-height: 4rem !important;
    }
    
    /* Mobile Navigation: FORCE show hamburger button, hide desktop menu */
    
    /* FORCE hide desktop navigation links on mobile */
    nav .space-x-8,
    nav > div > div > div.hidden {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* FORCE show the mobile menu button container */
    nav > div > div > div:last-child {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* FORCE show mobile menu button with high visibility */
    #mobile-menu-button {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 0.75rem !important;
        align-items: center;
        justify-content: center;
        min-width: 48px !important;
        min-height: 48px !important;
        cursor: pointer;
        background-color: rgba(30, 64, 175, 0.1) !important;
        border-radius: 0.5rem;
        border: 2px solid #1e40af !important;
        z-index: 999;
        position: relative;
    }
    
    /* FORCE style the hamburger icon to be clearly visible */
    #mobile-menu-button svg {
        width: 1.75rem !important;
        height: 1.75rem !important;
        color: #1e40af !important;
        display: block !important;
        stroke: #1e40af !important;
        stroke-width: 2.5 !important;
    }
    
    /* Mobile menu dropdown visibility controlled by JavaScript */
    #mobile-menu {
        width: 100%;
        position: relative;
        z-index: 998;
    }
    
    #mobile-menu.hidden {
        display: none !important;
    }
    
    #mobile-menu:not(.hidden) {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Mobile Menu Enhancements */
    #mobile-menu {
        max-height: calc(100vh - 180px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #mobile-menu a {
        font-size: 1rem;
        padding: 0.875rem 0.75rem;
    }
    
    /* Hero Section Mobile */
    .hero-container {
        min-height: 70vh !important;
        padding-top: 1rem;
        padding-bottom: 2rem;
    }
    
    .hero-container h1 {
        font-size: 1.75rem !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-container p {
        font-size: 1rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Grid Systems Mobile - Force all grids to single column */
    .grid,
    [class*="grid-cols"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Card Spacing */
    .bg-white.rounded-xl,
    .bg-gray-800.rounded-xl {
        margin-bottom: 1.5rem;
    }
    
    /* Modal Mobile Adjustments */
    .modal {
        padding: 0.5rem !important;
        align-items: flex-start !important;
        padding-top: 2rem !important;
    }
    
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 0 auto !important;
        max-height: calc(100vh - 4rem) !important;
        overflow-y: auto !important;
    }
    
    .modal .p-6,
    .modal .p-8 {
        padding: 1rem !important;
    }
    
    /* Contact Modal Specific */
    #contactModal .modal-content {
        max-height: calc(100vh - 4rem) !important;
    }
    
    #contactModal .bg-gradient-to-r {
        padding: 1rem !important;
    }
    
    #contactModal h2 {
        font-size: 1.25rem !important;
    }
    
    #contactModal form {
        max-height: calc(100vh - 12rem) !important;
        overflow-y: auto !important;
    }
    
    #contactModal .space-y-4 {
        gap: 0.75rem !important;
    }
    
    #contactModal label {
        font-size: 0.875rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    #contactModal input,
    #contactModal textarea {
        padding: 0.625rem !important;
    }
    
    #contactModal textarea {
        min-height: 80px !important;
        max-height: 120px !important;
    }
    
    #contactModal .flex.justify-end {
        margin-top: 0.75rem !important;
        padding-top: 0.75rem !important;
    }
    
    #contactModal button {
        padding: 0.625rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Form Elements Mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important; /* Prevent zoom on iOS */
        width: 100%;
    }
    
    button {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        min-height: 48px; /* Touch-friendly */
    }
    
    /* Flex Direction Mobile - Force all flex-row to column */
    .flex.flex-col.md\:flex-row,
    [class*="flex-row"] {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    /* Spacing Adjustments */
    .py-16 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .py-8 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .mb-12 {
        margin-bottom: 2rem !important;
    }
    
    .gap-8 {
        gap: 1.5rem !important;
    }
    
    /* Table Responsive */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    
    /* Product Cards Mobile */
    .client-logo-item {
        width: 100%;
        padding: 0.5rem;
    }
    
    /* Tab Navigation Mobile - Enhanced */
    .inline-flex.rounded-lg {
        flex-wrap: wrap !important;
        width: 100% !important;
        padding: 0.5rem !important;
        gap: 0.5rem !important;
    }
    
    .tab-button {
        font-size: 0.75rem !important; /* 12px */
        padding: 0.5rem 0.5rem !important;
        white-space: normal !important;
        text-align: center !important;
        flex: 1 1 auto !important;
        min-width: calc(50% - 0.25rem) !important;
        max-width: calc(50% - 0.25rem) !important;
    }
    
    .tab-button span {
        flex-direction: column !important;
        gap: 0.25rem !important;
        align-items: center !important;
    }
    
    .tab-button svg {
        width: 1rem !important;
        height: 1rem !important;
    }
    
    /* Newsletter Section Mobile */
    .newsletter form,
    form.flex.flex-col.sm\:flex-row {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .newsletter input,
    .newsletter button {
        width: 100%;
    }
    
    /* Contact Banner Mobile */
    .contact-banner .flex {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    /* Info Top Bar Mobile */
    .info-top-bar {
        font-size: 0.8125rem !important;
    }
    
    .info-top-bar .info-container {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }
    
    .info-top-bar .info-contacts {
        flex-direction: column;
        gap: 0.375rem;
        width: 100%;
    }
    
    .info-top-bar .info-contacts span {
        font-size: 0.8125rem;
    }
    
    .info-top-bar .info-socials {
        margin-top: 0.375rem;
    }
    
    /* Body Padding Adjustment */
    body {
        padding-top: 6rem !important; /* More space for larger mobile top bar */
    }
    
    /* Navigation Position */
    nav {
        top: 4.5rem !important; /* Adjust for mobile top bar */
    }
    
    /* Adjust height for mobile */
    nav .flex {
        height: 4rem !important;
    }
    
    /* Hide desktop elements on mobile */
    .hidden-mobile {
        display: none !important;
    }
    
    /* Better spacing for sections */
    section {
        scroll-margin-top: 8rem;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Improved button groups */
    .space-x-3,
    .space-x-4,
    .space-x-8 {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .space-x-3 > *,
    .space-x-4 > *,
    .space-x-8 > * {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }
    
    /* Image optimization for mobile */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
    
    /* Dropdown menus mobile */
    .group .absolute {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin-top: 0.5rem;
    }
    
    /* Ensure containers don't overflow */
    .container-80,
    .container,
    section,
    div {
        max-width: 100vw !important;
    }
    
    /* Fix tab navigation container */
    .flex.justify-center {
        padding: 0 0.5rem !important;
    }
    
    /* Hero section improvements */
    .hero-container .flex.items-center.space-x-2 {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .hero-container .flex.items-center.space-x-2 button,
    .hero-container .flex.items-center.space-x-2 a {
        width: 100% !important;
    }
    
    /* CTA buttons in hero */
    .hero-container .bg-gradient-to-r {
        padding: 1.5rem !important;
    }
    
    .hero-container .text-2xl,
    .hero-container .text-3xl {
        font-size: 1.25rem !important;
    }
    
    /* Logo height fix */
    img[alt*="Logo"],
    img[alt*="logo"] {
        max-height: 3rem !important;
    }
    
    /* Better card layouts */
    .rounded-xl,
    .rounded-2xl {
        border-radius: 0.75rem !important;
    }
    
    /* Portfolio and feature cards */
    .bg-white.rounded-xl.shadow-lg,
    .bg-gray-800.rounded-xl.shadow-lg {
        padding: 1rem !important;
    }
    
    /* Text alignment on mobile */
    .text-center {
        text-align: center !important;
    }
    
    /* Better handling of long text */
    p, span, li {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

/* Tablet: 768px - 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
    .container-80 {
        width: 90%;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    /* Typography Tablet */
    h1 {
        font-size: 2.5rem !important;
    }
    
    h2 {
        font-size: 2rem !important;
    }
    
    h3 {
        font-size: 1.5rem !important;
    }
    
    /* Grid adjustments for tablet */
    .md\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Hero Section Tablet */
    .hero-container {
        min-height: 80vh;
    }
    
    /* Navigation Tablet */
    nav img {
        height: 4.5rem;
    }
    
    /* Tab buttons on tablet */
    .tab-button {
        font-size: 0.875rem !important;
        padding: 0.625rem 1rem !important;
    }
}

/* Desktop: >= 1024px */
@media (min-width: 1024px) {
    .container-80 {
        width: 85%;
    }
    
    /* Body padding for desktop */
    body {
        padding-top: 2.5rem;
    }
    
    /* Navigation for desktop */
    nav {
        top: 2.5rem;
    }
}

/* Large Desktop: >= 1280px */
@media (min-width: 1280px) {
    .container-80 {
        width: 80%;
    }
}

/* Extra Large Desktop: >= 1536px */
@media (min-width: 1536px) {
    .container-80 {
        max-width: 1400px;
    }
}

/* Landscape Mobile Devices */
@media (max-width: 896px) and (orientation: landscape) {
    .hero-container {
        min-height: 100vh !important;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    nav {
        position: fixed;
        z-index: 100;
    }
    
    body {
        padding-top: 7rem !important;
    }
    
    /* Reduce section padding in landscape */
    .py-16 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* Touch Device Improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    button,
    a,
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better tap highlights */
    a, button {
        -webkit-tap-highlight-color: rgba(30, 64, 175, 0.3);
    }
    
    /* Smooth scrolling on touch devices */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

/* Print Styles */
@media print {
    .info-top-bar,
    nav,
    #footer-placeholder,
    .modal,
    button:not(.print-visible) {
        display: none !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    button,
    a {
        border: 2px solid currentColor;
    }
}

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Additional Mobile Refinements for Very Small Screens */
@media (max-width: 374px) {
    /* Extra small phones */
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    .tab-button {
        font-size: 0.7rem !important;
        padding: 0.4rem !important;
    }
    
    .container-80 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}
