/* arbs.css – финальная версия с корректным выравниванием */

.arbitrage-container {
    max-width: 1400px;
    margin: 0 auto;
}

.arbitrage-main-area {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 30px;
    margin-bottom: 40px;
    align-items: stretch;
}

@media (max-width: 1100px) {
    .arbitrage-main-area { grid-template-columns: 1fr; }
}

/* === ПАНЕЛИ === */
.panel {
    border-radius: 15px;
    padding: 25px;
    border-width: 2px;
    border-style: solid;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
    min-height: 900px;
    min-width: 0;
    overflow: hidden;
}

/* === ЗАГОЛОВОК ПАНЕЛЕЙ === */
.panel-title {
    font-size: 2.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 16px;
    margin-left: 0;
    margin-right: 0;
    padding-left: 25px;
    padding-right: 25px;
    position: relative;
}

.panel-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.panel.border-1 .panel-title::after {
    background: var(--border-1);
    box-shadow: 0 0 10px var(--border-1), 0 0 20px var(--border-1);
}

.panel.border-4 .panel-title::after {
    background: var(--border-4);
    box-shadow: 0 0 10px var(--border-4), 0 0 20px var(--border-4);
}

/* === ШАГИ ЛЕВОЙ ПАНЕЛИ === */
.arbs-step {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.arbs-step:first-of-type {
    height: 100px;
    justify-content: center;
    box-sizing: border-box;
}

.arbs-step-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.arbs-step-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border-width: 2px;
    border-style: solid;
    border-color: var(--border-3);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
    background: rgba(133, 193, 233, 0.08);
}

/* === РАЗДЕЛИТЕЛЬ === */
.block-divider {
    height: 1px;
    background: var(--color-primary);
    box-shadow: 0 0 6px var(--color-primary);
    margin: 2px -25px;
    border: none;
    flex-shrink: 0;
}

.panel.border-4 .block-divider {
    background: var(--border-4);
    box-shadow: 0 0 6px var(--border-4);
}

/* === ГРУППЫ НАСТРОЕК === */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-label {
    font-size: 1.6rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* === ТУЛТИП (знак вопроса) – выравнивание === */
.tooltip-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border-muted);
    color: var(--text-3);
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    background: rgba(255,255,255,0.1);
    line-height: 1;          /* фикс вертикали */
    margin-top: 2px;         /* небольшая коррекция вниз (подберите на глаз) */
}

.tooltip-icon:hover {
    border-color: var(--border-3);
    color: var(--text-3);
    background: rgba(255,255,255,0.2);
}

.tooltip-popup {
    position: fixed;
    max-width: 280px;
    padding: 10px 14px;
    border-radius: 8px;
    border-width: 1px;
    border-style: solid;
    font-size: 0.95rem;
    line-height: 1.5;
    z-index: 10000;
    display: none;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

/* === КНОПКИ ИСХОДОВ === */
.outcome-pills {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.outcome-pill {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border-width: 2px;
    border-style: solid;
    border-color: var(--color-secondary) !important;
    background: rgba(255, 95, 210, 0.08) !important;
    color: var(--color-secondary) !important;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.outcome-pill:hover { transform: scale(1.1); opacity: 0.85; }

.outcome-pill.active {
    background: var(--color-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--color-secondary) !important;
    box-shadow: 0 0 15px var(--color-secondary) !important;
}

/* === СТАВКА === */
.stake-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.stake-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 220px;
}

.stake-input {
    width: 100%;
    padding: 13px 15px;
    border-radius: 10px;
    border-width: 2px;
    border-style: solid;
    font-size: 1.8rem;
    font-weight: bold;
    background: transparent;
    transition: all 0.2s;
}

.stake-input:focus { outline: none; transform: scale(1.02); }

.stake-input.input-error {
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.5) !important;
}

.stake-suffix {
    position: absolute;
    right: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    pointer-events: none;
}

.stake-error {
    font-size: 1rem;
    font-weight: bold;
    padding: 4px 0;
    color: var(--color-danger) !important;
}

.stake-input::-webkit-outer-spin-button,
.stake-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stake-input[type=number] { -moz-appearance: textfield; }

/* === КНОПКИ УПРАВЛЕНИЯ (РАССЧИТАТЬ / СБРОСИТЬ) === */
.panel-controls {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.panel-controls .btn {
    flex: 1;
    padding: 16px 16px;
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 12px;
    border-width: 2px;
    border-style: solid;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 56px;
    white-space: nowrap;
}

.panel-controls .btn i {
    vertical-align: middle;
    margin-top: -2px;         /* поднимаем иконки вверх */
    display: inline-block;
}

.panel-controls .btn-primary-bg {
    border-color: var(--color-primary) !important;
}

.panel-controls .btn:hover { transform: translateY(-2px); }

/* === ЗАГЛУШКА === */
.results-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px 20px 20px;
    gap: 18px;
    text-align: center;
}

.placeholder-icon { font-size: 4rem; opacity: 0.4; }
.placeholder-text { font-size: 1.15rem; font-style: italic; }

.placeholder-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
    margin-top: 8px;
}

.placeholder-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
}

.step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* === РЕЗУЛЬТАТЫ === */
.results-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* === ИНДИКАТОР ВИЛКИ === */
.indicator-step {
    height: 100px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    box-sizing: border-box;
}

.arb-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 18px;
    border-radius: 12px;
    border-width: 1px;
    border-style: solid;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.indicator-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.indicator-text {
    flex: 1;
    display: flex;
    align-items: center;
}

.indicator-status-text {
    font-size: 1.35rem;
    font-weight: bold;
}

.indicator-profit { margin-left: auto; }

.profit-badge {
    font-size: 2.4rem;
    font-weight: bold;
}

/* === СТРАТЕГИЯ === */
.strategy-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.strategy-mini-pills {
    display: flex;
    gap: 8px;
}

.strategy-mini-btn {
    flex: 1;
    height: 56px;
    padding: 6px 12px;
    border-radius: 10px;
    border-width: 2px;
    border-style: solid;
    border-color: var(--border-5);
    font-size: 1.15rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(106, 168, 255, 0.08);
    color: var(--text-5);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.3;
}

.strategy-mini-btn:hover { transform: translateY(-1px); opacity: 0.85; }

.strategy-mini-btn.active {
    background: var(--color-info) !important;
    color: var(--text-primary) !important;
    border-color: var(--color-info) !important;
    box-shadow: 0 0 12px var(--color-info) !important;
}

/* === ТАБЛИЦА КОЭФФИЦИЕНТОВ (левая панель) === */
.odds-table {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.odds-header-row {
    display: grid;
    grid-template-columns: 80px repeat(var(--outcome-count, 2), 1fr);
    gap: 8px;
    align-items: center;
}

.odds-corner { width: 80px; }

.odds-header {
    text-align: center;
    font-weight: bold;
    font-size: 1.3rem;
    padding: 4px;
}

.odds-row {
    display: grid;
    grid-template-columns: 80px repeat(var(--outcome-count, 2), 1fr);
    gap: 8px;
    align-items: center;
}

.odds-bk-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    font-weight: bold;
    font-size: 1.3rem;
    white-space: nowrap;
}

.remove-bk {
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
    transition: all 0.2s;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.remove-bk:hover { opacity: 1; transform: scale(1.1); }

.odds-input {
    padding: 6px 8px;
    border-radius: 6px;
    border-width: 2px;
    border-style: solid;
    font-size: 1.15rem;
    font-weight: bold;
    width: 100%;
    background: transparent;
    transition: border-color 0.3s, box-shadow 0.3s;
    text-align: center;
    outline: none;
    box-sizing: border-box;
    color: var(--text-secondary);
}

.odds-input.arb-highlight-0 { border-color: var(--arb-hl-0) !important; box-shadow: 0 0 8px var(--arb-hl-0); color: var(--arb-hl-0) !important; }
.odds-input.arb-highlight-1 { border-color: var(--arb-hl-1) !important; box-shadow: 0 0 8px var(--arb-hl-1); color: var(--arb-hl-1) !important; }
.odds-input.arb-highlight-2 { border-color: var(--arb-hl-2) !important; box-shadow: 0 0 8px var(--arb-hl-2); color: var(--arb-hl-2) !important; }
.odds-input.arb-highlight-3 { border-color: var(--arb-hl-3) !important; box-shadow: 0 0 8px var(--arb-hl-3); color: var(--arb-hl-3) !important; }
.odds-input.arb-highlight-4 { border-color: var(--arb-hl-4) !important; box-shadow: 0 0 8px var(--arb-hl-4); color: var(--arb-hl-4) !important; }

.odds-input::-webkit-outer-spin-button,
.odds-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.odds-input[type=number] { -moz-appearance: textfield; }

.add-bk-row {
    margin-top: 4px;
    display: grid;
    grid-template-columns: 80px repeat(var(--outcome-count, 2), 1fr);
    gap: 8px;
    align-items: center;
}

.odds-add-bk { grid-column: 1; width: 100%; }

.add-bk-btn {
    background: transparent;
    border: 2px solid var(--border-3);
    color: var(--text-3);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    padding: 7px 12px;
    border-radius: 8px;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    white-space: nowrap;
}

.add-bk-btn:hover { opacity: 0.8; }

/* === ТАБЛИЦА РАСПРЕДЕЛЕНИЯ (правая панель) === */
.distribution-table {
    width: 100%;
    border-radius: 12px;
    border-width: 1px;
    border-style: solid;
    overflow-x: auto;
    min-width: 0;
}

.distribution-table table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.distribution-table thead {
    background: var(--bg-elevated);
    border-bottom: 2px solid var(--border-muted);
}

.distribution-table thead th {
    padding: 12px 8px;
    font-weight: bold;
    font-size: 1.4rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    border-right: 1px solid var(--border-muted);
    background: var(--bg-elevated);
}

.distribution-table thead th:first-child {
    width: 1%;
    white-space: nowrap;
}

.distribution-table thead th:last-child { border-right: none; }

.distribution-table tbody tr {
    border-bottom: 1px solid var(--border-muted);
}

.distribution-table tbody tr:last-child { border-bottom: none; }

.distribution-table tbody td {
    padding: 11px 8px;
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    border-right: 1px solid var(--border-muted);
    vertical-align: middle;
}

.distribution-table tbody td:last-child { border-right: none; }

.distribution-table tbody td.metric-label {
    width: 1%;
    white-space: nowrap;
    background: var(--bg-elevated);
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-muted);
    text-align: center;
    padding-left: 10px;
    padding-right: 10px;
}

/* === ЯЧЕЙКА КЭФ === */
.kef-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border-radius: 4px;
    border-width: 2px;
    border-style: solid;
    border-color: transparent;
    font-weight: bold;
    font-size: 1.0rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    white-space: nowrap;
    min-width: 44px;
    box-sizing: border-box;
}

.kef-cell.arb-highlight-0 { border-color: var(--arb-hl-0) !important; box-shadow: 0 0 5px var(--arb-hl-0); color: var(--arb-hl-0) !important; }
.kef-cell.arb-highlight-1 { border-color: var(--arb-hl-1) !important; box-shadow: 0 0 5px var(--arb-hl-1); color: var(--arb-hl-1) !important; }
.kef-cell.arb-highlight-2 { border-color: var(--arb-hl-2) !important; box-shadow: 0 0 5px var(--arb-hl-2); color: var(--arb-hl-2) !important; }
.kef-cell.arb-highlight-3 { border-color: var(--arb-hl-3) !important; box-shadow: 0 0 5px var(--arb-hl-3); color: var(--arb-hl-3) !important; }
.kef-cell.arb-highlight-4 { border-color: var(--arb-hl-4) !important; box-shadow: 0 0 5px var(--arb-hl-4); color: var(--arb-hl-4) !important; }

.outcome-badge {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: bold;
}

/* === ИТОГИ === */
.totals {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 12px;
    border-width: 1px;
    border-style: solid;
    min-width: 0;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.5rem;
    min-width: 0;
    gap: 8px;
}

.total-row > span:first-child {
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.total-row-value {
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
    white-space: nowrap;
}

/* === ПРИБЫЛЬ === */
.net-profit-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 22px;
    border-radius: 12px;
    border-width: 2px;
    border-style: solid;
    border-color: var(--border-4);
    min-width: 0;
    gap: 8px;
}

.net-profit-label {
    font-size: 2.25rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-4);
}

.net-profit-value {
    font-size: 2.25rem;
    font-weight: bold;
    flex-shrink: 0;
    white-space: nowrap;
}

/* === КОНТЕЙНЕР ДЕТАЛЕЙ (отступы) === */
#arbDetailsContainer {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    .panel { padding: 18px; gap: 16px; min-height: 0; }
    .panel-title { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
    .block-divider { margin: 2px -18px; }

    .odds-header-row, .odds-row, .add-bk-row {
        grid-template-columns: 65px repeat(var(--outcome-count, 2), 1fr);
        gap: 5px;
    }

    .odds-corner { width: 65px; }
    .odds-bk-label { font-size: 0.95rem; }
    .odds-input { padding: 9px 4px; font-size: 1rem; }
    .odds-header { font-size: 0.95rem; }

    .distribution-table thead th,
    .distribution-table tbody td { padding: 9px 6px; font-size: 0.9rem; }

    .distribution-table thead th {
        font-size: 1.0rem;
    }
    .distribution-table tbody td.metric-label {
        font-size: 1.0rem;
        padding-left: 8px;
        padding-right: 10px;
    }

    .strategy-mini-btn {
        font-size: 1rem;
    }

    .profit-badge { font-size: 1.7rem; }
    .net-profit-value { font-size: 1.9rem; }
    .panel-controls .btn { padding: 13px 10px; font-size: 1.15rem; }
    .stake-input-wrapper { width: 100%; }
    .settings-label { font-size: 1rem; }
    .panel-title { font-size: 1.4rem; }
    .indicator-status-text { font-size: 1.1rem; }
    .indicator-step { height: auto; min-height: 60px; }
    .arbs-step:first-of-type { height: auto; min-height: 60px; }
}

@media (max-width: 480px) {
    .outcome-pills { justify-content: center; }
    .outcome-pill { width: 46px; height: 46px; font-size: 1.1rem; }

    .odds-header-row, .odds-row, .add-bk-row {
        grid-template-columns: 55px repeat(var(--outcome-count, 2), 1fr);
        gap: 3px;
    }

    .odds-corner { width: 55px; }
    .odds-bk-label { font-size: 0.85rem; }
    .odds-input { padding: 7px 2px; font-size: 0.9rem; }

    .indicator-circle { width: 38px; height: 38px; }
    .panel-controls { flex-direction: column; }
    .panel-controls .btn { width: 100%; }
    .net-profit-value { font-size: 1.6rem; }
    .profit-badge { font-size: 1.5rem; }
    .panel-title { font-size: 1.3rem; }
}

/* === УСИЛЕННЫЕ ПРАВИЛА ДЛЯ СТРОКИ "ДОХОД" === */
#incomeRow > span:first-child,
#incomeRow .total-row-value {
    font-size: 1.6rem !important;
    font-weight: bold !important;
}
#incomeRow > span:first-child {
    color: var(--text-4) !important;
}

@media (max-width: 768px) {
    #incomeRow > span:first-child,
    #incomeRow .total-row-value {
        font-size: 1.1rem !important;
    }
}
