/* =========================================
   Amex Resources - Comprehensive Responsive CSS
   ========================================= */

/* -------------------------------------------------------------------------- */
/* 1. Base Responsive Typography & Layout (Mobile First defaults in main.css) */
/* -------------------------------------------------------------------------- */

/* Default Container Padding for Mobile */
.container {
    padding-left: 20px;
    padding-right: 20px;
    width: 100%;
}

/* Base Font Size Adjustments for Mobile */
html {
    font-size: 14px; /* Slightly smaller base on mobile */
}

h1, .hero-title { font-size: 2.2rem !important; line-height: 1.2; }
h2, .section-title { font-size: 1.8rem !important; }
h3 { font-size: 1.5rem !important; }
p { font-size: 1rem !important; }
.product-card .product-description { font-size: 0.9rem !important; line-height: 1.4; }

/* -------------------------------------------------------------------------- */
/* 2. Media Queries */
/* -------------------------------------------------------------------------- */

/* Small Devices (Landscape Phones, 576px and up) */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
        margin: 0 auto;
    }
    
    html { font-size: 15px; }
    
    h1, .hero-title { font-size: 2.5rem !important; }
    h2, .section-title { font-size: 2rem !important; }
}

@media (max-width: 480px) {
    .product-card .product-description { font-size: 0.75rem !important;text-align: center justify; line-height: 1.2; }
}

/* Medium Devices (Tablets, 768px and up) */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }

    html { font-size: 16px; }

    h1, .hero-title { font-size: 3rem !important; }
    h2, .section-title { font-size: 2.5rem !important; }
    h3 { font-size: 1.75rem !important; }
    .product-card .product-description { font-size: 0.64rem !important; line-height: 1.25; }
}

/* Large Devices (Desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

/* Extra Large Devices (Large Desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    h1, .hero-title { font-size: 3.5rem !important; }
    h2, .section-title { font-size: 3rem !important; }
}

/* -------------------------------------------------------------------------- */
/* 3. Header & Navigation Responsive */
/* -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    /* Hide Desktop Nav */
    .header .nav {
        display: none !important;
    }

    /* Show Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 25px;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 1100;
        padding: 0;
    }

    .mobile-menu-toggle span {
        width: 100%;
        height: 3px;
        background: var(--primary-color, #0a1b2b);
        border-radius: 2px;
        transition: all 0.3s linear;
    }

    /* Adjust Logo Size */
    .header .logo-img {
        height: 35px; /* Smaller logo on mobile */
    }
    
    .header-content {
        padding: 15px 0;
    }

    /* Mobile Nav Overlay (defer layout to header-footer.css to avoid conflicts) */
    .mobile-nav {
        width: 100vw;
        height: 100vh;
        overflow-y: auto;
    }

    .mobile-nav-content {
        padding: 16px 16px 24px;
        text-align: left;
    }

    .mobile-nav-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .mobile-nav-list li a {
        font-size: 1.2rem;
        color: var(--text-dark, #333);
        text-decoration: none;
        font-weight: 600;
        display: block;
        padding: 10px;
        border-bottom: none;
    }
    
    .mobile-nav-list li a.active {
        color: var(--accent-color, #007bff);
    }

    /* Fix for Header Gap on Mobile (Transparent Header for Dark Hero Pages) */
    body.who-we-are-page .header:not(.scrolled),
    body.what-we-do-page .header:not(.scrolled),
    body.why-choose-us-page .header:not(.scrolled),
    body.contact-page .header:not(.scrolled),
    body.products-page .header:not(.scrolled) {
        background: transparent !important;
        box-shadow: none !important;
        border-bottom: auto solid rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: none !important;
    }

    /* Ensure menu toggle is white on dark background (when not scrolled) */
    body.who-we-are-page .header:not(.scrolled) .mobile-menu-toggle span,
    body.what-we-do-page .header:not(.scrolled) .mobile-menu-toggle span,
    body.why-choose-us-page .header:not(.scrolled) .mobile-menu-toggle span,
    body.contact-page .header:not(.scrolled) .mobile-menu-toggle span,
    body.products-page .header:not(.scrolled) .mobile-menu-toggle span {
        background: #000000 !important;
    }
}

/* -------------------------------------------------------------------------- */
/* 4. Hero Sections (Home & Product Pages) */
/* -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    /* Product Detail Hero */
    .product-hero {
        padding: 72px 0 40px;
        min-height: auto;
        text-align: center;
    }

    .product-hero-content {
        grid-template-columns: 1fr; /* Stack vertically */
        gap: 40px;
    }

    .hero-text {
        order: 1; /* Text first */
        text-align: center;
    }
    
    .hero-text h1 {
        text-align: center;
        margin-bottom: 1rem;
    }

    .hero-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero-visual {
        order: 2; /* Image second */
        height: 240px;
        margin-top: 20px;
    }
    
    /* Home Hero */
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        padding-top: 40px;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .hero-stats {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .product-hero {
        padding: 56px 0 30px;
    }
    
    .hero-visual {
        height: 200px;
    }
    
    .hero-buttons .btn-white,
    .hero-buttons .btn-outline-white {
        width: 100%; /* Full width buttons on mobile */
        text-align: center;
        padding: 12px 20px;
    }
}

/* -------------------------------------------------------------------------- */
/* 5. Product Detail Sections (Overview, Forms, Specs) */
/* -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    /* Overview Section */
    .overview-grid {
        grid-template-columns: 1fr; /* Stack content and quick specs */
        gap: 40px;
    }

    .overview-content h3 {
        text-align: center;
    }
    
    .quick-specs {
        margin: 0 auto;
        max-width: 500px;
        width: 100%;
    }

    /* Forms Grid (Flip Cards) */
    .flip-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Auto-fit but min 280px */
        gap: 20px;
        padding: 0;
    }
}

@media (max-width: 768px) {
    /* Applications Section - Horizontal Scroll Override */
    .applications-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important; /* Ensure it starts from the first card */
        gap: 20px;
        overflow-x: auto;
        padding-bottom: 20px;
        scroll-snap-type: x mandatory;
        scroll-padding-left: 55px;
        -webkit-overflow-scrolling: touch;
        margin-top: 2rem;
        padding-left: 55px;
        padding-right: 55px;
        margin-left: -20px;
        margin-right: -20px;
        width: calc(100% + 40px);
        /* Reset grid properties */
        grid-template-columns: none !important;
    }
    
    .applications-grid::-webkit-scrollbar {
        display: none;
    }

    .application-card {
        flex: 0 0 65vw !important;
        width: 65vw !important;
        max-width: none !important;
        min-width: auto !important;
        scroll-snap-align: start;
        margin-top: 0 !important;
        margin-bottom: 0;
    }
    
    /* Technical Specs Table - No scroll bar, full width layout */
    .specs-table {
        border-radius: 10px;
        overflow-x: visible; /* Remove scroll bar */
        display: block;
        width: 100%;
    }
    
    .specs-table table {
        min-width: 0; /* Remove forced min-width */
        width: 100%; /* Full width */
        display: table; /* Reset display to table */
        white-space: normal; /* Allow text wrapping */
    }

    .specs-table th, 
    .specs-table td {
        white-space: normal; /* Allow text wrapping in cells */
        padding: 8px 4px; /* Reduce padding to fit */
        font-size: 0.8rem; /* Slightly smaller font */
    }
}

@media (max-width: 576px) {
    /* Applications Section handled by 768px rule above */
    
    .flip-card {
        height: 400px; /* Taller for mobile content */
    }
    
    .forms-section .section-title {
        margin-bottom: 2rem;
    }
    
    /* Related Products - Handled by product-detail.css mobile rules now */
    .related-grid {
        display: flex !important;
        grid-template-columns: none !important;
        overflow-x: auto;
    }
}

/* -------------------------------------------------------------------------- */
/* 6. Footer Responsive */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr; /* Stack footer columns */
        text-align: center;
        gap: 40px;
    }

    .footer-section {
        margin-bottom: 20px;
    }

    .footer-contact-item {
        justify-content: center;
    }

    .social-links {
        justify-content: center;
    }

    .footer-bottom-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* -------------------------------------------------------------------------- */
/* 7. Forms & Contact Page */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .contact-hero-content {
        grid-template-columns: 1fr;
    }
}

/* -------------------------------------------------------------------------- */
/* 8. Global Utility Fixes */
/* -------------------------------------------------------------------------- */

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

/* Prevent horizontal overflow */
body, html {
    overflow-x: hidden;
    width: 100%;
}

/* Fix for flip card images on mobile */
@media (max-width: 480px) {
    .circular-badge {
        width: 100%;
        max-width: 250px;
        height: auto;
        aspect-ratio: 4/3;
    }
    
    .forms-section .form-icon {
        width: 100% !important;
        height: auto !important;
    }
}

/* Floating Buttons Mobile Position */
@media (max-width: 768px) {
    .floating-buttons {
        bottom: 20px;
        right: 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .floating-btn {
        width: 45px;
        height: 45px;
    }
}

/* -------------------------------------------------------------------------- */
/* 9. Products Page Grid (products.php) */
/* -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    .product-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 576px) {
    .product-categories {
        grid-template-columns: 1fr; /* 1 column for products on mobile */
    }

    .category-card {
        max-width: 100%;
    }
    
    .category-content {
        padding: 20px;
    }
}

/* -------------------------------------------------------------------------- */
/* 10. What We Do Page (Timeline & Process) */
/* -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    .process-flow {
        flex-direction: column;
        gap: 30px;
    }
    
    .process-step {
        width: 100%;
        max-width: 100%;
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }
    
    .step-number {
        margin: 0 auto 20px;
    }
    
    .step-content {
        width: 100% !important;
        text-align: center;
    }
    
    .step-content h3 {
        text-align: center !important;
    }
    
    .step-content p {
        text-align: center !important;
    }
    
    .step-features {
        justify-content: center;
    }

    .process-arrow {
        transform: rotate(90deg); /* Point down instead of right */
        margin: 10px auto;
    }
    
    .commodity-animation {
        height: 300px; /* Smaller animation area */
    }
}

@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .empowerment-grid {
        grid-template-columns: 1fr;
    }
}

/* -------------------------------------------------------------------------- */
/* 11. Who We Are Page */
/* -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    .about-hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .mission-vision-grid {
        grid-template-columns: 1fr;
    }
    
    .values-grid {
        grid-template-columns: 1fr;
    }
    
    .global-presence-content {
        grid-template-columns: 1fr;
    }
    
    .map-container {
        height: 300px; /* Smaller map on mobile */
    }
}

/* -------------------------------------------------------------------------- */
/* 12. Contact Page Specifics */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .contact-wrapper {
        padding: 0;
    }
    
    .contact-info-card {
        margin-bottom: 30px;
    }
    
    .map-frame {
        height: 300px;
    }
}

/* -------------------------------------------------------------------------- */
/* 13. General Table Responsiveness (for any data tables) */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    /* General table scroll wrapper */
    .specs-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none;  /* IE and Edge */
        padding-bottom: 10px; /* Space for potential scrollbar interaction zone */
    }

    /* Hide scrollbar for Chrome, Safari and Opera */
    .specs-table::-webkit-scrollbar {
        display: none;
    }

    /* Reset table to behave like a table inside the wrapper */
    .specs-table table {
        display: table;
        width: auto;
        min-width: 100%;
        white-space: nowrap;
        border-collapse: collapse;
    }

    /* Cell styling for mobile */
    .specs-table td, 
    .specs-table th {
        min-width: 150px;
        vertical-align: middle;
        padding: 1rem 1.5rem;
    }

    /* Specific column adjustments - Optional tweaks if needed, but defaults should work */
    .specs-table td:first-child,
    .specs-table th:first-child {
        min-width: 120px;
    }
}

/* -------------------------------------------------------------------------- */
/* 14. Additional Product Detail Responsive Tweaks */
/* -------------------------------------------------------------------------- */

@media (max-width: 1024px) and (min-width: 769px) {
    .flip-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .application-card {
        flex: 0 0 calc(33.333% - 1rem);
        max-width: 280px;
    }
    
    .application-card:nth-child(6) {
        flex: 0 0 calc(33.333% - 1rem);
        margin-top: 0;
    }
}

@media (max-width: 768px) {
    .applications-section {
        padding: 4rem 0;
    }

    .applications-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 2rem;
        padding: 0 1rem;
    }

    .application-card {
        max-width: none;
        padding: 2rem;
    }

    .product-hero-content {
        gap: 2rem;
    }

    .cta-buttons {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        gap: 12px;
    }
    
    .flip-cards-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .flip-card {
        height: 350px;
    }
    
    .circular-badge {
        width: 100px;
        height: 100px;
    }
    
    .purity-text {
        font-size: 1.1rem;
    }
    
    .card-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .applications-section .section-title {
        font-size: 2rem;
    }
    
    .applications-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .application-card {
        padding: 1.5rem;
    }
    
    .app-icon {
        font-size: 2.5rem;
    }
}

/* -------------------------------------------------------------------------- */
/* 15. Drag Scroll Cursors (Mobile/Tablet Interaction) */
/* -------------------------------------------------------------------------- */
.flip-cards-grid, 
.advantages-grid,
.applications-grid, 
.related-grid, 
.features-grid-redesigned, 
.products-grid-redesigned {
    cursor: grab;
}

.flip-cards-grid.active, 
.advantages-grid.active,
.applications-grid.active, 
.related-grid.active, 
.features-grid-redesigned.active, 
.products-grid-redesigned.active {
    cursor: grabbing;
    cursor: -webkit-grabbing;
    user-select: none;
    -webkit-user-select: none;
}
