/* ===== STYLE มือถือ - ดีไซน์ใหม่ V2 (แยกออกมาจาก index.html) ===== */
@media(max-width:768px) {

    /* รีเซ็ตค่าเริ่มต้นและตั้งค่าพื้นฐาน */
    *,
    *::before,
    *::after {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    html {
        scroll-behavior: smooth;
        -webkit-text-size-adjust: 100%;
    }

    body {
        font-family: 'Noto Sans Thai', 'Inter', sans-serif !important;
        background: #f8f9fa !important;
        color: #2d3436 !important;
        padding-bottom: 80px !important;
        /* Space for bottom nav */
        overflow-x: hidden !important;
        line-height: 1.6 !important;
        min-height: 100vh !important;
    }

    a {
        color: inherit;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }

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

    h1,
    h2,
    h3,
    h4 {
        line-height: 1.3;
        letter-spacing: -0.01em;
    }

    ul,
    ol {
        list-style: none;
    }

    button {
        cursor: pointer;
        border: none;
        background: none;
        font: inherit;
        -webkit-tap-highlight-color: transparent;
    }

    .container {
        width: 100% !important;
        padding: 0 16px !important;
        margin: 0 auto !important;
    }

    /* ส่วนหัว - ไล่สีและกระจก (Header - Gradient & Glass) */
    header {
        background: linear-gradient(135deg, #e91e63, #f48fb1) !important;
        color: #fff !important;
        padding: 8px 0 !important;
        text-align: left !important;
        display: block !important;
        box-shadow: 0 4px 12px rgba(233, 30, 99, 0.15) !important;
        position: relative !important;
        z-index: 10 !important;
    }

    header::before,
    header::after {
        display: none !important;
    }

    .header-content {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        padding: 0 16px !important;
    }

    .logo-container {
        display: none !important;
    }

    .logo-image {
        display: none !important;
    }

    .header-text h1 i {
        display: none !important;
    }

    .header-text {
        flex: 1 !important;
    }

    .header-text h1 {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        margin-bottom: 0 !important;
        line-height: 1.2 !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .header-text h1 i {
        font-size: 0.9rem !important;
    }

    .header-text p {
        font-size: 0.6rem !important;
        opacity: 0.9 !important;
        font-weight: 400 !important;
        margin-top: 2px !important;
    }

    /* Nav - Hidden */
    nav {
        display: none !important;
    }

    /* ส่วน Hero (ภาพหัวข้อใหญ่) */
    .hero-section {
        min-height: 240px !important;
        /* Slightly taller */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
        overflow: hidden !important;
        background: #333 !important;
        margin-bottom: 24px !important;
        border-bottom-left-radius: 40px !important;
        /* More curve */
        border-bottom-right-radius: 40px !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
        /* Deeper shadow */
        margin-top: -1px !important;
    }

    /* ... existing code ... */

    .hero-title {
        font-size: 1.8rem !important;
        /* Larger */
        font-weight: 800 !important;
        margin-bottom: 8px !important;
        text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
        background: linear-gradient(to bottom, #ffffff, #ffebee);
        background-clip: text !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        display: inline-block !important;
    }

    .hero-subtitle {
        font-size: 0.95rem !important;
        opacity: 0.95 !important;
        margin-bottom: 20px !important;
        font-weight: 300 !important;
        letter-spacing: 0.5px !important;
    }

    .hero-slider,
    .hero-overlay {
        position: absolute !important;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
    }

    .hero-overlay {
        background: rgba(0, 0, 0, 0.4) !important;
        z-index: 1 !important;
    }

    .hero-slide {
        position: absolute !important;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        opacity: 0 !important;
        transition: opacity 0.8s ease !important;
        background-size: cover !important;
        background-position: center !important;
    }

    .hero-slide.active {
        opacity: 1 !important;
    }

    .hero-content {
        position: relative !important;
        z-index: 3 !important;
        text-align: center !important;
        color: #fff !important;
        padding: 20px !important;
        width: 100% !important;
    }

    .hero-badge {
        font-size: 0.7rem !important;
        padding: 4px 12px !important;
        background: rgba(233, 30, 99, 0.85) !important;
        border-radius: 20px !important;
        color: #fff !important;
        margin-bottom: 12px !important;
        display: inline-block !important;
        backdrop-filter: blur(4px) !important;
    }

    .hero-title {
        font-size: 1.5rem !important;
        font-weight: 800 !important;
        margin-bottom: 6px !important;
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    .hero-subtitle {
        font-size: 0.85rem !important;
        opacity: 0.95 !important;
        margin-bottom: 16px !important;
    }

    .hero-cta {
        display: inline-block !important;
        padding: 10px 24px !important;
        background: #fff !important;
        color: #e91e63 !important;
        border-radius: 30px !important;
        font-weight: 600 !important;
        font-size: 0.9rem !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    }

    .hero-dots,
    .hero-arrows {
        display: none !important;
    }

    /* Stats Section */
    .stats-section {
        padding: 10px 16px 24px !important;
        background: transparent !important;
        display: block !important;
    }

    .stats-section::before,
    .stats-section::after {
        display: none !important;
    }

    .stats-title {
        font-size: 1.2rem !important;
        text-align: center !important;
        color: #333 !important;
        font-weight: 700 !important;
        margin-bottom: 4px !important;
    }

    .stats-subtitle {
        font-size: 0.8rem !important;
        text-align: center !important;
        color: #666 !important;
        margin-bottom: 16px !important;
    }

    .stats-cards {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .stat-card {
        background: #fff !important;
        border-radius: 16px !important;
        padding: 16px !important;
        text-align: center !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
        position: relative !important;
        overflow: hidden !important;
        border: 1px solid rgba(0, 0, 0, 0.03) !important;
    }

    .stat-card::before {
        content: "" !important;
        position: absolute !important;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 4px !important;
        background: linear-gradient(90deg, #e91e63, #f48fb1) !important;
    }

    .stat-card-icon {
        width: 40px !important;
        height: 40px !important;
        margin: 0 auto 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        background: #fff1f6 !important;
        color: #e91e63 !important;
        font-size: 1.1rem !important;
    }

    .stat-card-number {
        font-size: 1.4rem !important;
        color: #333 !important;
        font-weight: 800 !important;
    }

    .stat-card-label {
        font-size: 0.75rem !important;
        color: #777 !important;
        margin-top: 2px !important;
    }

    /* General Section Styles */
    main {
        padding: 0 !important;
        display: block !important;
    }

    .section {
        margin-bottom: 32px !important;
        display: block !important;
    }

    .section-title {
        font-size: 1.25rem !important;
        text-align: center !important;
        color: #2d3436 !important;
        font-weight: 700 !important;
        margin-bottom: 20px !important;
        position: relative !important;
        padding-bottom: 10px !important;
        display: block !important;
    }

    .section-title::after {
        content: "" !important;
        position: absolute !important;
        bottom: 0 !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 40px !important;
        height: 3px !important;
        background: #e91e63 !important;
        border-radius: 3px !important;
    }

    .section-title h2 {
        font-size: inherit !important;
    }

    /* Card Grid System */
    .cards-grid,
    .service-list,
    .services-list,
    .gallery-grid,
    .visual-services-grid,
    .reports-grid,
    .stats-grid,
    .knowledge-categories,
    .feature-cards {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* Generic Card */
    .card,
    .service-item,
    .stat-item,
    .report-card,
    .visual-service-card {
        background: #fff !important;
        border-radius: 16px !important;
        padding: 20px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid rgba(0, 0, 0, 0.02) !important;
        display: block !important;
        position: relative !important;
    }

    /* Intro Section */
    .intro-section {
        background: #fff !important;
        padding: 24px 16px !important;
        margin-bottom: 20px !important;
        display: block !important;
    }

    .intro-text p {
        color: #555 !important;
        font-size: 0.9rem !important;
        margin-bottom: 12px !important;
    }

    .intro-image {
        border-radius: 12px !important;
        overflow: hidden !important;
        margin-top: 16px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    }

    /* Custom Card Styles */
    .card-icon {
        width: 48px !important;
        height: 48px !important;
        border-radius: 12px !important;
        background: #fff1f6 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.4rem !important;
        color: #e91e63 !important;
        margin-bottom: 12px !important;
    }

    .card h3 {
        font-size: 1.1rem !important;
        margin-bottom: 8px !important;
        color: #2d3436 !important;
    }

    .card p {
        color: #666 !important;
        font-size: 0.9rem !important;
    }

    /* Visual Service Image */
    .visual-service-img {
        height: 160px !important;
        position: relative !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        margin-bottom: 12px !important;
    }

    .visual-service-img img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* Report Icon */
    .report-icon {
        width: 48px !important;
        height: 48px !important;
        border-radius: 12px !important;
        background: #e3f2fd !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.4rem !important;
        color: #2196f3 !important;
        margin-bottom: 12px !important;
    }

    /* Knowledge & Category Styles */
    .knowledge-category {
        border-radius: 12px !important;
        overflow: hidden !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        background: #fff !important;
    }

    .category-header {
        padding: 12px 16px !important;
        font-weight: 600 !important;
        font-size: 0.95rem !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .category-items {
        display: block !important;
        background: #fff !important;
    }

    .knowledge-item {
        display: block !important;
        padding: 12px 16px !important;
        border-bottom: 1px solid #eee !important;
        color: #333 !important;
        font-size: 0.9rem !important;
    }

    /* Download Link */
    .download-link {
        display: inline-flex !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 10px 20px !important;
        background: #e91e63 !important;
        color: #fff !important;
        border-radius: 50px !important;
        font-size: 0.85rem !important;
        font-weight: 500 !important;
        margin-top: 12px !important;
        box-shadow: 0 4px 10px rgba(233, 30, 99, 0.3) !important;
    }

    /* Gallery */
    .gallery-item {
        border-radius: 16px !important;
        overflow: hidden !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
        height: 180px !important;
        display: block !important;
        position: relative !important;
    }

    .gallery-item img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .gallery-caption {
        position: absolute !important;
        bottom: 0;
        left: 0;
        width: 100% !important;
        padding: 12px 16px !important;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent) !important;
        color: #fff !important;
    }

    .gallery-caption h4 {
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        margin-bottom: 2px !important;
    }

    .gallery-caption p {
        font-size: 0.8rem !important;
        opacity: 0.9 !important;
    }

    /* Quick Links */
    .quick-links-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .quick-link-card {
        background: linear-gradient(135deg, #e91e63, #ff4081) !important;
        border-radius: 16px !important;
        padding: 16px !important;
        text-align: center !important;
        color: #fff !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 110px !important;
        box-shadow: 0 4px 12px rgba(233, 30, 99, 0.25) !important;
    }

    .quick-link-card i {
        font-size: 1.8rem !important;
        margin-bottom: 8px !important;
    }

    .quick-link-card span {
        font-size: 0.85rem !important;
        font-weight: 500 !important;
    }

    /* Feature Cards (Complex) */
    .feature-card {
        border-radius: 16px !important;
        overflow: hidden !important;
        background: #fff !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
        display: block !important;
    }

    .feature-card-header {
        height: 140px !important;
        position: relative !important;
    }

    .feature-card-header img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .feature-card-icon-overlay {
        position: absolute !important;
        bottom: -20px !important;
        right: 16px !important;
        width: 44px !important;
        height: 44px !important;
        background: #e91e63 !important;
        border-radius: 50% !important;
        color: #fff !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
        z-index: 5 !important;
    }

    .feature-card-body {
        padding: 24px 16px 16px !important;
    }

    .feature-card-body h3 {
        font-size: 1.05rem !important;
        margin-bottom: 6px !important;
        color: #333 !important;
    }

    .feature-card-link {
        color: #e91e63 !important;
        font-weight: 600 !important;
        font-size: 0.9rem !important;
        margin-top: 8px !important;
        display: inline-block !important;
    }


    /* เอฟเฟกต์คลื่นน้ำ (Ripple Effect) */
    .ripple {
        position: absolute;
        border-radius: 50%;
        transform: scale(0);
        animation: ripple 0.6s linear;
        background-color: rgba(255, 255, 255, 0.4);
        pointer-events: none;
    }

    @keyframes ripple {
        to {
            transform: scale(4);
            opacity: 0;
        }
    }

    /* Target with relative positioning for ripple */
    .card,
    .feature-card,
    .visual-service-card,
    .btn,
    .download-link,
    .bottom-nav-items a {
        position: relative !important;
        overflow: hidden !important;
    }

    /* คีย์เฟรมภาพเคลื่อนไหว (Animation Keyframes) */
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* ใช้งานภาพเคลื่อนไหว (Apply Animations) */
    .card,
    .feature-card,
    .visual-service-card,
    .report-card,
    .stat-card {
        animation: fadeInUp 0.6s ease-out forwards;
    }

    /* Staggered Animation for grids */
    .cards-grid>div:nth-child(1) {
        animation-delay: 0.1s;
    }

    .cards-grid>div:nth-child(2) {
        animation-delay: 0.2s;
    }

    .cards-grid>div:nth-child(3) {
        animation-delay: 0.3s;
    }

    .cards-grid>div:nth-child(4) {
        animation-delay: 0.4s;
    }

    .feature-cards>div:nth-child(1) {
        animation-delay: 0.1s;
    }

    .feature-cards>div:nth-child(2) {
        animation-delay: 0.2s;
    }

    .feature-cards>div:nth-child(3) {
        animation-delay: 0.3s;
    }

    /* Touch Feedback */
    .card:active,
    .feature-card:active,
    .visual-service-card:active,
    .download-link:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }

    /* Footer */
    footer {
        background: #2d3436 !important;
        color: rgba(255, 255, 255, 0.7) !important;
        padding: 30px 20px 80px !important;
        text-align: center !important;
        display: block !important;
    }

    .footer-title {
        color: #fff !important;
        font-size: 1.1rem !important;
        margin-bottom: 12px !important;
        font-weight: 600 !important;
    }

    footer a {
        color: #f48fb1 !important;
    }

    /* เมนูด้านล่าง - ให้ความรู้สึกเหมือนแอป (Bottom Nav - The App Feel) */
    .bottom-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05) !important;
        padding: 8px 16px 20px !important;
        /* Extra padding for iPhone home indicator */
        z-index: 1000 !important;
        border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
    }

    .bottom-nav-items {
        display: flex !important;
        justify-content: flex-start !important;
        /* Align left for scrolling */
        width: 100% !important;
        overflow-x: auto !important;
        /* Enable horizontal scroll */
        -webkit-overflow-scrolling: touch !important;
        gap: 12px !important;
        padding-bottom: 4px !important;
        /* Hide scrollbar visual */
    }

    /* Hide Scrollbar */
    .bottom-nav-items::-webkit-scrollbar {
        display: none;
    }

    .bottom-nav-items a {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-decoration: none !important;
        color: #999 !important;
        font-size: 0.6rem !important;
        /* Slightly smaller text */
        gap: 4px !important;
        padding: 6px 10px !important;
        border-radius: 12px !important;
        transition: all 0.2s !important;
        flex: 0 0 auto !important;
        /* Prevent shrinking */
        min-width: 65px !important;
        /* Consistent width */
    }

    .bottom-nav-items a i {
        font-size: 1.3rem !important;
        margin-bottom: 2px !important;
    }

    .bottom-nav-items a.active {
        color: #e91e63 !important;
        background: rgba(233, 30, 99, 0.08) !important;
        font-weight: 600 !important;
        box-shadow: 0 2px 8px rgba(233, 30, 99, 0.15) !important;
        transform: translateY(-2px);
    }

    .bottom-nav-items a.active i {
        transform: scale(1.1);
        transition: transform 0.2s;
    }

    /* Floating Actions */
    .scroll-to-top {
        position: fixed !important;
        bottom: 85px !important;
        right: 16px !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        background: #fff !important;
        color: #e91e63 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 999 !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
    }

    /* Popup */
    .knowledge-popup {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9999;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(4px);
    }

    .knowledge-popup.active {
        display: flex !important;
    }

    .popup-content {
        background: #fff !important;
        width: 90% !important;
        max-height: 85vh !important;
        border-radius: 20px !important;
        overflow-y: auto !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
    }

    .popup-header {
        background: linear-gradient(135deg, #e91e63, #ff4081) !important;
        padding: 16px 20px !important;
        color: #fff !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .popup-title {
        font-size: 1.1rem !important;
        font-weight: 600 !important;
    }

    .popup-close {
        color: #fff !important;
        font-size: 1.5rem !important;
        opacity: 0.8 !important;
    }

    .popup-body {
        padding: 20px !important;
    }

    /* Dark mode toggle - hidden on mobile to clean up UI */
    .dark-mode-toggle {
        display: none !important;
    }
}