/* ==================== MOBILE FILTERS SYSTEM ==================== */

/* Mobile Filters Bar - Only visible on mobile */
.mobile-filters-bar {
    display: none;
    width: 100%;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px; /* Reducido de 12px a 8px */
    overflow-x: auto;
    overflow-y: visible; /* IMPORTANTE: Debe ser visible para que el menú no se corte */
    position: relative; /* IMPORTANTE: Para que los menús absolutos se posicionen correctamente */
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.mobile-filters-bar.hiding {
    animation: slideUp 0.3s ease-out;
}

/* Mobile Filters Content - Horizontal scroll container */
.mobile-filters-content {
    display: flex;
    gap: 8px;
    align-items: center;
    min-height: 32px; /* Reducido de 40px a 32px */
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.mobile-filters-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

/* Filter Pills - Base styles */
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px; /* Reducido de 8px a 6px */
    padding: 8px 14px; /* Reducido de 10px 16px a 8px 14px */
    border-radius: 16px; /* Reducido de 20px a 16px */
    border: none;
    font-size: 13px; /* Reducido de 14px a 13px */
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Add Filter Pill (Green) */
.filter-pill-add {
    background: #4CAF50;
    color: white;
}

.filter-pill-add:hover {
    background: #ff5722;
}

.filter-pill-add:active {
    transform: scale(0.95);
}

.filter-pill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; /* Reducido de 20px a 18px */
    height: 18px; /* Reducido de 20px a 18px */
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    font-size: 14px; /* Reducido de 16px a 14px */
    font-weight: bold;
}

/* Applied Filter Pills (Gray) */
.filter-pill-applied {
    background: #e0e0e0;
    color: #333;
}

.dark-mode .filter-pill-applied {
    background: #424242;
    color: #e0e0e0;
}

.filter-pill-applied:hover {
    background: #d0d0d0;
}

.dark-mode .filter-pill-applied:hover {
    background: #525252;
}

.filter-pill-applied:active {
    transform: scale(0.95);
}

.filter-pill-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 14px;
    font-weight: bold;
    margin-left: 4px;
    transition: background 0.2s ease;
}

.filter-pill-remove:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Applied Filters Pills Container */
.applied-filters-pills {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Tags Menu (Vertical) */
.tags-menu {
    position: fixed;
    display: none; /* Hidden by default */
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9998; /* Reducido de 99999 a 9998 para que el spotlight (9999) esté por encima */
    max-width: fit-content;
    max-height: 400px;
    overflow-y: auto;
}

/* Clase específica para posicionamiento del tags-menu */
.tags-menu-positioned {
    display: block !important;
    top: 165px !important;
    left: 7px !important;
}

.tags-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.tags-menu-item:last-child {
    border-bottom: none;
}

.tags-menu-item:hover {
    background: var(--hover-bg);
}

.tags-menu-item.active {
    background: var(--hover-bg);
    font-weight: 600;
}

.tags-menu-item.cancel {
    color: #4CAF50;
    font-weight: 600;
}

/* Options Menu (Lateral Right) */
.options-menu {
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    max-width: fit-content !important;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
}

/* Ocultar scrollbar en options-menu */
.options-menu::-webkit-scrollbar {
    display: none;
}

.options-menu {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Clase específica para posicionamiento del options-menu */
.options-menu-positioned {
    display: block !important;
    top: 165px !important;
}

/* Price inputs styling */
.price-input {
    width: 80px !important;
    max-width: 80px !important;
}

/* Dynamic positioning based on selected tag */
.options-menu.positioned {
    top: auto;
}

.options-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 4px;
}

.options-menu-item:hover {
    background: var(--hover-bg);
}

.options-menu-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.options-menu-item label {
    flex: 1;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

/* Price Range Inputs in Options Menu */
.price-range-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.price-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price-input-group label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.price-input-group input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.price-input-group input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Confirm Button */
.options-menu-confirm {
    width: 100%;
    padding: 10px 16px;
    margin-top: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.options-menu-confirm.active {
    background: #4CAF50;
    color: white;
}

.options-menu-confirm.active:hover {
    background: #ff5722;
}

.options-menu-confirm.active:active {
    transform: scale(0.95);
}

.options-menu-confirm.inactive {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

.dark-mode .options-menu-confirm.inactive {
    background: #424242;
    color: #666;
}

/* Mobile Only - Hide on desktop */
@media (min-width: 768px) {
    .mobile-filters-bar {
        display: none !important;
    }
}

/* Mobile Specific Adjustments */
@media (max-width: 767px) {
    /* Adjust filter toggle button to work with new system */
    .filter-toggle {
        /* Keep existing styles */
    }
    
    /* Hide desktop filter sidebar on mobile */
    .filter-sidebar {
        display: none !important;
    }
}

/* Dark Mode Variables */
.dark-mode {
    --bg-primary: #1e1e1e;
    --bg-secondary: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --hover-bg: #333333;
}

/* Light Mode Variables */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --hover-bg: #f5f5f5;
}

/* Scrollbar Styling for Menus */
.tags-menu::-webkit-scrollbar,
.options-menu::-webkit-scrollbar {
    width: 6px;
}

.tags-menu::-webkit-scrollbar-track,
.options-menu::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.tags-menu::-webkit-scrollbar-thumb,
.options-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.tags-menu::-webkit-scrollbar-thumb:hover,
.options-menu::-webkit-scrollbar-thumb:hover {
    background: #999;
}


/* Botón ELIMINAR sticky en options menu */
.options-menu-delete {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    color: #4CAF50;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid #4CAF50;
    margin-bottom: 8px;
}

.options-menu-delete:hover {
    background: #fff5f2;
}

/* Ajustar labels para word-wrap */
.options-menu-item label {
    word-wrap: break-word;
    white-space: normal;
    flex: 1;
}

/* Ajustar ancho del options-menu */
.options-menu {
    width: auto !important;
}

