/**
 * CDD Search Bar — Frontend Styles
 *
 * Inline styles set via ET_Builder_Element::set_style() override these for
 * color/radius values.  This file handles layout and structural styling.
 */

/* ── Wrapper ───────────────────────────────────────────────────────────────── */

.cdd-search-bar {
    width: 100%;
}

/* ── Form ──────────────────────────────────────────────────────────────────── */

.cdd-search-bar__form {
    padding: 24px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.08 );
}

/* ── Field row ─────────────────────────────────────────────────────────────── */

.cdd-search-bar__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

/* ── Individual field ──────────────────────────────────────────────────────── */

.cdd-search-bar__field {
    flex: 1 1 160px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

/* Name field gets slightly more room */
.cdd-search-bar__field--name {
    flex: 2 1 220px;
}

/* Button field — bottom-aligned, no label space */
.cdd-search-bar__field--button {
    flex: 0 0 auto;
    min-width: auto;
}

/* ── Labels ────────────────────────────────────────────────────────────────── */

.cdd-search-bar__label {
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    margin: 0;
    line-height: 1.2;
}

/* ── Inputs & selects ──────────────────────────────────────────────────────── */

.cdd-search-bar__input,
.cdd-search-bar__select {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    line-height: 1.4;
    color: #333333;
    background-color: #ffffff;
    border: 1px solid #cccccc; /* overridden by set_style() */
    border-radius: 4px;         /* overridden by set_style() */
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cdd-search-bar__input:focus,
.cdd-search-bar__select:focus {
    outline: none;
    border-color: #1a3c6e;
    box-shadow: 0 0 0 3px rgba( 26, 60, 110, 0.15 );
}

/* Custom select arrow */
.cdd-search-bar__select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ── Search button ─────────────────────────────────────────────────────────── */

.cdd-search-bar__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 28px;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    background-color: #1a3c6e; /* overridden by set_style() */
    color: #ffffff;             /* overridden by set_style() */
    border-radius: 4px;         /* overridden by set_style() */
    transition: opacity 0.15s ease, transform 0.1s ease;
    line-height: 1.4;
    height: 44px; /* align with input height */
}

.cdd-search-bar__button:hover {
    opacity: 0.88;
}

.cdd-search-bar__button:active {
    transform: scale( 0.97 );
}

.cdd-search-bar__button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Status message ────────────────────────────────────────────────────────── */

.cdd-search-bar__status {
    margin-top: 10px;
    font-size: 14px;
    color: #555555;
    min-height: 20px;
}

/* ── No-results message ────────────────────────────────────────────────────── */

.cdd-no-results {
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
    color: #666666;
    grid-column: 1 / -1;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media ( max-width: 768px ) {
    .cdd-search-bar__fields {
        flex-direction: column;
    }

    .cdd-search-bar__field,
    .cdd-search-bar__field--name,
    .cdd-search-bar__field--button {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .cdd-search-bar__button {
        width: 100%;
    }
}
