/* =============================================================================
   Advanced Search Component Styles
   ============================================================================= */

/* --- Alpine x-cloak: hide until Alpine initializes --- */
[x-cloak] { display: none !important; }

/* --- Skeleton Placeholders --- */
.chip-skeleton {
    display: inline-block;
    width: 70px;
    height: 32px;
    background: rgba(115, 115, 115, 0.3);
    border-radius: 100px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border: unset;
}
.chip-skeleton:hover{
    border: unset;
    cursor: unset;
}

.as-filter-bar__item.chip-skeleton {
    border-radius: 12px;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* --- Toolbar skeleton / real swap --- */
.as-toolbar-wrapper {
    position: relative;
}
.as-toolbar-skeleton {
    /* Skeleton occupies normal flow, sets the height */
}
.as-toolbar-wrapper .as-toolbar {
    /* When both exist briefly, real toolbar overlays the skeleton */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}
/* Once skeleton is removed, real toolbar returns to normal flow */
.as-toolbar-wrapper .as-toolbar:only-child {
    position: static;
}

/* --- Model Chips Wrapper (smooth slide in/out) --- */
.as-model-chips-wrapper {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
    margin-bottom: 0;
}

.as-model-chips--visible {
    max-height: 200px;
    opacity: 1;
    margin-bottom: 1rem;
}

/* --- Advanced Search Container --- */
.as-advanced-search {
    padding: 0 0 1rem;
}

/* --- Filter Bar --- */
.as-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

.as-filter-bar__item {
    flex-shrink: 0;
}

/* --- Select Filter (Custom Dropdown) --- */
.as-select-filter {
    position: relative;
    min-width: 140px;
    display: inline-block;
}

.as-select-filter__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    height: 42px;
    border-radius: 12px;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    background-color: rgba(107, 107, 107, 1) !important;
    border: 1px solid rgba(166, 166, 166, 1) !important;
    cursor: pointer;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    text-align: start;
    color: white;
    white-space: nowrap;
}

.as-select-filter__trigger:hover {
    border-color: var(--yellow-color);
}

.as-select-filter__trigger:focus {
    border-color: var(--yellow-color);
    box-shadow: 0 0 0 0.2rem rgba(211, 255, 1, 0.15);
    outline: none;
}

.as-select-filter__label {
    overflow: hidden;
    text-overflow: ellipsis;
    color:white !important;
}

.as-select-filter__arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.as-select-filter__arrow--open {
    transform: rotate(180deg);
}

.as-select-filter__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    inset-inline-start: 0;
    min-width: 100%;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1050;
    background: rgba(53, 52, 53, 1);
    border: 1px solid rgba(115, 115, 115, 1);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    padding: 0.25rem 0;
}

.as-select-filter__option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background-color 0.1s ease;
    color: white;
}

.as-select-filter__option:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.as-select-filter__option--active {
    background-color: rgba(211, 255, 1, 0.15);
    color: var(--yellow-color);
    font-weight: 600;
}

.as-select-filter__option--highlighted {
    background-color: rgba(255, 255, 255, 0.12);
}

.as-select-filter__option--active.as-select-filter__option--highlighted {
    background-color: rgba(211, 255, 1, 0.25);
}

/* Search input inside dropdown */
.as-select-filter__search {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid rgba(115, 115, 115, 0.5);
    position: sticky;
    top: -5px;
    background: rgba(53, 52, 53, 1);
    z-index: 1;
}

.as-select-filter__search-input {
    width: 100%;
    height: 32px;
    border: 1px solid rgba(115, 115, 115, 1);
    border-radius: 8px;
    background: rgba(64, 64, 64, 1);
    color: white;
    font-size: 0.8125rem;
    padding: 0 0.625rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.as-select-filter__search-input::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

.as-select-filter__search-input:focus {
    /*border-color: var(--yellow-color);*/
}

.as-select-filter__no-results {
    padding: 0.75rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8125rem;
}

/* --- Advanced Search Button --- */
.as-btn-advanced {
    /*height: 42px;*/
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    /*border-radius: 12px;*/
    /*font-size: 0.875rem;*/
    /*padding: 0.375rem 1rem;*/
}
.as-btn-advanced span{
    color : white;
}
.as-btn-advanced:hover span,.as-btn-advanced:hover i{
    color: var(--yellow-color);
}

/* --- Toggle Chips --- */
.as-toggle-chips {
    /*margin-bottom: 1rem;*/
}

.as-toggle-chips__label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

/* Scrollable chip container (for makers/models) */
.as-chips-scrollable {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
}

.as-chips-scrollable::-webkit-scrollbar {
    height: 4px;
}

.as-chips-scrollable::-webkit-scrollbar-thumb {
    background: rgba(115, 115, 115, 1);
    border-radius: 4px;
}

/* Chip with image (maker logo) */
.chip-label--with-image {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding-inline-start: 0.35rem;
}

.chip-label__image {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Column layout: icon on top (larger), label underneath */
.chips__container--image-column {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.chips__container--image-column .chip-label--image-column {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border-radius: 1rem;
    white-space: normal;
    min-width: unset;
    text-align: center;
}
.chips__container--image-column .chip-label--image-column .chip-label__image {
    width: 100%;
    height: 36px;
    border-radius: 0;
}
.chips__container.chips__group{
    gap: 0;
}
.chips__container.chips__group .chip-label {
    border-radius: 1px !important;
}
/* --- Range Input --- */
.as-range-input {
    margin-bottom: 1rem;
}

.as-range-input__label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.as-range-input__fields {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.as-range-input__field {
    flex: 1;
    height: 42px;
    border-radius: 12px;
    font-size: 0.875rem;
    background-color: rgba(64, 64, 64, 1) !important;
    border: 1px solid rgba(166, 166, 166, 1) !important;
    color: white !important;
}

.as-range-input__field::placeholder {
    color: rgba(156, 156, 156, 1) !important;
}

.as-range-input__field:focus {
    border-color: var(--yellow-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(211, 255, 1, 0.15);
    outline: none;
}

.as-range-input__separator {
    color: rgba(156, 156, 156, 1);
    font-weight: 500;
    flex-shrink: 0;
}

/* --- Autocomplete --- */
.as-autocomplete__container{
    width: 40%;
    margin: auto;
}
.as-autocomplete {
    position: relative;
}

.as-autocomplete__input-wrap {
    position: relative;
}

.as-autocomplete__input {
    height: 48px;
    border-radius: 12px;
    padding-inline-start: 2.75rem;
    font-size: 0.95rem;
    border: 1px solid rgba(166, 166, 166, 1);
    background-color: rgba(64, 64, 64, 1) !important;
    color: white !important;
}

.as-autocomplete__input::placeholder {
    color: rgba(156, 156, 156, 1) !important;
}

.as-autocomplete__input:focus {
    border-color: var(--yellow-color);
    box-shadow: 0 0 0 0.2rem rgba(211, 255, 1, 0.15);
}

.as-autocomplete__icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 0.85rem;
    transform: translateY(-50%);
    color: rgba(156, 156, 156, 1);
    pointer-events: none;
    display: flex;
    align-items: center;
}

/* --- Suggestions Dropdown --- */
.as-suggestions-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    z-index: 1050;
    background: rgba(53, 52, 53, 1);
    border: 1px solid rgba(115, 115, 115, 1);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    max-height: 360px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.as-suggest-group {
    padding: 0.25rem 0;
}

.as-suggest-group + .as-suggest-group {
    border-top: 1px solid rgba(115, 115, 115, 1);
}

.as-suggest-category {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(156, 156, 156, 1);
    letter-spacing: 0.05em;
}

.as-suggest-category__icon {
    font-size: 0.7rem;
    opacity: 0.7;
}

.as-suggest-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.1s ease;
    gap: 0.5rem;
    color: white;
}

.as-suggest-item:hover,
.as-suggest-item--highlighted {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Suggestion item icons */
.as-suggest-item__icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
}

.as-suggest-item__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.as-suggest-item__icon--fallback {
    background: rgba(64, 64, 64, 1);
    color: rgba(156, 156, 156, 1);
    font-size: 0.8rem;
}

.as-suggest-text {
    flex: 1;
    font-size: 0.9rem;
    color: white;
}

.as-suggest-text mark {
    background-color: rgba(211, 255, 1, 0.2);
    color: var(--yellow-color);
    padding: 0;
    border-radius: 2px;
}

.as-suggest-count {
    font-size: 0.75rem;
    color: rgba(156, 156, 156, 1);
    flex-shrink: 0;
    margin-inline-start: auto;
}

.as-suggest-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: rgba(156, 156, 156, 1);
    font-size: 0.875rem;
}

.as-suggest-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    color: rgba(156, 156, 156, 1);
}

.as-suggest-error__retry {
    margin-inline-start: auto;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.15s;
}

.as-suggest-error__retry:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* --- Lookup Error (main search + popup) --- */
.as-lookup-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1.25rem 1rem;
    font-size: 0.875rem;
    color: rgba(156, 156, 156, 1);
    border: 1px dashed rgba(115, 115, 115, 0.5);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.as-lookup-error--popup {
    min-height: 300px;
    border: none;
    flex-direction: column;
    gap: 1rem;
}

.as-lookup-error__retry {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.15s;
}

.as-lookup-error__retry:hover {
    background: rgba(255, 255, 255, 0.08);
}

.as-models-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: rgba(156, 156, 156, 1);
}

/* --- Filter Tags --- */
.as-filter-tags {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin-bottom 0.3s ease;
    margin-bottom: 0;
}

.as-filter-tags--visible {
    max-height: unset;
    opacity: 1;
    margin-bottom: 1rem;
}

.as-filter-tags__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.as-filter-tags__remove {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
    font-size: 0.8rem;
}

.as-filter-tags__remove:hover {
    opacity: 1;
}

/* --- Color Dots --- */
.as-color-dots {
    margin-bottom: 1rem;
}

.as-color-dots__label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.as-color-dots__container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.as-color-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(115, 115, 115, 1);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    outline: none;
    overflow: hidden;
}

.as-color-dot:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.as-color-dot--active {
    border-color: var(--yellow-color);
    transform: scale(1.15);
    box-shadow: 0 2px 12px rgba(211, 255, 1, 0.3);
}

.as-color-dot__check {
    font-size: 0.7rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* --- Modal --- */
.as-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(2px);
}

.as-modal {
    background: rgba(53, 52, 53, 1);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    color: white;
}

@keyframes asModalStaticPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.as-modal--static-flash {
    animation: asModalStaticPulse 300ms ease-out;
}

.as-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(115, 115, 115, 1);
    flex-shrink: 0;
}

.as-modal__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
}

.as-modal__body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.as-modal__body-content{
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.as-modal__footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid rgba(115, 115, 115, 1);
    flex-shrink: 0;
}

.as-modal__footer .btn {
    flex: 1;
    height: 44px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.as-reset-filter-btn:hover{
    color:black !important;
}

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

@media (max-width: 768px) {
    .as-autocomplete__container{
        width: 66%;
        margin: auto;
    }

    .as-filter-bar {
        gap: 0.5rem;
    }

    .as-filter-bar__item {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
    }

    .as-select-filter {
        width: 100%;
        min-width: 0;
    }

    .as-btn-advanced {
        width: 100%;
        justify-content: center;
    }

    .as-modal {
        border-radius: unset;
        max-height: 100vh;
        max-width: 100%;
        margin: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .as-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .as-autocomplete__input {
        height: 44px;
    }
}

@media (max-width: 480px) {
    .as-filter-bar__item {
        flex: 1 1 100%;
    }
    .as-filter-bar__item--usage,.as-filter-bar__item--seller{
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
    }
}

/* --- Checkbox --- */
.as-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: white;
    font: inherit;
    line-height: 1.2;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.as-checkbox--reverse {
    flex-direction: row-reverse;
    justify-content: space-between;
    width: 100%;
}

.as-checkbox--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.as-checkbox__box {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid rgba(115, 115, 115, 1);
    background-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    color: #000;
}

.as-checkbox:hover .as-checkbox__box {
    border-color: rgba(211, 255, 1, 0.6);
}

.as-checkbox:focus-visible .as-checkbox__box {
    outline: 2px solid var(--yellow-color);
    outline-offset: 2px;
}

.as-checkbox--checked .as-checkbox__box {
    background-color: var(--yellow-color);
    border-color: var(--yellow-color);
    box-shadow: 0 2px 12px rgba(211, 255, 1, 0.3);
}

.as-checkbox:active .as-checkbox__box {
    transform: scale(0.92);
}

.as-checkbox__svg {
    width: 14px;
    height: 14px;
    display: block;
    overflow: visible;
}

.as-checkbox__path {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    transition: stroke-dashoffset 0.25s ease;
}

.as-checkbox--checked .as-checkbox__path {
    stroke-dashoffset: 0;
}

.as-checkbox__label {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
    user-select: none;
}

.as-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.as-checkbox-list__label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: white;
}

/* --- Modal Section (Additionals) --- */
.as-modal__section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    /*border-top: 1px solid rgba(115, 115, 115, 0.35);*/
}

.as-modal__section-title {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.75rem 0;
}

.as-modal__section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.as-modal__section-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(115, 115, 115, 0.35);
}
