/* ══════════════════════════════════════════════════════════════════════════
 * AgroMind Market Rates — Explorer Styles v2.0
 * ══════════════════════════════════════════════════════════════════════════ */

/* ── Wrapper ─────────────────────────────────────────────────────────── */
.agromind-mr-explorer {
    max-width: 100%;
    margin: 2rem auto;
    font-family: inherit;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    background: #fff;
    overflow: hidden;
}

/* ── Header Bar ──────────────────────────────────────────────────────── */
.agromind-mr-explorer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--amr-header-start, #16a34a) 0%, var(--amr-header-end, #15803d) 100%);
    color: var(--amr-header-text, #ffffff);
}
.agromind-mr-explorer-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--amr-header-text, #ffffff);
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ── Controls / Dropdown Area ────────────────────────────────────────── */
.agromind-mr-explorer-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

/* Field wrapper (label + select) */
.agromind-mr-explorer-field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.agromind-mr-explorer-label {
    font-size: .82rem;
    font-weight: 700;
    color: #374151;
    letter-spacing: .02em;
}

/* Dropdown */
.agromind-mr-explorer-select {
    width: 100%;
    padding: .75rem 1rem;
    font-size: .95rem;
    font-weight: 500;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    outline: none;
    transition: border-color .25s, box-shadow .25s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    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='%2364748b' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}
.agromind-mr-explorer-select:focus {
    border-color: var(--amr-header-start, #16a34a);
    box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.agromind-mr-explorer-select:hover {
    border-color: #94a3b8;
}

/* Optgroup labels */
.agromind-mr-explorer-select optgroup {
    font-weight: 700;
    font-size: .9rem;
    color: #15803d;
    padding: .25rem 0;
}
.agromind-mr-explorer-select option {
    font-weight: 400;
    color: #334155;
    padding: .35rem .5rem;
}

/* ── Empty State ─────────────────────────────────────────────────────── */
.agromind-mr-explorer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}
.agromind-mr-explorer-empty-icon {
    font-size: 3rem;
    margin-bottom: .75rem;
    opacity: .6;
}
.agromind-mr-explorer-empty p {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #475569;
}
.agromind-mr-explorer-empty-sub {
    margin-top: .35rem !important;
    font-size: .85rem !important;
    font-weight: 400 !important;
    color: #94a3b8 !important;
}

/* ── Loading Spinner ─────────────────────────────────────────────────── */
.agromind-mr-explorer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}
.agromind-mr-explorer-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--amr-header-start, #16a34a);
    border-radius: 50%;
    animation: agromind-explorer-spin .8s linear infinite;
    margin-bottom: .85rem;
}
@keyframes agromind-explorer-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.agromind-mr-explorer-loading p {
    margin: 0;
    font-size: .9rem;
    color: #64748b;
    font-weight: 500;
}

/* ── Result Container ────────────────────────────────────────────────── */
.agromind-mr-explorer-result {
    animation: agromind-explorer-fadeIn .35s ease-out;
}
.agromind-mr-explorer-result:empty {
    display: none;
}
/* Remove the extra wrapper margin/shadow since the explorer already provides it */
.agromind-mr-explorer-result .agromind-mr-wrap {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}
.agromind-mr-explorer-result .agromind-mr-header {
    border-radius: 0;
}

@keyframes agromind-explorer-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Error State ─────────────────────────────────────────────────────── */
.agromind-mr-explorer-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    background: #fef2f2;
    border-top: 1px solid #fecaca;
}
.agromind-mr-explorer-error-icon {
    font-size: 2rem;
    margin-bottom: .5rem;
}
.agromind-mr-explorer-error p {
    margin: 0;
    font-size: .9rem;
    color: #991b1b;
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════════════
 * MOBILE OVERRIDES (≤ 768px)
 * ══════════════════════════════════════════════════════════════════════════ */
@media screen and (max-width: 768px) {
    .agromind-mr-explorer-controls {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    .agromind-mr-explorer-select {
        font-size: .88rem;
        padding: .65rem .85rem;
        padding-right: 2.25rem;
    }
    .agromind-mr-explorer-empty {
        padding: 2rem 1rem;
    }
    .agromind-mr-explorer-empty-icon {
        font-size: 2.5rem;
    }
    .agromind-mr-search-input {
        font-size: .88rem !important;
        padding: .65rem .85rem .65rem 3rem !important;
    }
    .agromind-mr-search-list {
        max-height: 200px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
 * SEARCHABLE DROPDOWN
 * ══════════════════════════════════════════════════════════════════════════ */

/* Wrapper */
.agromind-mr-search-wrap {
    position: relative;
    width: 100%;
}

/* Input container */
.agromind-mr-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

/* Search icon */
.agromind-mr-search-icon {
    position: absolute;
    left: .85rem;
    font-size: .95rem;
    pointer-events: none;
    opacity: .5;
    z-index: 1;
}

/* Text input — matches existing select styling */
.agromind-mr-search-input {
    width: 100%;
    padding: .75rem 2.5rem .75rem 3.2rem !important;
    font-size: .95rem;
    font-weight: 500;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    outline: none;
    transition: border-color .25s, box-shadow .25s;
}
.agromind-mr-search-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}
.agromind-mr-search-input:focus {
    border-color: var(--amr-header-start, #16a34a);
    box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.agromind-mr-search-input:hover {
    border-color: #94a3b8;
}
.agromind-mr-search-input.agromind-mr-search-has-value {
    font-weight: 600;
    color: #15803d;
}

/* Clear button */
.agromind-mr-search-clear {
    position: absolute;
    right: .65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: .7rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, color .15s;
    line-height: 1;
    padding: 0;
    z-index: 1;
}
.agromind-mr-search-clear:hover {
    background: #f87171;
    color: #fff;
}

/* Dropdown list */
.agromind-mr-search-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.agromind-mr-search-list::-webkit-scrollbar {
    width: 6px;
}
.agromind-mr-search-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Each option item */
.agromind-mr-search-item {
    padding: .6rem 1rem;
    font-size: .9rem;
    color: #334155;
    cursor: pointer;
    transition: background .12s, color .12s;
    border-bottom: 1px solid #f1f5f9;
}
.agromind-mr-search-item:last-child {
    border-bottom: none;
}
.agromind-mr-search-item:hover {
    background: #f0fdf4;
    color: #15803d;
}

/* Match highlight */
.agromind-mr-search-highlight {
    background: #fef08a;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* No results */
.agromind-mr-search-no-results {
    padding: 1rem;
    text-align: center;
    font-size: .85rem;
    color: #94a3b8;
    font-style: italic;
}
