/* =====================================================
   Horizontal Filters - Tour List Page
   ===================================================== */

/* Main container */
.horizontal-filters {
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.filters-form-horizontal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

/* =====================================================
   Filter Dropdown Component
   ===================================================== */
.filter-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    height: 48px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary-color);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-dropdown-btn:hover {
    border-color: var(--primary-color);
    background: #fff5f4;
}

.filter-dropdown.open .filter-dropdown-btn {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.filter-dropdown-btn i {
    font-size: 1rem;
}

.filter-dropdown-btn .dropdown-arrow {
    transition: transform 0.2s ease;
    font-size: 0.8rem;
}

.filter-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50px;
}

.filter-dropdown.open .filter-count-badge {
    background: white;
    color: var(--primary-color);
}

/* Dropdown Menu */
.filter-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1000;
    min-width: 280px;
    max-width: 350px;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.filter-dropdown.open .filter-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filter-dropdown-menu-wide {
    min-width: 400px;
    max-width: 500px;
}

.dropdown-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary-color, #333);
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clear-filter-btn {
    background: none;
    border: none;
    color: var(--primary-color, #ff6b61);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.clear-filter-btn:hover {
    background: rgba(255, 107, 97, 0.1);
}

.close-dropdown-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: 300;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-dropdown-btn:hover {
    background: #eee;
    color: #333;
}

/* Desktop/Mobile visibility helpers */
.mobile-only {
    display: none;
}

.desktop-only {
    display: inline-flex;
}

.dropdown-menu-content {
    padding: 0.8rem 1rem;
    max-height: 380px;
    overflow-y: auto;
    flex: 1;
}

.dropdown-menu-content::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.dropdown-menu-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.dropdown-menu-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Tags grid layout */
.tags-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.tags-grid .container_check {
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

/* =====================================================
   Inline Price Filter
   ===================================================== */
.filter-inline {
    display: flex;
    align-items: center;
}

.price-filter-compact {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.4rem 1rem;
    background: white;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 50px;
}

.price-filter-compact i {
    color: var(--primary-color, #ff6b61);
    font-size: 1rem;
}

.price-inputs-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.price-input-compact {
    width: 70px;
    padding: 0.3rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    color: var(--secondary-color, #333);
    transition: border-color 0.2s;
}

.price-input-compact:focus {
    outline: none;
    border-color: var(--primary-color, #ff6b61);
}

.price-input-compact::placeholder {
    color: #aaa;
    font-weight: 400;
}

.price-separator {
    color: #999;
    font-weight: 300;
}

.price-currency-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary-color, #333);
    background: #f0f0f0;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* =====================================================
   Rating Buttons
   ===================================================== */
.rating-buttons {
    display: flex;
    gap: 0.4rem;
}

.rating-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.5rem 0.7rem;
    background: white;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    color: var(--secondary-color, #333);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.rating-btn input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.rating-btn:hover {
    border-color: #ffc107;
    background: #fffbeb;
}

.rating-btn.active,
.rating-btn:has(input:checked) {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    border-color: #ffc107;
    color: #333;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.rating-star {
    font-size: 0.9rem;
}

.rating-value {
    font-weight: 700;
}

/* =====================================================
   Filter Sections (inside dropdown)
   ===================================================== */
.filter-section {
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.filter-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.filter-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--secondary-color, #333);
    margin-bottom: 0.8rem;
}

.filter-section-title i {
    color: var(--primary-color, #ff6b61);
}

/* Price inputs in dropdown */
.price-inputs-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.price-input-group label {
    font-size: 0.75rem;
    color: #888;
    font-weight: 500;
}

/* Price Range Slider */
.price-slider {
    position: relative;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    margin: 15px 5px;
    cursor: pointer;
}

.price-slider-track {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #ff6b61), #ff8a80);
    border-radius: 3px;
    top: 0;
}

.price-slider-handle {
    position: absolute;
    width: 22px;
    height: 22px;
    background: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    top: -9px;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    z-index: 2;
}

.price-slider-handle:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.price-slider-handle.dragging {
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(255, 107, 97, 0.4);
}

.price-input {
    width: 90px;
    padding: 0.5rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.price-input:focus {
    outline: none;
    border-color: var(--primary-color, #ff6b61);
}

.price-separator {
    color: #999;
    font-weight: 300;
    margin-top: 1rem;
}

.price-currency {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    margin-top: 1rem;
}

/* Rating buttons grid in dropdown */
.rating-buttons-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Tags list in dropdown */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    list-style: none;
    padding: 0;
    margin: 0;
}

.tags-list .container_check {
    font-size: 0.85rem;
    color: var(--secondary-color, #333);
}

.tags-list .tag-name {
    color: var(--secondary-color, #333);
    font-weight: 500;
}

.tags-list .filter-count {
    color: #888;
    font-size: 0.8em;
}

.tags-list .filter-item {
    list-style: none;
}

/* Dropdown footer with apply button */
.dropdown-menu-footer {
    padding: 0.8rem 1rem;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.clear-filters-btn {
    flex: 0 0 auto;
    padding: 0.7rem 1.2rem;
    background: var(--secondary-color);
    color: var(--card-bg);
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--card-bg);
}

.clear-filters-btn:active {
    transform: scale(0.98);
}

.apply-filters-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    background: var(--primary-color);
    color: var(--card-bg);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.apply-filters-btn:hover {
    background: #ff5449;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 97, 0.3);
}

/* =====================================================
   Categories Scroll Container
   ===================================================== */
/* Categories Section Wrapper */
.categories-section-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    position: relative;
}

.categories-scroll-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    padding: 0 4px;
    /* Tiny padding to prevent chip border cutoff */
}

/* Scroll Buttons */
.scroll-btn {
    display: none;
    /* Hidden by default, shown via JS */
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 10;
    position: absolute;
    /* Absolute relative to wrapper */
    top: 50%;
    transform: translateY(-50%);
    color: #333;
    transition: all 0.2s;
    opacity: 0;
    visibility: hidden;
}

.scroll-btn.visible {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.scroll-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: var(--primary-color, #ff6b61);
}

.scroll-left {
    left: -18px;
    /* Offset to overlap slightly or sit outside */
}

.scroll-right {
    right: -18px;
}

/* Move wrapper scrolling logic here */
.categories-scroll-container::-webkit-scrollbar {
    display: none;
}

.categories-scroll-wrapper {
    display: flex;
    gap: 0.5rem;
    padding: 0;
    min-width: max-content;
    align-items: center;
    /* Ensure vertical centering */
}

/* Category Chip Style */
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0 1rem;
    height: 48px;
    /* Fixed height to match filter button */
    background: white;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.95rem;
    /* Match filter button */
    font-weight: 600;
    /* Match filter button */
    color: var(--secondary-color, #333);
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-chip:hover {
    border-color: var(--primary-color, #ff6b61);
    background: #fff5f4;
}

.category-chip.active {
    background: var(--primary-color, #ff6b61);
    border-color: var(--primary-color, #ff6b61);
    color: white;
}

.category-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.category-name {
    font-weight: 600;
}

.category-count {
    font-size: 0.8rem;
    opacity: 0.7;
}

.category-chip.active .category-count {
    opacity: 0.9;
}

/* =====================================================
   Reset Button
   ===================================================== */
.filter-reset-wrapper {
    margin-left: auto;
}

.filter-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: transparent;
    border: 2px dashed #ddd;
    border-radius: 5px;
    color: #888;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.filter-reset-btn:hover {
    border-color: var(--primary-color, #ff6b61);
    color: var(--primary-color, #ff6b61);
    background: #fff5f4;
    text-decoration: none;
}

.filter-reset-btn i {
    font-size: 0.9rem;
}

/* =====================================================
   Mobile Filter Toggle
   ===================================================== */
.mobile-filter-toggle {
    display: none;
    margin-bottom: 1rem;
}

.mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.8rem 1.2rem;
    background: white;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-color, #333);
    transition: all 0.2s ease;
    justify-content: center;
}

.mobile-filter-btn:hover,
.mobile-filter-btn.active {
    border-color: var(--primary-color, #ff6b61);
    background: var(--primary-color, #ff6b61);
    color: white;
}

.mobile-filter-btn i {
    font-size: 1.2rem;
}

.active-filters-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--primary-color, #ff6b61);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 50px;
}

.mobile-filter-btn.active .active-filters-count {
    background: white;
    color: var(--primary-color, #ff6b61);
}

/* =====================================================
   Responsive Styles
   ===================================================== */

/* Tablet */
@media (max-width: 992px) {
    .filters-form-horizontal {
        gap: 0.8rem;
    }

    .filter-dropdown-menu {
        min-width: 250px;
    }

    .filter-dropdown-menu-wide {
        min-width: 320px;
        max-width: 90vw;
    }

    .price-input-compact {
        width: 60px;
    }

    .filter-reset-wrapper {
        margin-left: 0;
        width: 100%;
        margin-top: 0.5rem;
    }

    .filter-reset-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .horizontal-filters {
        padding: 0.6rem;
        margin-bottom: 1rem;
        border-radius: 8px;
        position: relative;
    }

    .filters-form-horizontal {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.5rem;
    }

    /* Скрываем мобильный toggle - используем inline фильтры */
    .mobile-filter-toggle {
        display: none;
    }

    .filter-dropdown {
        flex-shrink: 0;
    }

    /* Categories scroll container on mobile */
    /* Categories scroll container on mobile */
    .categories-scroll-container {
        flex: 1;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 0;
    }

    .categories-section-wrapper {
        padding-right: 0;
        /* No padding needed for arrows on mobile */
    }

    .scroll-btn {
        display: none !important;
        /* Hide scroll buttons on mobile */
    }

    .categories-scroll-container::-webkit-scrollbar {
        display: none;
    }

    .categories-scroll-wrapper {
        display: flex;
        gap: 0.4rem;
        padding-right: 20px;
        /* Space to show more content indicator */
    }

    .category-chip {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }

    .category-count {
        display: none;
        /* Hide counts on mobile for compactness */
    }

    .filter-dropdown-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        border-radius: 25px;
    }

    .filter-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        min-width: 100%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
        transform: translateY(100%);
        z-index: 1100;
    }

    .filter-dropdown.open .filter-dropdown-menu {
        transform: translateY(0);
    }

    .filter-dropdown-menu-wide {
        min-width: 100%;
        max-width: 100%;
    }

    .dropdown-menu-content {
        max-height: 70vh;
        padding: 1rem;
    }

    /* Mobile visibility - show X button and mobile clear */
    .mobile-only {
        display: inline-flex !important;
    }

    .desktop-only {
        display: none !important;
    }

    .close-dropdown-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* More space for tags on mobile */
    .tags-list {
        max-height: 300px;
    }

    /* Overlay for mobile dropdown */
    .filter-dropdown.open::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1050;
    }

    /* Price filter */
    .price-filter-compact {
        padding: 0.5rem 0.8rem;
        border-radius: 25px;
    }

    .price-input-compact {
        width: 55px;
        padding: 0.25rem 0.4rem;
        font-size: 0.85rem;
    }

    .price-currency-label {
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
    }

    /* Rating buttons */
    .rating-buttons {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.3rem;
    }

    .rating-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        min-width: auto;
    }

    .rating-star {
        font-size: 0.8rem;
    }

    .rating-value {
        font-size: 1rem;
    }

    /* Reset button - hide on mobile, use Clear All in dropdown instead */
    .filter-reset-wrapper {
        display: none;
    }

    .tags-grid {
        grid-template-columns: 1fr;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .price-input-compact {
        width: 65px;
        font-size: 0.85rem;
    }

    .rating-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }

    .filter-dropdown-btn {
        font-size: 0.9rem;
    }
}

/* =====================================================
   Tours Full Width Grid (for tour cards below filters)
   ===================================================== */
.tours-full-width {
    width: 100%;
}

.tours-full-width .tours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

@media (max-width: 768px) {
    .tours-full-width .tours-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .tours-full-width .tours-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}