/**
 * Zone Settings Modal
 * ===================
 * Изолированные стили для модалки настроек зон
 */

/* Overlay - на всю страницу */
.zsm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* Модальное окно */
.zsm-modal {
    position: relative;
    width: 380px;
    max-width: 90vw;
    max-height: 85vh;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.zsm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-default);
    flex-shrink: 0;
}

.zsm-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.zsm-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.zsm-dot--bullish { background: var(--color-bullish); }
.zsm-dot--bearish { background: var(--color-bearish); }

.zsm-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.zsm-close:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

.zsm-close svg {
    width: 16px;
    height: 16px;
}

/* Body */
.zsm-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Footer */
.zsm-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--color-border-default);
    background: var(--color-bg-tertiary);
    flex-shrink: 0;
}

/* Параметры настроек */
.zsm-params {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.zsm-param {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zsm-param-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.zsm-param-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
}

.zsm-param-desc {
    font-size: 12px;
    color: var(--color-text-tertiary);
    line-height: 1.3;
}

/* Toggle */
.zsm-toggle {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.zsm-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.zsm-toggle-track {
    width: 40px;
    height: 22px;
    background: var(--color-bg-tertiary);
    border-radius: 11px;
    transition: background 0.15s ease;
}

.zsm-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--color-text-secondary);
    border-radius: 50%;
    transition: all 0.15s ease;
}

.zsm-toggle input:checked + .zsm-toggle-track {
    background: var(--color-accent-primary);
}

.zsm-toggle input:checked ~ .zsm-toggle-thumb {
    transform: translateX(18px);
    background: #fff;
}

/* Chips (radio buttons) */
.zsm-chips {
    display: flex;
    gap: 4px;
}

.zsm-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: 1px solid var(--color-border-default);
    border-radius: 6px;
    background: var(--color-surface-primary);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zsm-chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.zsm-chip:hover {
    border-color: var(--color-accent-primary);
    color: var(--color-text-primary);
}

.zsm-chip:has(input:checked) {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    color: #fff;
}

/* Compact chips для таблиц */
.zsm-chips--compact {
    gap: 2px;
}
.zsm-chips--compact .zsm-chip {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

/* Number input */
.zsm-input-number {
    width: 80px;
    padding: 6px 10px;
    font-size: 14px;
    color: var(--color-text-primary);
    background: var(--color-surface-input);
    border: 1px solid var(--color-border-default);
    border-radius: 6px;
    text-align: center;
}

.zsm-input-number:focus {
    border-color: var(--color-accent-primary);
    outline: none;
}

/* Section title */
.zsm-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 0 8px;
    border-bottom: 1px solid var(--color-border-default);
    margin-bottom: 8px;
}

/* Empty message */
.zsm-empty {
    text-align: center;
    padding: 24px;
    color: var(--color-text-secondary);
    font-size: 14px;
}

/* Ячейка с select и кнопкой настроек */
.step-zone-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.step-zone-cell .input-sm {
    flex: 1;
}

/* Кнопка настроек шага (шестерёнка) */
.btn-step-settings {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--color-surface-primary);
    border: 1px solid var(--color-border-default);
    border-radius: 4px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-step-settings:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-accent-primary);
    color: var(--color-accent-primary);
}

/* Индикация что настройки заданы */
.btn-step-settings.has-settings {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    color: #fff;
}

.btn-step-settings.has-settings:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
}
