/* ============================================================
   INDICATOR SEARCH PANEL — Anchored Dropdown
   Single source of truth for both desktop and mobile.
   Positioned below #indicatorBtn via JS (panel.js).
   Desktop overrides at the bottom of this file.
   ============================================================ */

/* ---- Panel — anchored dropdown below indicator button ---- */
#indicators-panel {
    position: fixed;
    z-index: 9200;
    width: max-content;
    min-width: 240px;
    max-width: calc(100vw - 16px);
    max-height: 400px;
    background: var(--ui-panel, #1e222d);
    border: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    font-family: inherit;
    font-size: 11px;
    animation: ind-fade-in 0.1s ease-out;
}

@keyframes ind-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#indicators-panel.hidden { display: none !important; }

#indicators-panel::before { display: none; }

/* Search Wrap */
.ind-search-wrap {
    padding: 7px 9px 5px;
    border-bottom: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.08));
    flex-shrink: 0;
    position: relative;
}

.ind-search-input {
    width: 100%;
    background: var(--ui-button, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.1));
    color: var(--ui-fg, #d1d4dc);
    padding: 4px 8px 4px 24px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 16px;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
    transition: border-color 0.12s, background 0.12s;
}

.ind-search-input:focus {
    border-color: #2962ff;
    background: var(--ui-panel, #1e222d);
}

.ind-search-input::placeholder {
    color: var(--ui-muted, #787b86);
    font-weight: 400;
}

.ind-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ui-muted, #787b86);
    font-size: 11px;
    pointer-events: none;
    line-height: 1;
}

/* Section Header ("INDICATORS" + "Add all") */
.ind-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 4px;
    flex-shrink: 0;
}

.ind-section-title {
    color: var(--ui-muted, #787b86);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.ind-add-all-link {
    background: none;
    border: none;
    color: #2962ff;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    padding: 1px 4px;
    border-radius: 3px;
    transition: background 0.1s, color 0.1s;
}

.ind-add-all-link:hover {
    background: rgba(41, 98, 255, 0.12);
    color: #1e53e5;
}

/* Applied Strip */
.ind-active-strip {
    border-bottom: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.08));
    flex-shrink: 0;
}

.ind-active-strip-label {
    padding: 4px 10px 2px;
    color: var(--ui-muted, #787b86);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.ind-active-item {
    display: flex;
    align-items: center;
    padding: 3px 10px;
    gap: 6px;
    cursor: pointer;
    transition: background 0.1s;
}

.ind-active-item:hover {
    background: var(--ui-button, rgba(255, 255, 255, 0.05));
}

.ind-active-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ind-active-name {
    color: var(--ui-fg, #d1d4dc);
    font-size: 10.5px;
    flex: 1;
}

.ind-active-gear, .ind-active-del {
    background: none;
    border: none;
    color: var(--ui-muted, #787b86);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: color 0.12s, background 0.12s;
}

.ind-active-gear:hover { color: var(--ui-fg, #d1d4dc); background: rgba(255,255,255,0.08); }
.ind-active-del:hover  { color: #f23645; background: rgba(242,54,69,0.12); }

/* Indicator Item List */
.ind-item-list {
    overflow-y: auto;
    flex: 1;
    padding: 2px 0 4px;
    -webkit-overflow-scrolling: touch;
}

.ind-item-list::-webkit-scrollbar {
    width: 4px;
}
.ind-item-list::-webkit-scrollbar-track {
    background: transparent;
}
.ind-item-list::-webkit-scrollbar-thumb {
    background: var(--ui-panel-border, rgba(255, 255, 255, 0.15));
    border-radius: 2px;
}
.ind-item-list::-webkit-scrollbar-thumb:hover {
    background: var(--ui-muted, #787b86);
}

/* Category header inside indicator list */
.ind-cat-header {
    padding: 5px 10px 2px;
    color: var(--ui-muted, #787b86);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-top: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.08));
    margin-top: 2px;
}
.ind-cat-header:first-child { border-top: none; margin-top: 0; }

/* Compact Indicator Item Row */
.ind-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background 0.1s, border-color 0.1s;
    gap: 8px;
}

.ind-item:hover {
    background: var(--ui-button, rgba(255, 255, 255, 0.05));
    border-left-color: rgba(41, 98, 255, 0.5);
}

.ind-item.ind-item-active {
    border-left-color: #2962ff;
    background: rgba(41, 98, 255, 0.08);
}

.ind-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ind-item-abbr {
    color: var(--ui-fg, #d1d4dc);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.2px;
}

.ind-item-fullname {
    display: block;
    color: var(--ui-muted, #787b86);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Info (ⓘ) Button */
.ind-item-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--ui-muted, #787b86);
    font-size: 17px;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    transition: color 0.12s, background 0.12s;
}
.ind-item-info-btn:hover,
.ind-item-info-btn:active {
    color: var(--ui-fg, #d1d4dc);
    background: rgba(255,255,255,0.06);
}

/* Small Rounded Action Button (+ and x) */
.ind-item-action {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.15));
    background: var(--ui-button, rgba(255, 255, 255, 0.04));
    color: var(--ui-muted, #787b86);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    outline: none;
    transition: all 0.12s ease;
}

.ind-item-plus:hover {
    background: #2962ff;
    border-color: #2962ff;
    color: #ffffff;
}

.ind-item-remove {
    border-color: rgba(242, 54, 69, 0.3);
    color: #f23645;
}

.ind-item-remove:hover {
    background: #f23645;
    border-color: #f23645;
    color: #ffffff;
}

/* Search results */
.ind-search-results {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 2px 0;
}

.ind-no-results {
    padding: 16px 10px;
    color: var(--ui-muted, #787b86);
    font-size: 10.5px;
    text-align: center;
}

.ind-search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background 0.1s, border-color 0.1s;
    gap: 8px;
}

.ind-search-result:hover {
    background: var(--ui-button, rgba(255, 255, 255, 0.05));
    border-left-color: rgba(41, 98, 255, 0.5);
}

/* ══════════════════════════════════════════════════════════════
   INFO POPUP — cross-platform floating tooltip
   ══════════════════════════════════════════════════════════════ */

.ind-info-popup {
    position: fixed;
    background: var(--ui-panel, #1e222d);
    border: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    padding: 10px 12px;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    max-width: 220px;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.1s ease;
}
.ind-info-popup.ind-info-popup-visible {
    opacity: 1;
}

.ind-info-popup-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--ui-fg, #d1d4dc);
    margin-bottom: 3px;
}

.ind-info-popup-desc {
    font-size: 11px;
    color: var(--ui-muted, #787b86);
    line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════════
   DESKTOP OVERRIDES — wider panel for ≥768px viewports
   ══════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
    #indicators-panel {
        min-width: 300px;
        max-height: 70vh;
        border-radius: 10px;
    }

    .ind-item,
    .ind-search-result {
        padding: 5px 10px;
        min-height: auto;
    }
}
