/* =========================================================
   SMART AUTOCOMPLETE
   Real Estate Website
   ========================================================= */

.smart-autocomplete {
    position: relative;
    width: 100%;
}

.smart-autocomplete-input {
    width: 100%;
    position: relative;
    z-index: 2;
}

.smart-autocomplete-input input {
    width: 100%;
}

/* Dropdown */
.smart-autocomplete-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;

    width: 100%;
    max-height: 280px;

    overflow-y: auto;
    overflow-x: hidden;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;

    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);

    padding: 6px;

    z-index: 9999;

    display: none;
}

.smart-autocomplete-list.is-visible {
    display: block;
}

/* Individual suggestion */
.smart-autocomplete-item {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 11px 12px;

    border-radius: 9px;

    background: transparent;
    border: 0;

    cursor: pointer;

    text-align: left;

    font-size: 14px;
    line-height: 1.4;

    color: #1f2937;

    transition:
        background-color 0.18s ease,
        color 0.18s ease;
}

.smart-autocomplete-item:hover,
.smart-autocomplete-item.is-active {
    background: #f1f5ff;
    color: #2563eb;
}

/* Icon */
.smart-autocomplete-item-icon {
    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 8px;

    background: #f8fafc;
}

.smart-autocomplete-item-icon img {
    width: 20px;
    height: 20px;

    object-fit: contain;

    display: block;
}

/* Text */
.smart-autocomplete-item-content {
    min-width: 0;
    flex: 1;
}

.smart-autocomplete-item-title {
    display: block;

    font-size: 14px;
    font-weight: 600;

    color: #111827;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-autocomplete-item-subtitle {
    display: block;

    margin-top: 2px;

    font-size: 12px;

    color: #64748b;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Highlight searched text */
.smart-autocomplete-item-title mark {
    padding: 0;

    background: transparent;

    color: #2563eb;

    font-weight: 700;
}

/* Loading */
.smart-autocomplete-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 52px;

    padding: 12px;

    color: #64748b;

    font-size: 13px;
}

.smart-autocomplete-spinner {
    width: 17px;
    height: 17px;

    border: 2px solid #dbeafe;
    border-top-color: #2563eb;

    border-radius: 50%;

    animation: smartAutocompleteSpin 0.7s linear infinite;
}

@keyframes smartAutocompleteSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* No result */
.smart-autocomplete-empty {
    padding: 16px 12px;

    text-align: center;

    font-size: 13px;

    color: #64748b;
}

/* Error */
.smart-autocomplete-error {
    padding: 14px 12px;

    text-align: center;

    font-size: 13px;

    color: #dc2626;
}

/* Clear button */
.smart-autocomplete-clear {
    position: absolute;

    top: 50%;
    right: 12px;

    width: 26px;
    height: 26px;

    transform: translateY(-50%);

    display: none;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;

    background: #f1f5f9;

    cursor: pointer;

    color: #64748b;

    font-size: 15px;

    z-index: 3;
}

.smart-autocomplete-clear:hover {
    background: #e2e8f0;
    color: #111827;
}

.smart-autocomplete.has-value .smart-autocomplete-clear {
    display: flex;
}

/* Selected value */
.smart-autocomplete-input input.is-selected {
    border-color: #2563eb;
    background: #f8fbff;
}

/* Prevent dropdown overflow */
.smart-autocomplete-list::-webkit-scrollbar {
    width: 6px;
}

.smart-autocomplete-list::-webkit-scrollbar-track {
    background: transparent;
}

.smart-autocomplete-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.smart-autocomplete-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 767px) {

    .smart-autocomplete-list {
        top: calc(100% + 4px);

        max-height: 240px;

        border-radius: 10px;

        padding: 5px;

        box-shadow: 0 10px 25px rgba(15, 23, 42, 0.16);
    }

    .smart-autocomplete-item {
        padding: 10px;

        gap: 9px;

        font-size: 13px;
    }

    .smart-autocomplete-item-icon {
        width: 30px;
        height: 30px;

        flex-basis: 30px;
    }

    .smart-autocomplete-item-icon img {
        width: 18px;
        height: 18px;
    }

    .smart-autocomplete-item-title {
        font-size: 13px;
    }

    .smart-autocomplete-item-subtitle {
        font-size: 11px;
    }

    .smart-autocomplete-empty,
    .smart-autocomplete-error {
        padding: 14px 10px;

        font-size: 12px;
    }
}

/* Small mobile */
@media (max-width: 420px) {

    .smart-autocomplete-list {
        max-height: 220px;
    }

    .smart-autocomplete-item {
        padding: 9px;
    }

    .smart-autocomplete-item-icon {
        width: 28px;
        height: 28px;

        flex-basis: 28px;
    }

    .smart-autocomplete-item-icon img {
        width: 17px;
        height: 17px;
    }
}

/* Very small screens */
@media (max-width: 340px) {

    .smart-autocomplete-list {
        max-height: 200px;
    }

    .smart-autocomplete-item {
        padding: 8px;
    }
}