/**
 * RIMA NEXUS CMS - Smart Forms & Searchable Dropdown (xStore-Child Parity)
 * Corporate Design System - High-Performance Pure Vanilla Components
 */

/* ─── SEARCHABLE SELECT COMPONENT (xStore-Child Style) ───────────────────────── */
.rima-ss-wrapper {
    position: relative;
    width: 100%;
    font-family: inherit;
    box-sizing: border-box;
}

.rima-ss-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    background: #FFFFFF;
    border: 1.5px solid #CBD5E1;
    border-radius: 10px;
    font-size: 14.5px;
    color: #1E293B;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
    outline: none;
}

.rima-ss-trigger:hover {
    border-color: #94A3B8;
}

.rima-ss-trigger:focus,
.rima-ss-trigger.is-open {
    border-color: #00A3A8 !important;
    box-shadow: 0 0 0 3px rgba(0, 163, 168, 0.18) !important;
}

.rima-ss-trigger.is-disabled {
    background: #F8FAFC !important;
    color: #94A3B8 !important;
    cursor: not-allowed !important;
    border-color: #E2E8F0 !important;
    opacity: 0.75;
}

.rima-ss-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: left;
    font-weight: 500;
}

.rima-ss-label.is-placeholder {
    color: #94A3B8;
    font-weight: 400;
}

.rima-ss-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.rima-ss-clear {
    display: none;
    color: #94A3B8;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}

.rima-ss-clear:hover {
    color: #EF4444;
    background: #FEE2E2;
}

.rima-ss-chevron {
    color: #64748B;
    font-size: 12px;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s;
}

.rima-ss-trigger.is-open .rima-ss-chevron {
    transform: rotate(180deg);
    color: #00A3A8;
}

/* ─── DROPDOWN PANEL ───────────────────────────────────────────────────────── */
.rima-ss-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 99999;
    background: #FFFFFF;
    border: 1.5px solid #00A3A8;
    border-radius: 10px;
    box-shadow: 0 14px 30px -4px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(0, 163, 168, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: rimaSlideDown 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes rimaSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rima-ss-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.rima-ss-search-icon {
    color: #00A3A8;
    font-size: 13px;
    flex-shrink: 0;
}

.rima-ss-search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 13.5px;
    color: #0F172A;
    font-family: inherit;
    padding: 4px 0;
}

.rima-ss-search-input::placeholder {
    color: #94A3B8;
}

.rima-ss-list {
    max-height: 230px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

.rima-ss-list::-webkit-scrollbar {
    width: 6px;
}
.rima-ss-list::-webkit-scrollbar-track {
    background: transparent;
}
.rima-ss-list::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 6px;
}

.rima-ss-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    font-size: 13.5px;
    color: #334155;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
    user-select: none;
}

.rima-ss-option:hover,
.rima-ss-option.is-highlighted {
    background: #F0FDFA;
    color: #00A3A8;
    font-weight: 600;
}

.rima-ss-option.is-selected {
    background: #CCFBF1;
    color: #007377;
    font-weight: 700;
}

.rima-ss-option-check {
    color: #00A3A8;
    font-size: 12px;
    margin-left: 8px;
    flex-shrink: 0;
}

.rima-ss-no-results {
    padding: 12px 14px;
    font-size: 13px;
    color: #64748B;
    text-align: center;
}

.rima-ss-custom-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    background: #F0FDFA;
    border: 1px dashed #00A3A8;
    border-radius: 7px;
    color: #00A3A8;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.rima-ss-custom-add-btn:hover {
    background: #CCFBF1;
    color: #007377;
}

/* ─── SMART POSTCODE PULSE & BADGES ────────────────────────────────────────── */
.rima-postcode-pulse {
    animation: rimaPostcodePulse 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes rimaPostcodePulse {
    0% {
        border-color: #10B981 !important;
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.35) !important;
    }
    40% {
        border-color: #10B981 !important;
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.18) !important;
    }
    100% {
        border-color: #CBD5E1 !important;
        box-shadow: none !important;
    }
}

.rima-smart-postcode-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: #ECFDF5;
    border: 1.5px solid #10B981;
    border-radius: 9px;
    font-size: 12.5px;
    color: #065F46;
    animation: rimaFadeIn 0.25s ease;
    box-sizing: border-box;
}

@keyframes rimaFadeIn {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── SMART FORM FIELD WRAPPERS & VALIDATION ───────────────────────────────── */
.rima-smart-input-wrap {
    position: relative;
    width: 100%;
}

.rima-smart-input-wrap input {
    width: 100%;
    box-sizing: border-box;
}

.rima-smart-val-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    pointer-events: none;
    font-size: 13.5px;
    transition: opacity 0.2s ease;
}

.rima-smart-input-wrap.is-valid .rima-smart-val-icon {
    display: inline-flex;
    color: #10B981;
}

.rima-smart-input-wrap.is-valid input {
    border-color: #10B981 !important;
    padding-right: 36px !important;
}

.rima-smart-input-wrap.is-invalid .rima-smart-val-icon {
    display: inline-flex;
    color: #EF4444;
}

/* ─── RESPONSIVE LAYOUT ────────────────────────────────────────────────────── */
.rima-location-row {
    display: grid;
    grid-template-columns: 1fr 1fr 140px;
    gap: 14px;
    margin-bottom: 16px;
    align-items: start;
}

@media (max-width: 768px) {
    .rima-location-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}

