/* 
 * Straight Mobile Menu CSS - แถบเขียวตรงตามรูป LIMGAR
 * Version: 1.0
 * Date: 2024-01-15
 * 
 * เมนูแบบแถบเขียวตรง มีปุ่มกลางเป็นวงกลมขาวไอคอนเขียว
 */

/* ===== MOBILE STRAIGHT NAVIGATION ===== */
@media (max-width: 768px) {
    
    /* Base Navigation Bar */
    nav.fixed.bottom-0 {
        background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%) !important;
        height: 80px !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
        border: none !important;
        border-radius: 0 !important;
    }
    
    /* Navigation Container */
    nav.fixed.bottom-0 > div {
        display: flex !important;
        align-items: center !important;
        justify-content: space-evenly !important; /* Changed from space-around to space-evenly for better spacing */
        height: 100% !important;
        padding: 0 0.5rem !important; /* Reduced padding to give more space for icons */
        position: relative !important;
        gap: 0.25rem !important; /* Added gap between items */
    }
    
    /* Standard Navigation Items (4 ปุ่มข้าง) */
    .straight-nav-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.5rem 0.75rem !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        border-radius: 12px !important;
        min-width: 50px !important;
        min-height: 64px !important;
        text-decoration: none !important;
        -webkit-tap-highlight-color: transparent !important;
        position: relative !important;
    }
    
    /* Hover Effects for Standard Items */
    .straight-nav-item:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        transform: translateY(-2px) !important;
    }
    
    .straight-nav-item:active {
        transform: translateY(0) scale(0.95) !important;
    }
    
    /* Icons in Standard Navigation Items */
    .straight-nav-item i {
        font-family: 'Font Awesome 5 Free' !important;
        font-weight: 900 !important;
        font-size: 1.25rem !important; /* 20px */
        color: #ffffff !important; /* Default white color for inactive icons */
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        line-height: 1 !important;
        text-align: center !important;
        transition: all 0.3s ease !important;
        text-rendering: optimizeLegibility !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        margin-bottom: 0.25rem !important;
    }
    
    /* Icon Hover Effects */
    .straight-nav-item:hover i {
        transform: scale(1.1) !important;
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Text Labels in Standard Items */
    .straight-nav-item span.thai-text {
        font-family: 'Sarabun', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif !important;
        font-size: 0.6rem !important; /* 9.6px - เล็กกว่าเดิมเพื่อให้พอดี */
        font-weight: 500 !important;
        color: #ffffff !important;
        line-height: 1.2 !important;
        text-align: center !important;
        transition: all 0.3s ease !important;
        white-space: nowrap !important;
        letter-spacing: 0.025em !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Text Hover Effects */
    .straight-nav-item:hover span.thai-text {
        font-weight: 600 !important;
        transform: translateY(-1px) !important;
    }
    
    /* ===== HOME CENTER CIRCLE BUTTON ===== */
    .home-center-circle {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        text-decoration: none !important;
        -webkit-tap-highlight-color: transparent !important;
        position: relative !important;
    }
    
    /* Center Circle Button */
    .home-center-circle > div:first-child {
        width: 64px !important;
        height: 64px !important;
        background: #059669 !important; /* Green background */
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
        transition: all 0.3s ease !important;
        border: 4px solid rgba(255, 255, 255, 0.2) !important;
        position: relative !important;
        z-index: 2 !important;
        margin-bottom: 0.25rem !important;
    }
    
    /* Home Icon - White Color */
    .home-center-circle .fas.fa-home {
        font-family: 'Font Awesome 5 Free' !important;
        font-weight: 900 !important;
        font-size: 1.5rem !important; /* 24px */
        color: #ffffff !important; /* White color for icon */
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        line-height: 1 !important;
        text-rendering: optimizeLegibility !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
    }
    
    /* Center Button Hover */
    .home-center-circle:hover > div:first-child {
        transform: scale(1.05) !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2) !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
    }
    
    .home-center-circle:active > div:first-child {
        transform: scale(0.98) !important;
    }
    
    /* Center Button Text */
    .home-center-circle span.thai-text {
        font-family: 'Sarabun', 'Noto Sans Thai', sans-serif !important;
        font-size: 0.6rem !important; /* 9.6px - เล็กเหมือนปุ่มอื่น */
        font-weight: 500 !important;
        color: #ffffff !important;
        text-align: center !important;
        margin-top: 0.25rem !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
    }
    
    /* ===== CART BADGE ENHANCEMENTS ===== */
    .straight-nav-item .cart-count {
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
        color: #ffffff !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
        font-size: 0.625rem !important; /* 10px */
        font-weight: 700 !important;
        line-height: 1 !important;
        min-width: 18px !important;
        height: 18px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: absolute !important;
        top: 4px !important;
        right: 8px !important;
        z-index: 10 !important;
        border: 2px solid #ffffff !important;
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4) !important;
        animation: cartPulse 2s infinite !important;
    }
    
    /* Cart Badge Animation */
    @keyframes cartPulse {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.1); }
    }
    
    /* ===== ONLINE INDICATOR ===== */
    .straight-nav-item .bg-yellow-400 {
        width: 12px !important;
        height: 12px !important;
        background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
        border-radius: 50% !important;
        position: absolute !important;
        top: 4px !important;
        right: 8px !important;
        z-index: 10 !important;
        border: 2px solid #ffffff !important;
        box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3) !important;
        animation: onlinePulse 3s infinite !important;
    }
    
    /* Online Indicator Animation */
    @keyframes onlinePulse {
        0%, 100% { box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3); }
        50% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.1); }
    }
    
    /* ===== ACTIVE STATES ===== */
    .straight-nav-item[data-active="true"] {
        background: rgba(255, 255, 255, 0.15) !important;
        border-radius: 12px !important;
        transform: translateY(-2px) !important;
    }
    
    .straight-nav-item[data-active="true"] i {
        color: #fbbf24 !important; /* Yellow/orange for active state */
        transform: scale(1.05) !important;
        text-shadow: 0 2px 8px rgba(251, 191, 36, 0.5) !important;
    }
    
    .straight-nav-item[data-active="true"] span.thai-text {
        color: #fbbf24 !important; /* Yellow/orange for active text */
        font-weight: 600 !important;
    }
    
    /* Active Home Button */
    .home-center-circle[data-active="true"] > div:first-child {
        border-color: #fbbf24 !important;
        box-shadow: 0 8px 25px rgba(251, 191, 36, 0.3) !important;
        background: #ffffff !important;
    }
    
    .home-center-circle[data-active="true"] .fas.fa-home {
        color: #fbbf24 !important; /* Yellow/orange for active home icon */
    }
    
    .home-center-circle[data-active="true"] span.thai-text {
        color: #fbbf24 !important; /* Yellow/orange for active home text */
        font-weight: 600 !important;
    }
    
    /* Ensure inactive items stay white */
    .straight-nav-item:not([data-active="true"]) i {
        color: #ffffff !important; /* Force white for inactive icons */
    }
    
    .straight-nav-item:not([data-active="true"]) span.thai-text {
        color: #ffffff !important; /* Force white for inactive text */
    }
    
    /* Home button inactive state */
    .home-center-circle:not([data-active="true"]) .fas.fa-home {
        color: #22c55e !important; /* Green for inactive home icon (default) */
    }
    
    .home-center-circle:not([data-active="true"]) span.thai-text {
        color: #ffffff !important; /* White for inactive home text */
    }
    
    /* ===== SPECIFIC ICON IMPROVEMENTS ===== */
    /* Shopping Bag Icon */
    .fas.fa-shopping-bag {
        font-size: 1.25rem !important;
    }
    
    /* Grid/Category Icon */
    .fas.fa-th {
        font-size: 1.125rem !important;
    }
    
    /* Comments/Chat Icon */
    .fas.fa-comments {
        font-size: 1.25rem !important;
    }
    
    /* User/Profile Icon */
    .fas.fa-user {
        font-size: 1.125rem !important;
    }
    
    /* ===== RESPONSIVE ADJUSTMENTS ===== */
    /* Very small screens */
    @media (max-width: 360px) {
        .straight-nav-item {
            min-width: 44px !important;
            padding: 0.25rem 0.5rem !important;
        }
        
        .straight-nav-item span.thai-text,
        .home-center-circle span.thai-text {
            font-size: 0.55rem !important; /* 8.8px for very small screens */
        }
        
        .home-center-circle > div:first-child {
            width: 56px !important;
            height: 56px !important;
        }
        
        .home-center-circle .fas.fa-home {
            font-size: 1.25rem !important; /* 20px */
        }
    }
    
    /* Large mobile screens */
    @media (min-width: 390px) and (max-width: 768px) {
        .straight-nav-item {
            min-width: 56px !important;
            padding: 0.5rem 1rem !important;
        }
        
        .straight-nav-item span.thai-text,
        .home-center-circle span.thai-text {
            font-size: 0.65rem !important; /* 10.4px for larger screens */
        }
    }
    
    /* ===== LOADING ANIMATIONS ===== */
    /* Stagger loading animations */
    .straight-nav-item:nth-child(1) {
        animation: slideInUp 0.6s ease-out 0.1s both;
    }
    
    .straight-nav-item:nth-child(2) {
        animation: slideInUp 0.6s ease-out 0.2s both;
    }
    
    .home-center-circle {
        animation: scaleInBounce 0.8s ease-out 0.3s both;
    }
    
    .straight-nav-item:nth-child(4) {
        animation: slideInUp 0.6s ease-out 0.4s both;
    }
    
    .straight-nav-item:nth-child(5) {
        animation: slideInUp 0.6s ease-out 0.5s both;
    }
    
    @keyframes slideInUp {
        0% {
            opacity: 0;
            transform: translateY(30px);
        }
        100% {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    @keyframes scaleInBounce {
        0% {
            opacity: 0;
            transform: scale(0.3);
        }
        50% {
            transform: scale(1.05);
        }
        70% {
            transform: scale(0.9);
        }
        100% {
            opacity: 1;
            transform: scale(1);
        }
    }
    
    /* ===== ACCESSIBILITY IMPROVEMENTS ===== */
    /* Focus states */
    .straight-nav-item:focus,
    .home-center-circle:focus {
        outline: 2px solid rgba(255, 255, 255, 0.8) !important;
        outline-offset: 4px !important;
    }
    
    /* High contrast mode */
    @media (prefers-contrast: high) {
        .straight-nav-item i,
        .straight-nav-item span.thai-text {
            color: #ffffff !important;
            text-shadow: 0 0 0 #000000 !important;
        }
        
        nav.fixed.bottom-0 {
            background: #000000 !important;
            border-top: 2px solid #ffffff !important;
        }
        
        .home-center-circle > div:first-child {
            background: #ffffff !important;
            border: 4px solid #000000 !important;
        }
        
        .home-center-circle .fas.fa-home {
            color: #000000 !important;
        }
    }
    
    /* Reduced motion */
    @media (prefers-reduced-motion: reduce) {
        .straight-nav-item,
        .home-center-circle,
        .straight-nav-item i,
        .cart-count,
        .bg-yellow-400 {
            animation: none !important;
            transition: none !important;
        }
        
        .straight-nav-item:hover,
        .home-center-circle:hover > div:first-child {
            transform: none !important;
        }
    }
}

/* ===== DESKTOP OVERRIDES ===== */
@media (min-width: 769px) {
    nav.fixed.bottom-0 {
        display: none !important;
    }
    
    body {
        padding-bottom: 0 !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    nav.fixed.bottom-0 {
        display: none !important;
    }
}

/* ===== LIVE CHAT WIDGET MOBILE ADJUSTMENTS ===== */
/* Fix live chat widget position to not overlap mobile menu */
#liveChatWidget,
.chat-widget,
.live-chat-widget {
    bottom: 100px !important; /* Move above mobile menu (80px height + 20px spacing) */
    right: 20px !important;
    z-index: 40 !important; /* Lower than mobile menu z-index (50) */
}

/* Chat toggle button adjustments for mobile */
.chat-toggle,
.chat-toggle-btn {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.125rem !important; /* Smaller icon */
}

/* Chat window positioning */
.chat-window {
    bottom: 70px !important; /* Position above the chat button */
    right: 0 !important;
    width: calc(100vw - 24px) !important;
    max-width: 350px !important;
    height: 450px !important;
}

/* Mobile Responsive for very small screens */
@media (max-width: 640px) {
    .chat-window {
        width: calc(100vw - 32px) !important;
        right: 16px !important;
        left: 16px !important;
        bottom: 70px !important;
        height: 400px !important;
    }
    
    #liveChatWidget,
    .chat-widget,
    .live-chat-widget {
        bottom: 100px !important;
        right: 16px !important;
    }
    
    .chat-toggle,
    .chat-toggle-btn {
        width: 48px !important;
        height: 48px !important;
    }
    
    .quick-replies-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
nav.fixed.bottom-0 {
    will-change: transform !important;
    contain: layout style paint !important;
}

.straight-nav-item,
.home-center-circle {
    will-change: transform !important;
}

.home-center-circle > div:first-child {
    will-change: transform !important;
}

/* Mobile Responsive - แก้ไขใหม่ */
/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
        left: 15px; /* เพิ่มบรรทัดนี้ */
        display: flex;
        justify-content: center; /* จัดกลาง */
    }
    
    .chat-toggle {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    .chat-window {
        width: calc(100vw - 30px); /* ความกว้างเต็มจอลบ margin */
        height: 70vh;
        bottom: 90px;
        right: 0; /* เปลี่ยนจาก right: -10px */
        left: 0;  /* เพิ่มบรรทัดนี้เพื่อจัดกลาง */
        margin: 0 auto; /* จัดกลาง */
        position: fixed; /* เปลี่ยนจาก absolute เป็น fixed */
    }
}