/* Custom Directorist Search Widget - Compact Styles */
/* Version 1.1.0 */

.dcsw-compact-form {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: flex-end;
    position: relative;
}

.dcsw-fields-wrapper {
    flex: 1;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: flex-end;
}

.dcsw-basic-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.dcsw-field-element {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0 !important;
    position: relative;
}

/* Hide Directorist's floating labels to prevent duplication */
.dcsw-compact-form .directorist-form-label,
.dcsw-compact-form .directorist-search-field__label,
.dcsw-compact-form label.directorist-btn-label,
.dcsw-compact-form .directorist-floating-label {
    display: none !important;
}

/* Directory type dropdown */
.dcsw-directory-type-field {
    flex: 0 0 auto;
    min-width: 150px;
    max-width: 200px;
}

.dcsw-directory-dropdown {
    width: 100%;
    height: 40px !important;
    padding: 0 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(0, 0, 0, 0.2);
    color: #fff !important;
    cursor: pointer;
}

.dcsw-directory-dropdown option {
    background-color: #333;
    color: #fff;
}

/* Target Directorist specific inner elements to reduce bulk */
.dcsw-compact-form .directorist-search-field {
    margin-bottom: 0 !important;
}

.dcsw-compact-form .directorist-form-group {
    margin-bottom: 0 !important;
}

/* Input styling - ONLY typed text is white */
.dcsw-compact-form input[type="text"],
.dcsw-compact-form input[type="search"],
.dcsw-compact-form select,
.dcsw-compact-form .directorist-select2-container .select2-selection {
    height: 40px !important;
    line-height: normal;
    color: #fff !important;
    background-color: transparent !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3) !important;
}

/* Placeholder text styling - more visible */
.dcsw-compact-form input::placeholder {
    color: rgba(255, 255, 255, 0.85) !important;
    opacity: 1 !important;
}

.dcsw-compact-form input::-webkit-input-placeholder {
    color: rgba(255, 255, 255, 0.85) !important;
    opacity: 1 !important;
}

.dcsw-compact-form input::-moz-placeholder {
    color: rgba(255, 255, 255, 0.85) !important;
    opacity: 1 !important;
}

.dcsw-compact-form input:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Button wrapper - contains search and filter buttons */
.dcsw-buttons-wrapper {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

/* Submit button specific */
.dcsw-search-btn {
    height: 40px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

/* Filter wrapper - contains button and modal */
.dcsw-filter-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* Filter button - positioned on left */
.dcsw-filter-btn {
    height: 40px;
    width: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

.dcsw-filter-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.dcsw-filter-btn.active {
    background-color: var(--accent-color, #c41e3a);
    border-color: var(--accent-color, #c41e3a);
}

/* Filter modal - anchored to filter button (left side) */
.dcsw-filter-modal {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    background-color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 20px;
    min-width: 300px;
    max-width: 400px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.dcsw-filter-modal.active {
    display: block;
}

.dcsw-filter-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dcsw-filter-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.dcsw-filter-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    line-height: 1;
}

.dcsw-filter-modal-close:hover {
    color: #fff;
}

.dcsw-filter-modal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dcsw-filter-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dcsw-filter-field label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dcsw-filter-field select,
.dcsw-filter-field input {
    height: 38px;
    padding: 0 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
}

.dcsw-filter-field select option {
    background-color: #333;
    color: #fff;
}

/* Location autocomplete */
.dcsw-location-wrapper {
    position: relative;
    flex: 1;
    min-width: 150px;
}

.dcsw-location-input {
    width: 100%;
    height: 40px !important;
    padding: 0 35px 0 10px !important;
    background-color: transparent !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
}

.dcsw-location-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.dcsw-location-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
}

.dcsw-location-suggestions.active {
    display: block;
}

.dcsw-location-suggestion {
    padding: 10px 12px;
    cursor: pointer;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dcsw-location-suggestion:last-child {
    border-bottom: none;
}

.dcsw-location-suggestion:hover,
.dcsw-location-suggestion.selected {
    background-color: rgba(196, 30, 58, 0.3);
}

.dcsw-location-suggestion-name {
    font-weight: 500;
}

.dcsw-location-suggestion-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 5px;
}

/* Loading indicator */
.dcsw-loading {
    display: none;
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
}

.dcsw-loading.active {
    display: block;
}

.dcsw-loading::after {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dcsw-spin 0.8s linear infinite;
}

@keyframes dcsw-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dcsw-compact-form {
        flex-direction: column;
        align-items: stretch;
    }

    .dcsw-buttons-wrapper {
        width: 100%;
    }

    .dcsw-search-btn {
        flex: 1;
    }

    .dcsw-filter-modal {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        margin-top: 0;
        width: 90%;
        max-width: 400px;
    }
}