/* =========================================
   Moto Selector Panel v0.4 — CSS
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;600;700&display=swap');

:root {
    --moto-bg:       #3fb549;
    --moto-accent:   #1a6b22;
    --moto-accent-h: #145c1b;
    --moto-radius:   6px;
}

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

.moto-selector-wrap {
    background: var(--moto-bg);
    border-radius: 10px;
    padding: 24px 28px 28px;
    margin: 24px 0;
    font-family: 'Barlow', sans-serif;
    box-shadow: 0 4px 32px rgba(0,0,0,0.18);
    position: relative;
}

.moto-selector-title {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 18px 0;
    letter-spacing: -0.01em;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ── Row ──────────────────────────────────────────────────── */

.moto-selector-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-wrap: nowrap;
}

.moto-selector-field {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Custom Select ────────────────────────────────────────── */

.moto-custom-select {
    position: relative;
    width: 100%;
    font-family: 'Barlow', sans-serif;
    font-size: 0.93rem;
}

.moto-cs-trigger {
    display: flex;
    align-items: center;
    background: #1e1e1e;
    border: 1px solid #444444;
    border-radius: var(--moto-radius);
    overflow: visible;          /* allow dropdown to overflow */
    transition: border-color 0.2s;
    height: 46px;
    cursor: text;
    box-sizing: border-box;
}

/* clip only the inner parts, not the arrow */
.moto-cs-trigger > .moto-cs-search {
    border-radius: var(--moto-radius) 0 0 var(--moto-radius);
}

.moto-custom-select.moto-cs-open .moto-cs-trigger,
.moto-cs-trigger:focus-within {
    border-color: rgba(255,255,255,0.6);
}

.moto-cs-search {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #eeeeee;
    font-family: 'Barlow', sans-serif;
    font-size: 0.93rem;
    padding: 0 8px 0 14px;
    min-width: 0;
    height: 100%;
    cursor: text;
}

.moto-cs-search::placeholder {
    color: #888888;
}

.moto-cs-search:disabled {
    cursor: not-allowed;
    color: #666;
}

/* ── Arrow — always white, rotates when open ─────────────── */

.moto-cs-arrow {
    flex-shrink: 0;
    width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;             /* always white */
    cursor: pointer;
}

.moto-cs-arrow svg {
    width: 12px;
    height: 8px;
    display: block;
    transition: transform 0.2s ease;
}

.moto-custom-select.moto-cs-open .moto-cs-arrow svg {
    transform: rotate(180deg); /* flip when open */
}

/* disabled arrow slightly dimmed */
.moto-custom-select.moto-cs-disabled .moto-cs-arrow {
    color: rgba(255,255,255,0.35);
}

/* ── Dropdown list ────────────────────────────────────────── */

.moto-cs-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: var(--moto-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 9999;
    max-height: 240px;
    overflow-y: auto;
}

.moto-custom-select.moto-cs-open .moto-cs-dropdown {
    display: block;
}

/* List — compact, no gaps ───────────────────────────────── */

.moto-cs-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.moto-cs-list li {
    padding: 8px 14px;
    color: #111111;
    font-size: 0.91rem;
    cursor: pointer;
    line-height: 1.3;
    margin: 0;
    transition: background 0.1s;
}

.moto-cs-list li + li {
    border-top: 1px solid #f0f0f0;
}

.moto-cs-list li:hover {
    background: #edf7ee;
    color: #000000;
}

.moto-cs-list li.moto-cs-selected {
    background: #d4edda;
    color: var(--moto-accent);
    font-weight: 600;
}

.moto-cs-list li.moto-cs-no-results {
    color: #999999;
    font-style: italic;
    cursor: default;
}

.moto-cs-list li.moto-cs-no-results:hover {
    background: transparent;
}

/* Scrollbar */
.moto-cs-dropdown::-webkit-scrollbar       { width: 5px; }
.moto-cs-dropdown::-webkit-scrollbar-track { background: #f5f5f5; }
.moto-cs-dropdown::-webkit-scrollbar-thumb { background: #cccccc; border-radius: 3px; }

/* ── Disabled ─────────────────────────────────────────────── */

.moto-custom-select.moto-cs-disabled .moto-cs-trigger {
    opacity: 0.4;
    pointer-events: none;
}

/* ── Button ───────────────────────────────────────────────── */

.moto-selector-btn-wrap {
    flex: 0 0 auto;
    width: 190px;
}

/* Use .moto-selector-wrap .moto-btn for higher specificity vs theme resets */
.moto-selector-wrap .moto-btn {
    display: block;
    width: 100%;
    height: 46px;
    background: rgba(0,0,0,0.25);
    color: rgba(255,255,255,0.55);
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: var(--moto-radius) !important;  /* enforce — override any theme */
    -webkit-border-radius: var(--moto-radius) !important;
    -moz-border-radius: var(--moto-radius) !important;
    font-family: 'Barlow', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: not-allowed;
    transition: background 0.25s, transform 0.15s, box-shadow 0.25s;
    outline: none;
    white-space: nowrap;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}

.moto-selector-wrap .moto-btn:not(:disabled) {
    background: var(--moto-accent);
    color: #ffffff !important;   /* always white — never changes */
    cursor: pointer;
    border-color: var(--moto-accent);
    box-shadow: 0 3px 14px rgba(26,107,34,0.4);
}

.moto-selector-wrap .moto-btn:not(:disabled):hover {
    background: var(--moto-accent-h);
    color: #ffffff !important;   /* stays white on hover */
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26,107,34,0.5);
}

.moto-selector-wrap .moto-btn:not(:disabled):active {
    transform: translateY(0);
}

/* ── Loader ───────────────────────────────────────────────── */

.moto-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(63,181,73,0.55);
    border-radius: 10px;
    z-index: 10;
}

.moto-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: moto-spin 0.7s linear infinite;
    display: block;
}

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

/* ── Responsive — mobile ──────────────────────────────────── */

@media (max-width: 700px) {
    .moto-selector-wrap {
        padding: 18px 16px 22px;
    }

    .moto-selector-title {
        font-size: 1.2rem;
        margin-bottom: 14px;
    }

    .moto-selector-row {
        flex-direction: column;
        gap: 10px;
    }

    .moto-selector-field,
    .moto-selector-btn-wrap {
        flex: 1 1 100%;
        width: 100%;
    }

    .moto-selector-wrap .moto-btn {
        height: 48px;
        font-size: 0.95rem;
    }
}
