/* ============================================
   Mobile Responsive Enhancement Patch
   ZZSL-PCL Industrial Automation Website
   ============================================ */

/* 
 * Mobile Touch Target Standards:
 * - All buttons/links: min 44x44px (Apple HIG & WCAG)
 * - Font sizes: min 14px for body, 16px preferred
 * - Input fields: min 44px height
 */

/* Enhanced Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 12px;
    cursor: pointer;
    border-radius: 8px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.mobile-menu-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.mobile-menu-btn:active {
    background-color: rgba(0, 0, 0, 0.1);
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--gray-700);
    margin: 5px 0;
    transition: all var(--transition-base);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Enhanced Mobile Search */
.header-search {
    position: relative;
    margin: 0 var(--space-lg);
    flex: 1;
    max-width: 300px;
}

.header-search form {
    display: flex;
    align-items: center;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0 12px;
    transition: all var(--transition-base);
    min-height: 44px;
}

.header-search form:focus-within {
    border-color: var(--primary-light);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.header-search input {
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 14px;
    width: 200px;
    outline: none;
    color: var(--gray-900);
    min-height: 44px;
}

.header-search input::placeholder {
    color: var(--gray-500);
}

.header-search button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--gray-500);
    transition: color var(--transition-base);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-search button:hover {
    color: var(--primary-light);
}

/* Enhanced Mobile Navigation */
.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    list-style: none;
}

.nav-menu a {
    color: var(--gray-700);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-light);
    transition: width var(--transition-base);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-light);
}

/* Mobile Menu Active State */
.nav-menu.active {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    padding: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 1000;
    gap: 0.5rem;
}

.nav-menu.active a {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    min-height: 44px;
}

.nav-menu.active a:hover,
.nav-menu.active a.active {
    background: var(--gray-100);
    color: var(--primary-light);
}

.nav-menu.active a::after {
    display: none;
}

/* Enhanced Mobile Buttons */
.btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1.5rem;
    font-size: 14px;
}

.btn-sm {
    min-height: 36px;
    padding: 0.5rem 1rem;
    font-size: 14px;
}

.btn-lg {
    min-height: 52px;
    padding: 1rem 2rem;
    font-size: 16px;
}

/* Mobile Form Inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="password"],
textarea,
select {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px; /* 16px prevents iOS zoom on focus */
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Mobile Cards */
.product-card,
.brand-card,
.case-card,
.feature-card,
.blog-card {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Enhanced Mobile Footer Links */
.footer-links a,
.footer-column a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
}

/* WhatsApp Float Button - Mobile Optimized */
.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 44px;
    min-height: 44px;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
}

.whatsapp-float:active {
    transform: scale(0.95);
}

.whatsapp-float svg {
    width: 28px;
    height: 28px;
    color: var(--white);
}

/* ============================================
   Enhanced Mobile Media Queries
   ============================================ */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .hero-image {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .about-grid,
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .header-search {
        flex: 1;
        max-width: 250px;
    }
    
    .header-search input {
        width: 150px;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    
    /* Header */
    .header-topbar {
        display: none;
    }
    
    .nav-menu {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .header-search {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin: 0;
        padding: 1rem;
        background: #fff;
        border-bottom: 1px solid var(--gray-200);
        display: none;
        max-width: none;
    }
    
    .header-search.active {
        display: block;
    }
    
    .header-search form {
        width: 100%;
        max-width: none;
    }
    
    .header-search input {
        width: 100%;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .header-cta .btn {
        display: none;
    }
    
    /* Hero */
    .hero {
        padding-top: 100px;
        padding-bottom: var(--space-3xl);
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .stat-item {
        display: flex;
        align-items: center;
        gap: var(--space-md);
        text-align: left;
    }
    
    /* Grids */
    .about-features {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
    
    /* Product Cards */
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-footer {
        flex-direction: column;
        gap: 1rem;
    }
    
    .product-actions {
        width: 100%;
    }
    
    .product-actions .btn {
        flex: 1;
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }
    
    /* Search Page */
    .search-filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    /* Trust Section */
    .trust-items {
        gap: 1rem;
    }
    
    .trust-item {
        font-size: 0.875rem;
    }
    
    .trust-grid {
        grid-template-columns: 1fr;
    }
    
    .testimonials-grid {
        grid-template-columns: 1fr;
    }
    
    /* Page Header */
    .page-header {
        padding: 80px 0 40px;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    /* Contact Form */
    .contact-form {
        padding: 1.5rem;
    }
    
    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Blog */
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-featured {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    /* Case Studies */
    .case-studies-grid {
        grid-template-columns: 1fr;
    }
    
    /* Brand Grid */
    .brands-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* FAQ */
    .faq-item {
        padding: 1rem;
    }
    
    .faq-question {
        font-size: 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Modal */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Stats */
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-box {
        padding: 1rem;
    }
    
    /* Process Steps */
    .process-steps {
        flex-direction: column;
    }
    
    .process-step {
        width: 100%;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-md);
    }
    
    .section {
        padding: var(--space-3xl) 0;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .brands-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .whatsapp-float {
        bottom: 15px;
        right: 15px;
        width: 52px;
        height: 52px;
    }
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .whatsapp-float {
        bottom: max(20px, env(safe-area-inset-bottom));
        right: max(20px, env(safe-area-inset-right));
    }
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
}

/* Smooth scrolling for anchor links */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .header-search form {
        border-width: 2px;
    }
}

/* 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;
    }
}

/* Print styles */
@media print {
    .header,
    .whatsapp-float,
    .mobile-menu-btn {
        display: none !important;
    }
    
    body {
        padding-top: 0;
    }
}
