/* ============================================================
   INDICATOR SETTINGS POPUP  — TradingView style
   ============================================================ */

.ind-popup-overlay {
    position: fixed;
    inset: 0;
    background: transparent;   /* no dimming — chart stays fully visible */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    pointer-events: none;       /* let clicks pass through the empty area */
}
.ind-popup-overlay.hidden { display: none; }
.ind-popup-box { pointer-events: all; } /* but the box itself is clickable */

/* ── Theme tokens ── */
html:not([data-theme=light]) .ind-popup-box {
    --tv-bg:       #1e222d;
    --tv-text:     #d1d4dc;
    --tv-muted:    #787b86;
    --tv-sep:      #363a45;
    --tv-input:    #2a2e39;
    --tv-hover:    #2a2e39;
    --tv-focus:    #2962ff;
}
html[data-theme=light] .ind-popup-box {
    --tv-bg:       var(--ui-panel, #F3F4F6);
    --tv-text:     var(--ui-fg, #131722);
    --tv-muted:    var(--ui-muted, #787b86);
    --tv-sep:      var(--ui-panel-border, #e0e3eb);
    --tv-input:    var(--ui-bg, #F3F4F6);
    --tv-hover:    var(--ui-hover, rgba(0,0,0,.06));
    --tv-focus:    var(--ui-primary, #2962ff);
}

/* ── Box ── */
.ind-popup-box {
    background: var(--tv-bg);
    color: var(--tv-text);
    border: 1px solid var(--tv-sep);
    border-radius: 4px;
    width: 460px;
    max-width: calc(100vw - 24px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.32);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    overflow: hidden;
    animation: tv-popup-in 0.12s ease;
}
@keyframes tv-popup-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ── Title bar ── */
.ind-popup-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--tv-sep);
}
.ind-popup-title-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--tv-text);
    letter-spacing: 0.1px;
}
.ind-popup-close-btn {
    width: 24px; height: 24px;
    border: none;
    background: transparent;
    color: var(--tv-muted);
    font-size: 13px;
    cursor: pointer;
    border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.1s, color 0.1s;
    padding: 0; line-height: 1;
}
.ind-popup-close-btn:hover { background: var(--tv-hover); color: var(--tv-text); }

/* ── Tab bar ── */
.ind-popup-tabbar {
    display: flex;
    border-bottom: 1px solid var(--tv-sep);
    padding: 0 16px;
    gap: 4px;
}
.ind-popup-tabbar .ind-tab-btn {
    padding: 8px 14px 9px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--tv-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: -1px;
    transition: color 0.1s;
    letter-spacing: 0.1px;
}
.ind-popup-tabbar .ind-tab-btn:hover { color: var(--tv-text); }
.ind-popup-tabbar .ind-tab-btn.active {
    color: var(--tv-text);
    border-bottom-color: var(--tv-text);
    font-weight: 600;
}

/* ── Tab panes ── */
.ind-tab-pane {
    display: none;
    padding: 18px 16px;
    background: var(--tv-bg);
    min-height: 120px;
}
.ind-tab-pane.active { display: block; }

/* ── Parameter form ── */
.ind-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ind-form-row {
    display: flex;
    align-items: center;
    gap: 20px;
}
.ind-form-field {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}
.ind-form-field.ind-form-field-full { flex: 1; }
#ind-opt-applyto { flex: 0 0 auto; width: 130px; }
#ind-opt-style   { flex: 0 0 auto; width: 100px; }
#ind-opt-width   { flex: 0 0 auto; width: 54px; }
.ind-form-field label {
    color: var(--tv-muted);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    min-width: 52px;
    flex-shrink: 0;
}
.ind-form-field input[type="number"] {
    width: 72px;
    flex-shrink: 0;
    background: var(--tv-input);
    border: 1px solid var(--tv-sep);
    color: var(--tv-text);
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    text-align: center;
    -webkit-appearance: none;
    transition: border-color 0.1s;
}
.ind-form-field input[type="number"]:focus { border-color: var(--tv-focus); }
.ind-form-field select {
    flex: 1;
    background: var(--tv-input);
    border: 1px solid var(--tv-sep);
    color: var(--tv-text);
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    transition: border-color 0.1s;
}
.ind-form-field select:focus { border-color: var(--tv-focus); }
.ind-form-field select option { background: var(--tv-input); }

/* ── Style controls (color + line-style + line-width) ── */
.ind-style-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.ind-style-controls input[type="color"] {
    width: 40px; height: 30px;
    border: 1px solid var(--tv-sep);
    border-radius: 3px;
    background: var(--tv-input);
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
}
.ind-style-controls select {
    flex: 1;
    background: var(--tv-input);
    border: 1px solid var(--tv-sep);
    color: var(--tv-text);
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    transition: border-color 0.1s;
}
.ind-style-controls select:focus { border-color: var(--tv-focus); }
.ind-style-controls select:last-child { flex: 0 0 52px; text-align: center; }

/* ── Levels tab ── */
.ind-levels-layout {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.ind-levels-table-wrap {
    flex: 1;
    border: 1px solid var(--tv-sep);
    border-radius: 2px;
    overflow: hidden;
    min-height: 130px;
}
.ind-levels-thead {
    display: grid;
    grid-template-columns: 90px 1fr;
    padding: 5px 8px;
    background: var(--tv-input);
    border-bottom: 1px solid var(--tv-sep);
    font-size: 11px;
    font-weight: 600;
    color: var(--tv-muted);
    letter-spacing: 0.3px;
}
.ind-levels-body { max-height: 140px; overflow-y: auto; }
.ind-level-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    padding: 6px 8px;
    font-size: 12px;
    color: var(--tv-muted);
    border-bottom: 1px solid var(--tv-sep);
    cursor: pointer;
    user-select: none;
    transition: background 0.1s;
}
.ind-level-row:hover    { background: var(--tv-input); color: var(--tv-text); }
.ind-level-row.selected { background: var(--tv-input); color: var(--tv-text); }

.ind-levels-side {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ind-lvl-btn {
    padding: 5px 14px;
    background: var(--tv-bg);
    border: 1px solid var(--tv-sep);
    color: var(--tv-text);
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    min-width: 58px;
    transition: all 0.1s;
}
.ind-lvl-btn:hover:not(:disabled) { border-color: var(--tv-text); }
.ind-lvl-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.ind-levels-stylebar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--tv-sep);
}
.ind-levels-stylebar input[type="color"] {
    width: 38px; height: 28px;
    border: 1px solid var(--tv-sep);
    border-radius: 3px;
    background: var(--tv-input);
    padding: 2px;
    cursor: pointer;
    flex-shrink: 0;
}
.ind-levels-stylebar select {
    flex: 1;
    background: var(--tv-input);
    border: 1px solid var(--tv-sep);
    color: var(--tv-text);
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

/* ── Visualization tab ── */
.ind-viz-check {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--tv-text);
    cursor: pointer;
    user-select: none;
    margin-bottom: 2px;
}
.ind-viz-check input[type="checkbox"] {
    width: 14px; height: 14px;
    accent-color: #2962ff;
    cursor: pointer;
    flex-shrink: 0;
}
.ind-viz-tf-tree {
    margin-top: 12px;
    border: 1px solid var(--tv-sep);
    border-radius: 3px;
    overflow-y: auto;
    max-height: 160px;
    padding: 4px 0;
}
.ind-tf-group-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
}
.ind-tf-arrow {
    font-size: 15px;
    color: var(--tv-muted);
    line-height: 1;
    user-select: none;
    display: inline-block;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}
.ind-viz-tf-leaf {
    padding: 5px 10px 5px 28px;
    display: flex;
    align-items: center;
    gap: 9px;
}
.ind-viz-tf-tree .ind-viz-check { margin-bottom: 0; }

/* ── Footer ── */
.ind-popup-footer-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--tv-sep);
    background: var(--tv-bg);
}
.ind-footer-remove {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--tv-sep);
    border-radius: 3px;
    color: var(--tv-muted);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}
.ind-footer-remove:hover { color: #ef5350; border-color: #ef5350; }
.ind-footer-eye {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--tv-sep);
    border-radius: 3px;
    color: var(--tv-muted);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}
.ind-footer-eye:hover { color: var(--tv-text); border-color: var(--tv-text); }
.ind-footer-cancel {
    padding: 6px 16px;
    background: transparent;
    border: 1px solid var(--tv-sep);
    border-radius: 3px;
    color: var(--tv-text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}
.ind-footer-cancel:hover { background: var(--tv-hover); }
.ind-footer-ok {
    padding: 6px 22px;
    background: #2962ff;
    border: 1px solid #2962ff;
    border-radius: 3px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.1s;
}
.ind-footer-ok:hover { opacity: 0.85; }

/* Focused active item highlight */
.ind-active-focused { background: var(--ui-button) !important; }

/* Oscillator pane consolidated in chart-layout.css */
