/* ── Hierarchy Search: cascade field wrapper ─────────────────────────────── */

.dh-hierarchy-field .dh-location-cascade {
    position: relative;
}

/* Stack the three select rows vertically with a small gap */
.dh-hierarchy-field .dh-cascade-row {
    position: relative;
    margin-bottom: 8px;
}

.dh-hierarchy-field .dh-cascade-row:last-of-type {
    margin-bottom: 0;
}

/* ── Loading spinner — replaces the chevron arrow during AJAX ──────────── */

.dh-hierarchy-field .dh-cascade-row.dh-cascade-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 12px;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid rgba(0, 115, 170, 0.25);
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: dh-cascade-spin 0.65s linear infinite;
    pointer-events: none;
    z-index: 1;
}

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

/* Hide the SVG chevron while the spinner is visible */
.dh-hierarchy-field .dh-cascade-row.dh-cascade-loading .dh-cascade-select {
    background-image: none;
    padding-right: 36px;
    color: #aaa;
}

/* Selects inherit Directorist's form-element base */
.dh-hierarchy-field .dh-cascade-select {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px 6px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.dh-hierarchy-field .dh-cascade-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.dh-hierarchy-field .dh-cascade-select:disabled {
    background-color: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ── Required-field error state ───────────────────────────────────────────── */

.dh-cascade-select--error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 1px #e74c3c;
}

.dh-cascade-error-msg {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 4px;
    margin-bottom: 0;
}

/* ── City autocomplete (listing form only) ───────────────────────────────── */

/* The city row needs position:relative so the dropdown anchors below it. */
.dh-city-autocomplete-row {
    position: relative;
}

.dh-city-text-input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.dh-city-text-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.dh-city-text-input:disabled {
    background-color: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
    opacity: 0.7;
}

.dh-city-text-input.dh-cascade-select--error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 1px #e74c3c;
}

.dh-city-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
}

.dh-city-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.15s;
}

.dh-city-dropdown-item:hover {
    background-color: #f0f7fb;
    color: #0073aa;
}

.dh-city-dropdown-add {
    color: #0073aa;
    font-style: italic;
    border-top: 1px solid #eee;
}

.dh-city-dropdown-add:hover {
    background-color: #e8f4f8;
}

.dh-city-dropdown-loading {
    padding: 8px 12px;
    font-size: 13px;
    color: #aaa;
    font-style: italic;
}

/* Clear button — align with Directorist's own clear button style */
.dh-hierarchy-field .directorist-search-field__btn--clear button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #aaa;
    font-size: 16px;
    line-height: 1;
    transition: color 0.2s;
}

.dh-hierarchy-field .directorist-search-field__btn--clear button:hover {
    color: #e74c3c;
}
