/* ============================================
   MOBILE OPTIMIZATION CSS
   Pulosarok Village Website
   Enhanced Mobile Layout for 2x2 Grid
   ============================================ */

/* Mobile Navigation Enhancements */
@media (max-width: 1023px) {
    /* Mobile menu button styling */
    .mobile-menu-button {
        position: relative;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 1001;
    }
    
    .mobile-menu-button:focus {
        outline: 2px solid #3B82F6;
        outline-offset: 2px;
    }
    
    /* Hamburger icon animation */
    .hamburger-icon {
        width: 24px;
        height: 18px;
        position: relative;
        transform: rotate(0deg);
        transition: 0.3s ease-in-out;
        cursor: pointer;
    }
    
    .hamburger-icon span {
        display: block;
        position: absolute;
        height: 3px;
        width: 100%;
        background: #374151;
        border-radius: 2px;
        opacity: 1;
        left: 0;
        transform: rotate(0deg);
        transition: 0.25s ease-in-out;
    }
    
    .hamburger-icon span:nth-child(1) {
        top: 0px;
    }
    
    .hamburger-icon span:nth-child(2) {
        top: 7px;
    }
    
    .hamburger-icon span:nth-child(3) {
        top: 14px;
    }
    
    /* Hamburger animation when menu is open */
    .hamburger-icon.open span:nth-child(1) {
        top: 7px;
        transform: rotate(135deg);
    }
    
    .hamburger-icon.open span:nth-child(2) {
        opacity: 0;
        left: -60px;
    }
    
    .hamburger-icon.open span:nth-child(3) {
        top: 7px;
        transform: rotate(-135deg);
    }
    
    /* Mobile menu submenu support */
    .mobile-menu .has-submenu > a::after {
        content: '\f107';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        margin-left: auto;
        transition: transform 0.2s;
    }
    
    .mobile-menu .has-submenu.open > a::after {
        transform: rotate(180deg);
    }
    
    .mobile-menu .submenu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
        background: #f9fafb;
    }
    
    .dark .mobile-menu .submenu {
        background: #374151;
    }
    
    .mobile-menu .submenu.open {
        max-height: 300px;
    }
    
    .mobile-menu .submenu a {
        padding-left: 48px;
        font-size: 14px;
        color: #6b7280;
    }
    
    .dark .mobile-menu .submenu a {
        color: #9ca3af;
    }
    
    .mobile-menu .submenu a:hover {
        color: #3b82f6;
        background: #f3f4f6;
    }
    
    .dark .mobile-menu .submenu a:hover {
        color: #60a5fa;
        background: #4b5563;
    }
}

/* Mobile-first responsive design */
@media (max-width: 640px) {
    /* News Section - 2x2 Mobile Layout */
    .news-grid-mobile {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .news-card-mobile {
        min-height: 200px;
        max-height: 250px;
    }
    
    .news-image-mobile {
        height: 80px;
        object-fit: cover;
    }
    
    .news-content-mobile {
        padding: 8px;
    }
    
    .news-title-mobile {
        font-size: 12px;
        line-height: 1.3;
        margin-bottom: 4px;
    }
    
    .news-excerpt-mobile {
        font-size: 10px;
        line-height: 1.2;
        margin-bottom: 6px;
    }
    
    .news-meta-mobile {
        font-size: 9px;
        padding-top: 6px;
    }
    
    /* Business Section - 2x2 Mobile Layout */
    .business-grid-mobile {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .business-card-mobile {
        min-height: 200px;
        max-height: 250px;
    }
    
    .business-image-mobile {
        height: 80px;
        object-fit: cover;
    }
    
    .business-content-mobile {
        padding: 8px;
    }
    
    .business-title-mobile {
        font-size: 12px;
        line-height: 1.3;
        margin-bottom: 4px;
    }
    
    .business-description-mobile {
        font-size: 10px;
        line-height: 1.2;
        margin-bottom: 6px;
    }
    
    .business-meta-mobile {
        font-size: 9px;
        padding-top: 6px;
    }
    
    /* Tourism Section - 2x2 Mobile Layout */
    .tourism-grid-mobile {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .tourism-card-mobile {
        min-height: 200px;
        max-height: 250px;
    }
    
    .tourism-image-mobile {
        height: 80px;
        object-fit: cover;
    }
    
    .tourism-content-mobile {
        padding: 8px;
    }
    
    .tourism-title-mobile {
        font-size: 12px;
        line-height: 1.3;
        margin-bottom: 4px;
    }
    
    .tourism-description-mobile {
        font-size: 10px;
        line-height: 1.2;
        margin-bottom: 6px;
    }
    
    .tourism-meta-mobile {
        font-size: 9px;
        padding-top: 6px;
    }
    
    /* General Mobile Optimizations */
    .mobile-text-xs {
        font-size: 10px;
    }
    
    .mobile-text-sm {
        font-size: 12px;
    }
    
    .mobile-p-2 {
        padding: 8px;
    }
    
    .mobile-gap-2 {
        gap: 8px;
    }
    
    /* Ensure proper touch targets */
    .mobile-touch-target {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Optimize images for mobile */
    .mobile-image {
        width: 100%;
        height: auto;
        object-fit: cover;
    }
    
    /* Reduce margins and padding for mobile */
    .mobile-section {
        padding: 16px 12px;
    }
    
    .mobile-card {
        margin-bottom: 12px;
    }
    
    /* Mobile-specific line clamping */
    .mobile-line-clamp-2 {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .mobile-line-clamp-3 {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* Mobile Footer Optimizations */
    .mobile-footer {
        padding: 16px 0;
    }
    
    .mobile-footer .footer-logo {
        height: 24px;
        width: auto;
    }
    
    .mobile-footer .footer-title {
        font-size: 14px;
        font-weight: 600;
    }
    
    .mobile-footer .footer-description {
        font-size: 12px;
        line-height: 1.4;
        margin-bottom: 12px;
    }
    
    .mobile-footer .social-icons {
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .mobile-footer .social-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .mobile-footer .contact-item {
        margin-bottom: 8px;
        font-size: 12px;
    }
    
    .mobile-footer .contact-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .mobile-footer .footer-bottom {
        margin-top: 12px;
        padding-top: 8px;
        font-size: 10px;
    }
    
    .mobile-footer .footer-links {
        gap: 12px;
        font-size: 10px;
    }
    
    /* Mobile Contact Section Optimizations */
    .mobile-contact-section {
        padding: 16px 0;
    }
    
    .mobile-contact-header h2 {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .mobile-contact-header p {
        font-size: 11px;
        line-height: 1.3;
    }
    
    .mobile-contact-item {
        padding: 8px 12px;
        margin-bottom: 6px;
        border-radius: 8px;
    }
    
    .mobile-contact-icon {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .mobile-contact-title {
        font-size: 12px;
        font-weight: 600;
        margin-bottom: 2px;
    }
    
    .mobile-contact-text {
        font-size: 10px;
        line-height: 1.2;
    }
    
    .mobile-contact-button {
        padding: 8px 16px;
        font-size: 11px;
        border-radius: 6px;
    }
    
    .mobile-contact-button i {
        font-size: 10px;
    }
    
    /* Background Images - using gradients instead of images */
    .hero-background {
        background: linear-gradient(135deg, #1E56A0 0%, #0A2463 50%, #3E92CC 100%);
        background-attachment: fixed;
    }
    
    .menu-background {
        background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
        background-size: cover;
        background-position: center;
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
    .tablet-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    .tablet-image {
        height: 120px;
    }
    
    .tablet-content {
        padding: 12px;
    }
}

/* Desktop optimizations */
@media (min-width: 1025px) {
    .desktop-grid-4 {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    
    .desktop-image {
        height: 160px;
    }
    
    .desktop-content {
        padding: 16px;
    }
}

/* Performance optimizations for mobile */
@media (max-width: 640px) {
    /* Reduce animations on mobile for better performance */
    .mobile-reduce-animations * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Optimize scrolling */
    .mobile-smooth-scroll {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Reduce shadows for better performance */
    .mobile-shadow {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    /* Optimize text rendering */
    .mobile-text-optimize {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeSpeed;
    }
}

/* Touch feedback for mobile */
@media (max-width: 640px) {
    .touch-feedback:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .touch-feedback:active .mobile-shadow {
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }
}

/* Mobile-specific utility classes */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 641px) {
    .mobile-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
}

/* Ensure proper mobile viewport */
@media (max-width: 640px) {
    .mobile-container {
        max-width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .mobile-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .mobile-card-compact {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .mobile-text-compact {
        font-size: 10px;
        line-height: 1.2;
    }
}

/* Village Slider Styles */
.slider-slide {
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.slider-slide.active {
    opacity: 1;
}

.slider-dot {
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-dot:hover {
    transform: scale(1.2);
}

/* Mobile optimizations for village slider */
@media (max-width: 640px) {
    .slider-slide {
        transition: opacity 0.8s ease-in-out;
    }
    
    .slider-dot {
        width: 8px;
        height: 8px;
    }
}
