/* 
 * Mobile Responsive CSS สำหรับเว็บไซต์สยามอารยะ
 * ใช้สำหรับทุกหน้าในเว็บไซต์
 * Optimized for all device sizes
 */

/* ========================================
   Tablet Styles (769px - 1024px)
   ======================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 30px;
    }

    /* Header Tablet */
    header ul.main-nav,
    header ul.products-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    header li {
        padding: 0 10px;
    }

    header li a {
        font-size: 14px;
    }

    /* Grid Tablet - 2 columns */
    .product-grid,
    .video-grid,
    .article-grid,
    .activity-grid,
    .team-grid,
    .gallery-grid,
    .news-grid,
    .donation-grid,
    .contact-grid,
    .impact-grid,
    .testimonial-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Section spacing */
    section {
        padding: 60px 0;
    }
}

/* ========================================
   Base Mobile Styles (up to 768px)
   ======================================== */
@media (max-width: 768px) {
    /* Container & Layout */
    .container {
        padding: 0 15px;
        max-width: 100%;
    }
    
    /* Header Mobile */
    header {
        padding: 0.8rem 0;
    }
    
    header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    header #logo {
        font-size: 20px;
        display: flex;
        align-items: center;
    }
    
    header nav {
        width: 100%;
        margin-top: 0;
    }
    
    header ul {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    header li {
        display: inline-block;
        padding: 8px 5px;
        margin: 2px 0;
    }
    
    header li a {
        font-size: 14px;
        padding: 8px 12px;
        border-radius: 20px;
        transition: background 0.3s ease;
    }
    
    header li a:hover {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .dropdown-content {
        position: static;
        display: block;
        background: rgba(255, 255, 255, 0.1);
        margin-left: 0;
        border-radius: 8px;
        margin-top: 8px;
        padding: 8px;
    }
    
    .dropdown-content a {
        padding: 8px 12px !important;
        margin: 2px 0 !important;
        font-size: 13px !important;
    }
    
    /* Hero Section Mobile */
    section#home {
        padding-top: 120px;
        padding-bottom: 40px;
    }
    
    .hero-banner {
        height: 250px;
        font-size: 18px;
        margin-bottom: 1.5rem;
    }
    
    .main-logo-section {
        margin-bottom: 1.5rem;
    }
    
    .main-logo-section h1,
    section#home h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    section#home h2 {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
    }
    
    section#home p {
        font-size: 16px;
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }
    
    /* Buttons Mobile */
    .hero-buttons {
        flex-direction: column;
        gap: 0.8rem;
        margin-top: 1.5rem;
    }
    
    .hero-buttons .btn-primary {
        padding: 12px 24px;
        font-size: 14px;
        margin: 0;
        display: block;
        text-align: center;
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }
    
    .btn-primary {
        padding: 10px 20px;
        font-size: 14px;
        margin: 5px;
    }
    
    /* Grid Mobile - Single column */
    .product-grid,
    .video-grid,
    .article-grid,
    .activity-grid,
    .team-grid,
    .gallery-grid,
    .news-grid,
    .donation-grid,
    .contact-grid,
    .impact-grid,
    .testimonial-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
        margin-top: 1.2rem;
    }

    /* Special grids */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .service-grid {
        grid-template-columns: 1fr;
    }
    
    /* Card Styles Mobile - Better spacing */
    .product-card,
    .video-card,
    .article-card,
    .activity-card,
    .team-card,
    .gallery-card,
    .news-card,
    .donation-card,
    .contact-card,
    .impact-card,
    .testimonial-card {
        margin-bottom: 0.8rem;
        padding: 1rem;
    }
    
    /* Image Styles Mobile */
    .product-card img,
    .article-card img,
    .activity-card img,
    .gallery-card img,
    .news-card img {
        height: 200px;
        object-fit: cover;
        border-radius: 10px;
    }
    
    .team-card img {
        width: 150px;
        height: 150px;
        margin: 0 auto 1rem auto;
    }
    
    /* Typography Mobile */
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    .product-card h4,
    .article-card h4,
    .activity-card h4,
    .team-card h4,
    .gallery-card h4,
    .news-card h4 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
        line-height: 1.4;
    }
    
    .product-card p,
    .article-card p,
    .activity-card p,
    .team-card p,
    .gallery-card p,
    .news-card p {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 1rem;
    }
    
    /* Section Spacing Mobile */
    section {
        padding: 50px 0;
    }
    
    /* Form Mobile */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Contact Mobile */
    .contact-form {
        padding: 1.5rem;
        margin: 1.5rem auto;
    }
    
    /* Donation Mobile */
    .donation-amount {
        font-size: 2rem;
    }
    
    /* Map Mobile */
    .map-container {
        height: 300px;
        margin: 1.5rem 0;
    }
    
    /* FAQ Mobile */
    .faq-question {
        padding: 1rem;
    }
    
    .faq-answer {
        padding: 0 1rem;
    }
    
    .faq-item.active .faq-answer {
        padding: 1rem;
        max-height: 300px;
    }
}

/* Extra Small Mobile (up to 480px) */
@media (max-width: 480px) {
    header #logo {
        font-size: 18px;
    }
    
    header li a {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .hero-banner {
        height: 200px;
        font-size: 16px;
    }
    
    .main-logo-section h1,
    section#home h1 {
        font-size: 1.5rem;
    }
    
    section#home h2 {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .hero-buttons .btn-primary {
        padding: 10px 20px;
        font-size: 13px;
        max-width: 260px;
    }
    
    .btn-primary {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .product-card img,
    .article-card img,
    .activity-card img,
    .gallery-card img,
    .news-card img {
        height: 180px;
    }
    
    .team-card img {
        width: 120px;
        height: 120px;
    }
    
    .donation-amount {
        font-size: 1.8rem;
    }
    
    .map-container {
        height: 250px;
    }
    
    section {
        padding: 40px 0;
    }
    
    /* Extra small text adjustments */
    .product-card h4,
    .article-card h4,
    .activity-card h4 {
        font-size: 1rem;
    }
    
    .product-card p,
    .article-card p,
    .activity-card p {
        font-size: 13px;
    }
}

/* Landscape Mobile (up to 667px height) */
@media (max-height: 667px) and (orientation: landscape) {
    header {
        padding: 0.5rem 0;
    }
    
    .hero-banner {
        height: 150px;
        font-size: 16px;
    }
    
    section#home {
        padding-top: 100px;
        padding-bottom: 30px;
    }
    
    section {
        padding: 30px 0;
    }
}

/* High DPI/Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .header-logo,
    .main-logo,
    .footer-logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn-primary {
        min-height: 44px;
        min-width: 44px;
    }
    
    header li a {
        min-height: 36px;
        min-width: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .dropdown-content a {
        min-height: 40px;
    }
}