/* Responsive Design */

/* Large Desktops */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Laptops and Tablets */
@media (max-width: 992px) {
    .container {
        padding: 0 30px;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.95rem;
    }
    
    /* User greeting with avatar - tablet view */
    #userNameDisplay {
        gap: 6px;
    }
    
    .nav-avatar {
        width: 30px;
        height: 30px;
    }
    
    .nav-username {
        font-size: 0.95rem;
    }

    h1 {
        font-size: 2.8rem;
    }

    h2 {
        font-size: 2.2rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1.5rem;
    }

    .products-grid.list-view {
        grid-template-columns: 1fr;
    }

    .products-grid.list-view .product-image {
        width: 200px;
        height: 200px;
    }

    .modal {
        max-width: 90%;
    }

    .notifications-panel {
        width: 340px;
    }

    .cart-sidebar {
        max-width: 380px;
    }

    /* Tablet chatbot adjustments */
    .chat-window {
        width: 360px;
        height: 480px;
    }
}

/* Mobile View */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex !important;
        position: relative;
        background: transparent;
        border: none;
        color: var(--text-dark);
        transition: color 0.3s ease;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .category-filter {
        gap: 0.8rem;
        padding: 0.8rem;
        margin: 1.5rem 0 2rem 0;
    }

    .category-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }

    .category-btn i {
        font-size: 1rem;
    }

    .nav-links {
        /* Use max-height for smooth dropdown animation */
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 0.5rem;
        width: 100%;
        
        /* Animation properties */
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.4s ease, opacity 0.3s ease, visibility 0s 0.4s;
        pointer-events: none;
        
        /* Scrollable when open */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Custom scrollbar for mobile menu */
    .nav-links::-webkit-scrollbar {
        width: 6px;
    }
    
    .nav-links::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .nav-links::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 3px;
    }
    
    .nav-links::-webkit-scrollbar-thumb:hover {
        background: #6a1b9a;
    }

    /* Show mobile-only items on small screens */
    .mobile-only { 
        display: block; 
    }

    /* Mobile login/register header buttons */
    .mobile-login-btn,
    .mobile-register-btn {
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
        padding: 0.45rem 0.65rem;
        border-radius: 10px;
        font-weight: 700;
        font-family: var(--font-body);
        min-height: 44px;
        box-shadow: var(--shadow);
        align-self: center;
        margin-left: 0.4rem;
        white-space: nowrap;
    }

    .mobile-login-btn i, .mobile-register-btn i {
        font-size: 1rem;
    }

    .mobile-btn-label {
        display: inline-block;
    }

    @media (max-width: 420px) {
        .mobile-btn-label { display: none; }
        .mobile-login-btn, .mobile-register-btn { padding: 0.4rem; }
    }

    /* When user is logged in (mobile) hide external auth buttons and show profile avatar */
    body.mc-logged-in .mobile-login-btn,
    body.mc-logged-in .mobile-register-btn,
    body.mc-logged-in #registerButton {
        display: none !important;
    }

    body.mc-logged-in #mobileProfileBtn {
        display: flex !important;
    }

    .nav-links.active {
        /* Keep menu absolutely positioned so it overlays content and isn't clipped */
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        z-index: 9002;
        max-height: calc(100vh - var(--header-height));
        opacity: 1;
        visibility: visible;
        padding: 0.75rem;
        padding-bottom: 1.5rem;
        pointer-events: auto;
        transition: max-height 0.4s ease, opacity 0.3s ease, visibility 0s;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    /* Scroll shadow indicators */
    .nav-links.active {
        background:
            linear-gradient(var(--white) 30%, rgba(255,255,255,0)),
            linear-gradient(rgba(255,255,255,0), var(--white) 70%) 0 100%,
            radial-gradient(farthest-side at 50% 0, rgba(0,0,0,.2), rgba(0,0,0,0)),
            radial-gradient(farthest-side at 50% 100%, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%;
        background-repeat: no-repeat;
        background-color: var(--white);
        background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
        background-attachment: local, local, scroll, scroll;
    }

    .nav-link {
        width: 100%;
        text-align: center;
        padding: 0.8rem 0.5rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(138, 43, 226, 0.2);
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        flex-shrink: 0;
        font-size: 0.9rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.5);
        transition: background 0.3s ease;
    }
    
    /* Hide profile link in mobile menu - it's shown as button outside */
    .nav-link.profile-nav-link {
        display: none !important;
    }

    /* Menu profile item styling to match other nav items and keep layout stable */
    .menu-profile-item {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        padding: 0.6rem 0.5rem;
        border-radius: 8px;
        background: rgba(255,255,255,0.5);
        justify-content: center;
        min-height: 44px;
        font-weight: 600;
    }

    .menu-profile-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        object-fit: cover;
    }

    .menu-profile-icon { font-size: 1.4rem; color: var(--primary); }

    .menu-profile-text { display: inline-block; }
    
    .nav-link i.fa-heart {
        color: #ff4757;
        font-size: 1rem;
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(138, 43, 226, 0.1);
    }

    .btn-order-now, #authButton {
        width: 100%;
        margin: 0.25rem 0;
        flex-shrink: 0;
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    /* Mobile action bar: group bell, cart, chatbot icons so badges stay together */
    .mobile-action-bar {
        display: flex;
        gap: 0.5rem;
        justify-content: flex-end;
        align-items: center;
        grid-column: 1 / -1;
        padding: 0.4rem 0 0.6rem 0;
    }

    .mobile-action-bar .cart-icon,
    .mobile-action-bar .bell-wrapper,
    .mobile-action-bar #chatbotMenuToggle {
        position: relative;
        margin: 0;
        padding: 6px 8px;
        min-width: auto;
        min-height: auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Slightly adjust badge placement on small screens so they don't drift */
    .mobile-action-bar .cart-count,
    .mobile-action-bar .notif-count,
    .mobile-action-bar .badge {
        top: 0.5rem !important;
        right: -6px !important;
        transform: none !important;
    }

    .btn-order-now {
        grid-column: 1 / -1;
    }

    #authButton {
        grid-column: 1 / -1;
    }

    .bell-wrapper, .cart-icon {
        margin: 0.25rem;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 0.8rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.5);
        cursor: pointer;
        transition: background 0.3s ease;
    }

    .bell-wrapper:hover,
    .cart-icon:hover {
        background: rgba(138, 43, 226, 0.1);
    }

    #userNameDisplay {
        grid-column: 1 / -1;
        text-align: center;
        padding: 0.5rem;
        font-weight: 600;
        color: var(--primary-color);
    }

    .notifications-panel {
        right: 10px;
        top: 60px;
        max-width: calc(100vw - 20px);
    }

    /* Chatbot Mobile Menu Item */
    .chatbot-menu-item {
        grid-column: 1 / -1;
        width: 100%;
        padding: 1rem;
        background: linear-gradient(135deg, var(--primary) 0%, #ffb84d 100%);
        color: white;
        border: none;
        border-radius: 12px;
        font-weight: 700;
        font-family: var(--font-body);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.8rem;
        margin: 0.5rem 0;
        transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
        min-height: 50px;
        box-shadow: 0 6px 18px rgba(255, 140, 0, 0.4);
        position: relative;
        overflow: hidden;
        font-size: 1rem;
    }

    /* Glow effect on hover */
    .chatbot-menu-item::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
        opacity: 0;
        transition: opacity 0.4s ease;
        pointer-events: none;
    }

    .chatbot-menu-item:hover::before {
        opacity: 1;
    }

    .chatbot-menu-item:hover {
        transform: translateY(-4px) scale(1.05);
        box-shadow: 0 8px 24px rgba(255, 140, 0, 0.5);
    }

    .chatbot-menu-item:active {
        transform: translateY(-1px) scale(0.96);
        box-shadow: 0 4px 12px rgba(255, 140, 0, 0.35);
    }

    .chatbot-menu-item i {
        font-size: 1.5rem;
        position: relative;
        z-index: 1;
        animation: chatPulse 2.5s ease-in-out infinite;
    }

    @keyframes chatPulse {
        0%, 100% { transform: scale(1); opacity: 1; }
        50% { transform: scale(1.15); opacity: 0.8; }
    }

    .cart-sidebar {
        max-width: 90%;
        width: 90%;
        top: 50%;
        height: 55vh;
        max-height: 55vh;
        padding: 0.9rem;
        border-radius: 12px 0 0 12px;
        transform: translateY(-50%);
    }
    
    .cart-sidebar.active {
        right: 0;
        transform: translateY(-50%);
    }
    
    .cart-items {
        max-height: calc(55vh - 160px);
        overflow-y: auto;
    }
    
    .cart-item {
        margin-bottom: 0.8rem;
        padding-bottom: 0.8rem;
    }
    
    .cart-item-image {
        width: 55px;
        height: 55px;
        min-width: 55px;
    }
    
    .cart-item-details h4 {
        font-size: 0.85rem;
    }
    
    .cart-item-price {
        font-size: 0.9rem;
    }
    
    .quantity-btn {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    .quantity-display {
        font-size: 0.9rem;
        margin: 0 6px;
    }
    
    .remove-item {
        padding: 4px 8px;
        font-size: 0.85rem;
    }

    h1 {
        font-size: 2rem;
    }

    .hero {
        padding: 4rem 20px;
    }

    h1 {
        font-size: 2.5rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    /* Additional site-wide responsive improvements */
    /* Make the navbar more compact and stack controls nicely */
    .navbar {
        align-items: center;
        gap: 0.5rem;
    }

    .logo-container {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .logo-img {
        width: 36px;
        height: 36px;
        border-radius: 6px;
    }

    /* Hero: stack buttons and scale text for small screens */
    .hero .hero-content {
        padding: 1rem 0.5rem;
    }

    .hero-title {
        font-size: 1.8rem;
        line-height: 1.15;
        text-align: center;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        text-align: center;
    }

    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        align-items: center;
        margin-top: 1rem;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 320px;
    }

    .hero-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
        margin-top: 1rem;
    }

    /* Features / Offers / Testimonials responsive grids */
    .features-grid, .offers-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Product cards and images: ensure consistent sizing */
    .product-image, .offer-icon, .author-avatar {
        width: 100%;
        height: auto;
        object-fit: cover;
        border-radius: 8px;
    }

    /* Make buttons touch-friendly and full-width where appropriate */
    .btn, .btn-primary, .btn-outline, .btn-order-now {
        min-height: 48px;
        padding: 0.8rem 1rem;
        font-size: 1rem;
        border-radius: 12px;
    }

    /* Footer and newsletter adjustments */
    .newsletter-form {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }

    .newsletter-form input, .newsletter-form button {
        width: 100%;
    }

    /* Reduce excessive paddings on small devices */
    .container { padding-left: 12px; padding-right: 12px; }

    /* Very small phones: compact elements */
    @media (max-width: 420px) {
        .logo-img { width: 32px; height: 32px; }
        .hero-title { font-size: 1.6rem; }
        .nav-link { font-size: 0.88rem; padding: 0.6rem 0.4rem; }
        .btn { font-size: 0.95rem; padding: 0.6rem 0.8rem; }
        .products-grid { grid-template-columns: repeat(2, 1fr); }
    }

    .products-grid.list-view {
        grid-template-columns: 1fr;
    }

    .products-grid.list-view .product-card {
        flex-direction: column;
    }

    .products-grid.list-view .product-image {
        width: 100%;
        height: 250px;
    }

    .products-grid.list-view .product-info {
        padding: 1.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    /* Mobile: make chat window fixed and full-width */
    .chat-window {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 70vh;
        max-height: calc(100vh - 80px);
        border-radius: 12px 12px 0 0;
        margin: 0;
        z-index: 3000;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}

/* Smaller Mobile Devices */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero {
        padding: 3rem 15px;
    }

    h1 {
        font-size: 2rem;
    }
    
    /* User greeting - small mobile */
    #userNameDisplay {
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 0.5rem 0;
    }
    
    .nav-avatar {
        width: 36px;
        height: 36px;
        border-width: 2.5px;
    }
    
    .nav-username {
        font-size: 0.85rem;
        text-align: center;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .products-grid .product-image { 
        height: 120px; 
    }
    
    .products-grid .product-info { 
        padding: 0.8rem; 
    }
    
    .products-grid .product-name { 
        font-size: 0.98rem; 
    }
    
    .products-grid .product-price { 
        font-size: 0.98rem; 
    }
    
    .products-grid .product-description { 
        font-size: 0.8rem; 
    }
    
    .products-grid .add-to-cart { 
        padding: 8px 12px; 
        font-size: 0.9rem; 
    }
    
    /* Favorite button adjustments for small mobile */
    .favorite-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        top: 8px;
        right: 8px;
    }
    
    .favorite-btn i {
        font-size: 1.2rem;
    }

    .products-grid.list-view .product-card {
        flex-direction: column;
    }

    .products-grid.list-view .product-image {
        width: 100%;
        height: 220px;
    }

    .products-grid.list-view .product-info {
        padding: 1.2rem;
    }

    .category-filter {
        gap: 0.6rem;
        padding: 0.6rem;
        margin: 1rem 0 1.5rem 0;
    }

    .category-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .category-btn i {
        font-size: 0.95rem;
    }

    .category-switcher {
        flex-direction: column;
    }

    /* Back to top button - adjust position for mobile to be above bottom nav */
    .back-to-home-btn {
        right: auto;
        left: 20px;
        bottom: 85px; /* Move up to be visible above bottom navigation */
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }

    .modal {
        width: 90%;
        max-height: 80vh;
        border-radius: 8px;
        margin: auto;
        padding: 0.9rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    /* Payment Modal Mobile Optimization */
    .payment-modal {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .payment-modal .modal-header {
        padding: 0.8rem 0;
        margin-bottom: 0.8rem;
    }
    
    .payment-modal .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .qr-container {
        margin: 0.8rem 0;
    }
    
    .qr-code {
        width: 120px;
        height: 120px;
        font-size: 0.75rem;
    }
    
    .qr-container p {
        font-size: 0.85rem;
        margin: 0.5rem 0;
    }
    
    .order-summary {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    .order-summary h4 {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }
    
    .order-item {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }
    
    .order-item-options {
        font-size: 0.75rem;
    }
    
    .order-total {
        margin-top: 0.6rem;
        padding-top: 0.6rem;
    }
    
    .delivery-options {
        margin: 0.8rem 0;
    }
    
    .delivery-options .option-label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .delivery-options .option-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .payment-modal .form-group {
        margin-bottom: 1rem;
    }
    
    .payment-modal .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .payment-modal .form-group textarea {
        font-size: 0.9rem;
        padding: 0.6rem;
    }
    
    .file-upload {
        margin: 0.8rem 0;
    }
    
    .file-upload label {
        font-size: 0.9rem;
    }
    
    .file-input {
        padding: 8px;
        font-size: 0.85rem;
    }
    
    .payment-modal .btn {
        padding: 0.8rem;
        font-size: 0.95rem;
    }
    
    #pickupMapContainer {
        margin: 0.8rem 0;
    }
    
    #pickupMapContainer p {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
    
    #pickupMapContainer iframe {
        height: 180px;
    }

    /* Profile mobile responsiveness */
    .profile-avatar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .avatar-preview {
        width: 80px;
        height: 80px;
    }

    .avatar-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .avatar-actions input[type="file"] {
        width: 100%;
        font-size: 0.9rem;
    }

    .avatar-actions .btn {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-item {
        padding: 0.8rem;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .membership-card-bg {
        padding: 1rem;
    }
    
    .membership-tier {
        font-size: 0.9rem;
        padding: 0.2rem 0.6rem;
    }
    
    .membership-card-body h4 {
        font-size: 1.1rem;
    }
    
    .member-points {
        font-size: 1.5rem;
    }
    
    .payment-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .payment-amount-section {
        text-align: left;
        width: 100%;
    }
    
    .address-item {
        padding: 0.8rem;
    }
    
    .address-actions {
        flex-wrap: wrap;
    }
    
    .address-actions .btn {
        flex: 1;
        min-width: 100px;
    }
    
    .security-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
    
    .security-item .btn {
        width: 100%;
    }

    .product-detail {
        flex-direction: column;
    }

    .product-detail-image {
        height: 250px;
    }

    .chat-window {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 70vh;
        max-height: calc(100vh - 80px);
        border-radius: 12px 12px 0 0;
        margin: 0;
        z-index: 3000;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .chat-header {
        padding: 0.8rem 1rem;
    }

    .chat-messages {
        padding: 0.8rem;
        gap: 0.8rem;
    }

    .chat-input {
        padding: 0.8rem;
    }

    .chat-input input {
        font-size: 0.95rem;
    }

    .chatbot-toggle {
        width: 50px;
        height: 50px;
    }

    .chatbot-icon-img {
        width: 28px;
        height: 28px;
    }

    .chatbot-container {
        bottom: 15px;
        left: 50%;
        top: auto;
        right: auto;
        transform: translateX(-50%);
    }

    .option-buttons {
        flex-wrap: wrap;
    }

    .reaction-buttons {
        flex-wrap: wrap;
    }

    .category-switcher {
        gap: 0.5rem;
    }

    .search-container {
        max-width: 100%;
    }

    .navbar .logo, .brand-name {
        font-size: 1.8rem;
    }

    .notifications-panel {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
    }

    .cart-sidebar {
        max-width: 100%;
        padding: 0.8rem;
    }

    .cart-header { 
        margin-bottom: 1rem; 
    }

    .cart-items { 
        margin-bottom: 1rem; 
    }

    .quantity-btn { 
        width: 28px; 
        height: 28px; 
    }

    .quantity-display { 
        margin: 0 8px; 
    }

    .file-input { 
        padding: 10px; 
    }

    .form-group input, 
    .form-group select, 
    .form-group textarea { 
        padding: 10px; 
        font-size: 0.95rem; 
    }

    h2 { 
        font-size: 1.4rem; 
    }
}

/* Landscape orientation for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 2rem 15px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .modal {
        max-height: 95vh;
        padding: 1rem;
    }
    
    /* Payment Modal Landscape */
    .payment-modal {
        max-height: 95vh;
    }
    
    .qr-code {
        width: 100px;
        height: 100px;
    }
    
    .order-summary {
        padding: 0.6rem;
    }
    
    .payment-modal .form-group {
        margin-bottom: 0.8rem;
    }
    
    .payment-modal .form-group textarea {
        min-height: 60px;
    }

    /* Small mobile chatbot */
    .chat-window {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 70vh;
        max-height: calc(100vh - 80px);
        border-radius: 12px 12px 0 0;
        margin: 0;
        z-index: 3000;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .chat-header h3 {
        font-size: 1rem;
    }

    .chat-messages {
        padding: 0.6rem;
        gap: 0.6rem;
    }

    .message p {
        font-size: 0.9rem;
        padding: 8px 12px;
    }

    .chat-input {
        padding: 0.6rem;
    }

    .chat-input input {
        font-size: 0.9rem;
        padding: 8px;
    }

    .chatbot-toggle {
        width: 45px;
        height: 45px;
    }

    .chatbot-icon-img {
        width: 24px;
        height: 24px;
    }

    .chatbot-container {
        bottom: 12px;
        left: 50%;
        top: auto;
        right: auto;
        transform: translateX(-50%);
    }

    .notifications-panel {
        max-height: 85vh;
    }

    .cart-sidebar {
        padding: 1rem;
    }

    /* Review avatars mobile */
    .review-avatar {
        width: 36px;
        height: 36px;
    }

    .review-user-details {
        gap: 0.1rem;
    }

    .review-username {
        font-size: 0.9rem;
    }

    .view-profile-hint {
        font-size: 0.7rem;
    }

    .review-header {
        gap: 0.5rem;
    }

    /* Reactor items mobile */
    .reactor-item {
        padding: 10px;
        gap: 8px;
    }

    .reactor-avatar {
        width: 38px;
        height: 38px;
    }

    .reactor-name {
        font-size: 0.9rem;
    }

    .reactor-type {
        font-size: 0.75rem;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Reaction counts mobile */
    .reaction-counts {
        font-size: 0.75rem;
        gap: 8px;
    }

    .reaction-count-item {
        padding: 3px 8px;
        font-size: 0.75rem;
    }
}

/* AOS / scroll animation mobile improvements to reduce layout jumps */
.aos-init {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
}

@media (max-width: 768px) {
    .aos-animate {
        transition: transform 0.5s cubic-bezier(.22,.9,.33,1), opacity 0.45s ease-out !important;
    }

    /* Reduce translate distances used by AOS to avoid visible jumps */
    .aos-animate[data-aos*="fade-up"],
    .aos-animate[data-aos*="fade-down"],
    .aos-animate[data-aos*="fade-left"],
    .aos-animate[data-aos*="fade-right"] {
        transform: translateY(-6px) !important;
        opacity: 1 !important;
    }

    /* Prevent counter width reflow: reserve minimal width */
    .stat-number {
        min-width: 4ch;
        display: inline-block;
        text-align: right;
    }
}
