/* MOBILE WIDGETS POSITIONING FIX */
/* Mengatasi overlap antara live chat dan mobile filter button */

/* ===== MOBILE FILTER BUTTON REPOSITIONING ===== */
.mobile-filter-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
    background: var(--gold-color, #d4af37);
    color: #1a1a1a;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    transition: all 0.3s ease;
    font-size: 20px;
    cursor: pointer;
}

/* ===== MOBILE RESPONSIVE POSITIONING ===== */
@media (max-width: 768px) {
    /* LIVE CHAT - Tetap di kanan bawah */
    .chat-widget {
        bottom: 15px;
        right: 15px;
        z-index: 99998;
    }
    
    .chat-button {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    /* MOBILE FILTER - Pindah ke kiri bawah */
    .mobile-filter-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        bottom: 15px;
        left: 15px; /* Pindah ke kiri */
        right: auto;
        width: 55px;
        height: 55px;
        font-size: 18px;
        z-index: 1040; /* Di bawah live chat */
    }
    
    /* Alternative: Stack vertically di kanan */
    .mobile-widgets-stack .mobile-filter-btn {
        bottom: 85px; /* Di atas live chat */
        left: auto;
        right: 15px;
    }
    
    .mobile-widgets-stack .chat-widget {
        bottom: 15px;
        right: 15px;
    }
}

@media (max-width: 576px) {
    /* Extra small screens - lebih kompak */
    .mobile-filter-btn {
        width: 50px;
        height: 50px;
        font-size: 16px;
        bottom: 15px;
        left: 15px;
    }
    
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    /* Stack mode untuk layar sangat kecil */
    .mobile-widgets-stack .mobile-filter-btn {
        bottom: 75px;
        left: auto;
        right: 15px;
    }
}

/* ===== WIDGET CONTAINER APPROACH ===== */
.mobile-widgets-container {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 99998;
    display: none;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
}

@media (max-width: 768px) {
    .mobile-widgets-container {
        display: flex;
    }
    
    /* Hide individual positioned widgets */
    .mobile-widgets-container ~ .mobile-filter-btn,
    .mobile-widgets-container ~ .chat-widget {
        display: none !important;
    }
}

.mobile-widgets-container .widget-button {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mobile-widgets-container .filter-widget {
    background: var(--gold-color, #d4af37);
    color: #1a1a1a;
    order: 2; /* Filter di bawah */
}

.mobile-widgets-container .chat-widget-btn {
    background: linear-gradient(135deg, #d4af37, #b08a1a);
    color: white;
    order: 1; /* Chat di atas */
    animation: pulse 2s infinite;
}

.mobile-widgets-container .widget-button:hover {
    transform: scale(1.1);
}

.mobile-widgets-container .widget-button.has-active-filters::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #dc2626;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

/* ===== CORNER POSITIONING OPTIONS ===== */
.mobile-corner-layout {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100px;
    height: 100px;
    pointer-events: none;
    z-index: 99998;
    display: none;
}

@media (max-width: 768px) {
    .mobile-corner-layout {
        display: block;
    }
    
    .mobile-corner-layout .corner-filter {
        position: absolute;
        bottom: 80px;
        right: 15px;
        width: 50px;
        height: 50px;
        background: var(--gold-color, #d4af37);
        color: #1a1a1a;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        pointer-events: auto;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
    }
    
    .mobile-corner-layout .corner-chat {
        position: absolute;
        bottom: 15px;
        right: 15px;
        pointer-events: auto;
    }
    
    .mobile-corner-layout .corner-filter:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 18px rgba(212, 175, 55, 0.6);
    }
}

/* ===== HORIZONTAL LAYOUT BOTTOM ===== */
.mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e5e7eb;
    display: none;
    align-items: center;
    justify-content: space-around;
    z-index: 99998;
    padding: 10px 20px;
}

body.dark-mode .mobile-bottom-bar {
    background: rgba(30, 41, 59, 0.95);
    border-top-color: #374151;
}

@media (max-width: 768px) {
    .mobile-bottom-bar {
        display: flex;
    }
    
    /* Hide other positioned widgets */
    .mobile-bottom-bar ~ .mobile-filter-btn,
    .mobile-bottom-bar ~ .chat-widget {
        display: none !important;
    }
    
    /* Add bottom padding to body */
    body.has-mobile-bottom-bar {
        padding-bottom: 70px;
    }
}

.mobile-bottom-bar .bottom-widget {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: var(--gold-color, #d4af37);
    color: #1a1a1a;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.mobile-bottom-bar .bottom-widget:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.5);
}

.mobile-bottom-bar .chat-bottom-widget {
    background: linear-gradient(135deg, #d4af37, #b08a1a);
    color: white;
}

/* ===== PREFERRED SOLUTION: SIMPLE STACKING ===== */
/* Default: Filter di kiri, Chat di kanan */
@media (max-width: 768px) {
    /* Live Chat stays right */
    .chat-widget {
        bottom: 15px;
        right: 15px;
        z-index: 99998;
    }
    
    /* Filter moves to left */
    .mobile-filter-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        bottom: 15px;
        left: 15px;
        right: auto;
        width: 55px;
        height: 55px;
        font-size: 18px;
        z-index: 1040;
        background: var(--gold-color, #d4af37);
        color: #1a1a1a;
        border: none;
        border-radius: 50%;
        box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
        transition: all 0.3s ease;
    }
    
    .mobile-filter-btn:hover {
        background: #f4e17a;
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
    }
    
    .mobile-filter-btn:active {
        transform: scale(0.95);
    }
    
    /* Active filter indicator */
    .mobile-filter-btn.has-active-filters {
        background: #dc2626;
    }
    
    .mobile-filter-btn.has-active-filters::after {
        content: '';
        position: absolute;
        top: -2px;
        right: -2px;
        width: 16px;
        height: 16px;
        background: #ef4444;
        border-radius: 50%;
        border: 2px solid #ffffff;
    }
}

/* Extra small screens */
@media (max-width: 576px) {
    .mobile-filter-btn {
        width: 50px !important;
        height: 50px !important;
        font-size: 16px !important;
        bottom: 15px !important;
        left: 15px !important;
    }
    
    .chat-widget {
        bottom: 15px !important;
        right: 15px !important;
    }
    
    .chat-button {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }
}

/* ===== DARK MODE COMPATIBILITY ===== */
body.dark-mode .mobile-filter-btn {
    background: var(--dark-accent, #d4af37);
    color: #1a1a1a;
}

body.dark-mode .mobile-filter-btn:hover {
    background: #f4e17a;
}

body.dark-mode .mobile-bottom-bar {
    background: rgba(30, 41, 59, 0.95);
    border-top-color: #374151;
}

/* ===== ACCESSIBILITY ===== */
.mobile-filter-btn:focus {
    outline: 2px solid var(--gold-color, #d4af37);
    outline-offset: 2px;
}

/* ===== ANIMATION IMPROVEMENTS ===== */
@keyframes filterPulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    }
    50% {
        box-shadow: 0 6px 25px rgba(212, 175, 55, 0.6);
    }
}

.mobile-filter-btn.has-active-filters {
    animation: filterPulse 2s infinite;
}

/* ===== UTILITY CLASSES ===== */
.hide-mobile-widgets .mobile-filter-btn,
.hide-mobile-widgets .chat-widget {
    display: none !important;
}

.mobile-widgets-left .mobile-filter-btn {
    left: 15px !important;
    right: auto !important;
}

.mobile-widgets-stack .mobile-filter-btn {
    bottom: 85px !important;
    left: auto !important;
    right: 15px !important;
}
