/**
 * FestivalPro Program Filter Styles
 *
 * Modern webshop-style filtering
 *
 * @package FestivalPro
 */

/* ==========================================================================
   Layout
   ========================================================================== */

#festivalpro-program {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
}

@media (min-width: 992px) {
    #festivalpro-program {
        flex-direction: row;
        align-items: flex-start;
    }

    .fp-filter-panel {
        flex: 0 0 280px;
        width: 280px;
        position: sticky;
        top: 45px;
        max-height: calc(100vh - 120px);
        align-self: flex-start;
    }

    .fp-main-content {
        flex: 1;
        min-width: 0;
        min-height: 500px;
    }

    /* Full width when no filter panel */
    #festivalpro-program:not(:has(.fp-filter-panel)) .fp-main-content {
        max-width: 100%;
    }
}

/* ==========================================================================
   Filter Panel
   ========================================================================== */

.fp-filter-panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    min-height: fit-content;
}

.fp-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #FFC000;
    margin-bottom: 0.75rem;
}

.fp-filter-clear {
    background: none;
    border: none;
    color: #999;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    text-decoration: underline;
    transition: color 0.15s;
    display: none;
}

.fp-filter-group.fp-has-selection .fp-filter-clear {
    display: inline-block;
}

.fp-filter-clear:hover {
    color: #333;
}

.fp-filter-title {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #333;
}

.fp-filter-group {
    margin-bottom: 1.5rem;
}

.fp-filter-group:last-child {
    margin-bottom: 0;
}

/* Filter List (checkboxes) */
.fp-filter-list {
    list-style: none !important;
    list-style-type: none !important;
    padding: 0 !important;
    margin: 0;
}

.fp-filter-list li {
    list-style: none !important;
    list-style-type: none !important;
    padding-left: 0;
    margin-left: 0;
}

.fp-filter-list li::before,
.fp-filter-list li::marker {
    display: none !important;
    content: none !important;
}

/* Venues filter - scrollable with max-height */
[data-filter="venues"] .fp-filter-list {
    max-height: 200px;
}

/* Categories filter - scrollable with max-height */
[data-filter="categories"] .fp-filter-list {
    max-height: 200px;
    overflow-y: auto;
}

/* Prices filter - scrollable with max-height */
[data-filter="prices"] .fp-filter-list {
    max-height: 200px;
    overflow-y: auto;
}

.fp-filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    cursor: pointer;
    transition: background-color 0.15s;
}

.fp-filter-option:hover {
    background-color: rgba(255, 192, 0, 0.1);
}

.fp-filter-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.fp-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.fp-filter-option input:checked + .fp-checkbox {
    background: #FFC000;
    border-color: #FFC000;
}

.fp-filter-option input:checked + .fp-checkbox::after {
    content: '✓';
    color: #333;
    font-size: 12px;
    font-weight: bold;
}

.fp-filter-option input:focus + .fp-checkbox {
    box-shadow: 0 0 0 2px rgba(255, 192, 0, 0.3);
}

.fp-label {
    font-size: 0.9rem;
    color: #333;
}

/* Search */
.fp-search-wrapper {
    position: relative;
}

.fp-search-wrapper input {
    width: 100%;
    padding: 0.6rem 2rem 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.fp-search-wrapper input:focus {
    outline: none;
    border-color: #FFC000;
    box-shadow: 0 0 0 2px rgba(255, 192, 0, 0.2);
}

.fp-search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.fp-search-clear:hover {
    color: #333;
}

/* Age Filter */
.fp-age-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fp-age-inputs input {
    width: 70px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.fp-age-inputs span {
    color: #666;
}

/* ==========================================================================
   Mobile Filter Toggle
   ========================================================================== */

.fp-mobile-toggle {
    display: none;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-align: left;
}

.fp-mobile-toggle::after {
    content: '▼';
    float: right;
    transition: transform 0.2s;
}

.fp-mobile-toggle.fp-active::after {
    transform: rotate(180deg);
}

@media (max-width: 991px) {
    .fp-mobile-toggle {
        display: block;
    }

    .fp-filter-panel {
        display: none;
        margin-top: 0.5rem;
    }

    .fp-filter-panel.fp-open {
        display: block;
    }
}

/* ==========================================================================
   Filter Chips
   ========================================================================== */

.fp-filter-chips {
    display: none;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fff8e5;
    border-radius: 4px;
    align-items: center;
}

.fp-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem 0.35rem 0.75rem;
    background: #FFC000;
    border-radius: 50px;
    font-size: 0.85rem;
    color: #333;
}

.fp-chip-label {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fp-chip-remove {
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
    color: #333;
    opacity: 0.7;
}

.fp-chip-remove:hover {
    opacity: 1;
}

.fp-clear-all {
    background: none;
    border: none;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    margin-left: auto;
}

.fp-clear-all:hover {
    color: #333;
}

/* ==========================================================================
   Results Header
   ========================================================================== */

.fp-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.fp-result-count {
    font-size: 0.9rem;
    color: #666;
}

/* ==========================================================================
   Show Items
   ========================================================================== */

.fp-date-group {
    margin-bottom: 2rem;
}

.fp-date-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #FFC000;
    margin-bottom: 1rem;
}

.fp-shows {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fp-show-item {
    position: relative;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.fp-show-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #FFC000;
}

.fp-show-link {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    align-items: center;
}

@media (max-width: 768px) {
    .fp-show-link {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.fp-show-main {
    min-width: 0;
}

.fp-show-title {
    font-weight: 700;
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.25rem;
}

.fp-show-authors {
    font-size: 0.9rem;
    color: #666;
}

.fp-show-meta {
    display: flex;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .fp-show-meta {
        flex-wrap: wrap;
        gap: 0.75rem 1.5rem;
    }
}

.fp-show-meta > div {
    min-width: 80px;
}

.fp-show-meta .fp-label {
    display: block;
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 0.1rem;
}

.fp-show-meta .fp-value {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.fp-show-action {
    text-align: right;
}

/* Buttons */
.fp-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
}

.fp-btn-primary {
    background: #FFC000;
    color: #333;
}

.fp-btn-warning {
    background: #ff6600;
    color: white;
}

.fp-btn-disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

.fp-btn-free {
    background: #28a745;
    color: white;
}

/* Favorite Button */
.fp-favorite {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1;
}

.fp-favorite .fa-heart {
    color: #ccc;
    font-size: 1rem;
    transition: color 0.2s;
}

.fp-favorite:hover .fa-heart,
.fp-favorite.minfestival-remove .fa-heart {
    color: #e74c3c;
}

/* No Results */
.fp-no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.fp-loading {
    text-align: center;
    padding: 3rem;
}

.fp-loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top-color: #FFC000;
    border-radius: 50%;
    animation: fp-spin 0.8s linear infinite;
}

@keyframes fp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Dropdown Filter Style (Old style matching)
   ========================================================================== */

/* Dropdown style: stack vertically, full width */
#festivalpro-program[data-filter-style="dropdowns"] {
    display: block !important;
}

#festivalpro-program[data-filter-style="dropdowns"] .fp-main-content {
    width: 100%;
    max-width: 100%;
}

.fp-dropdown-filters {
    width: 100%;
    margin-bottom: 10px;
}

/* Category fields wrapper (Program + Festivalløype) - white background */
.fp-cat-fields-wrapper {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 19px 23px;
    background: #FFF;
}

.fp-cat-fields-wrapper .fp-dropdown-row {
    width: 100%;
}

.fp-cat-fields-wrapper .fp-dropdown-label {
    color: #1D1C1B;
}

.fp-cat-fields-wrapper .fp-dropdown-clear {
    color: #1D1C1B;
}

/* Search box (Search + Dag + Spillested + Pris + Age) - yellow background */
.fp-search-box {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 19px 23px;
    background: #FFCE29;
}

.fp-dropdown-search {
    width: 100%;
    margin-bottom: 10px;
}

.fp-search-box .fp-dropdown-row {
    width: 100%;
}

.fp-dropdown-search input {
    background-color: white !important;
    color: #1D1C1B !important;
    width: 100%;
    height: 56px;
    font-size: 20px;
    padding: 5px 15px;
    border: none;
    border-radius: 0 !important;
}

.fp-dropdown-search input:focus {
    outline: none;
}

.fp-dropdown-search input::placeholder {
    color: #1D1C1B !important;
}

.fp-dropdown-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.fp-dropdown-wrapper {
    width: 30%;
    flex: none;
}

/* Custom dropdown with checkboxes */
.fp-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.fp-dropdown-label {
    color: #1D1C1B;
    font-weight: 600;
}

.fp-dropdown-clear {
    background: none;
    border: none;
    color: #1D1C1B;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    text-decoration: underline;
    opacity: 0.7;
    display: none;
}

.fp-dropdown-wrapper.fp-has-selection .fp-dropdown-clear {
    display: inline-block;
}

.fp-dropdown-clear:hover {
    opacity: 1;
}

.fp-custom-dropdown {
    position: relative;
}

.fp-dropdown-toggle {
    font-size: 18px;
    padding: 0 40px 0 15px;
    width: 100%;
    color: #FFF;
    border-radius: 0 !important;
    background-color: #1D1C1B;
    border: none;
    height: 51px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fp-dropdown-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.fp-dropdown-arrow {
    font-size: 12px;
    transition: transform 0.2s;
    position: absolute;
    right: 15px;
}

.fp-custom-dropdown.fp-open .fp-dropdown-arrow {
    transform: rotate(180deg);
}

.fp-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1D1C1B;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.fp-custom-dropdown.fp-open .fp-dropdown-menu {
    display: block;
}

.fp-dropdown-item {
    padding: 0;
}

.fp-dropdown-item label {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    color: #FFF;
    transition: background-color 0.15s;
}

.fp-dropdown-item label:hover {
    background-color: #333;
}

.fp-dropdown-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.fp-dropdown-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #666;
    border-radius: 3px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
}

.fp-dropdown-item input:checked + .fp-dropdown-checkbox {
    background: #FFCE29;
    border-color: #FFCE29;
}

.fp-dropdown-item input:checked + .fp-dropdown-checkbox::after {
    content: '✓';
    color: #1D1C1B;
    font-size: 12px;
    font-weight: bold;
}

.fp-dropdown-item-label {
    font-size: 16px;
}

.fp-age-wrapper {
    display: flex;
    gap: 10px;
    width: 30%;
    flex: none;
}

.fp-age-wrapper label {
    flex: 1;
}

@media (max-width: 981px) {
    .fp-dropdown-wrapper {
        width: 100%;
    }

    .fp-dropdown-row {
        flex-direction: column;
    }

    .fp-age-wrapper {
        width: 100%;
        flex-direction: row;
    }

    .fp-dropdown-select {
        margin-bottom: 10px;
    }
}



/* Unavailable filter options (0 results with current filters) */
.fp-filter-option.fp-unavailable {
    opacity: 0.4;
    pointer-events: none;
    order: 1;
}

.fp-filter-option.fp-unavailable .fp-checkbox {
    border-color: #ddd;
}

.fp-filter-list {
    display: flex;
    flex-direction: column;
}

.fp-filter-option:not(.fp-unavailable) {
    order: 0;
}

/* Dropdown unavailable items */
.fp-dropdown-item.fp-unavailable label {
    opacity: 0.4;
    pointer-events: none;
}

/* Disabled/Sold out state */
.et_pb_custom_button.disabled,
.et_pb_custom_button[disabled] {
    background: #ccc !important;
    color: #666 !important;
    cursor: not-allowed;
}



/* Few seats warning */
.custom_button_wrapper .et_pb_custom_button.warning {
    background: #ff6600 !important;
    color: #fff !important;
}