/* ============================================================
   Калькуляторы Sigma Trade — общие стили раздела
   Файл подключить один раз в шаблоне (или в head страниц раздела):
   /local/templates/main/styles/css/calculators.css
   Все правила ограничены префиксом .sgm-, конфликтов с main.css нет.
   ============================================================ */


/**/
ul.sgm-list li {
    font-size: 14px;
}
a.sgm-btn {
    color: #fff !important;
}
a.sgm-btn.sgm-btn--ghost {
    color: #1954ea !important;
}
/**/



.sgm-calc {
    --sgm-blue: #1954EA;
    --sgm-blue-dark: #003ACC;
    --sgm-text: #1A1B1D;
    --sgm-muted: #6E7174;
    --sgm-line: #CFD9E3;
    --sgm-line-soft: #E8EDF3;
    --sgm-bg: #F8F8F8;
    --sgm-ok: #0A9041;
    --sgm-warn: #B8860B;
    --sgm-danger: #E80E43;
    font-family: 'Gordita', 'Arial', 'Helvetica', sans-serif;
    font-size: 1.6rem;
    line-height: 1.6;
    color: var(--sgm-text);
}

.sgm-calc *,
.sgm-calc *::before,
.sgm-calc *::after { box-sizing: border-box; }

.sgm-calc__inner {
    max-width: 1180px;
    margin: 0 auto;
}

.sgm-calc p { margin: 0 0 1.6rem; }
.sgm-calc a { color: var(--sgm-blue); text-decoration: none; }
.sgm-calc a:hover { color: var(--sgm-blue-dark); }

/* ---------- Заголовки ---------- */

.sgm-h2 {
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.5px;
    margin: 4rem 0 1.6rem;
}

.sgm-h3 {
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 2.8rem 0 1.2rem;
}

.sgm-lead {
    font-size: 1.8rem;
    line-height: 1.6;
    color: var(--sgm-muted);
    margin: 0 0 3.2rem;
    max-width: 900px;
}

/* ---------- Карточки блоков калькулятора ---------- */

.sgm-card {
    background: #fff;
    border: 1px solid var(--sgm-line-soft);
    border-radius: 4px;
    padding: 2.4rem;
    margin-bottom: 2rem;
}

.sgm-card__title {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 0 0.6rem;
}

.sgm-card__title .sgm-step {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    background: var(--sgm-blue);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 500;
}

.sgm-card__hint {
    font-size: 1.4rem;
    color: var(--sgm-muted);
    margin: 0 0 2rem;
}

/* ---------- Сетка полей ---------- */

.sgm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.6rem;
}

.sgm-grid--wide { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.sgm-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sgm-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.sgm-field { display: flex; flex-direction: column; gap: 0.6rem; }

.sgm-field__label {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--sgm-text);
}

.sgm-field__sub {
    font-size: 1.2rem;
    color: var(--sgm-muted);
    line-height: 1.4;
}

.sgm-field__row { display: flex; align-items: center; gap: 0.8rem; }

.sgm-unit {
    font-size: 1.3rem;
    color: var(--sgm-muted);
    white-space: nowrap;
}

/* ---------- Поля ввода ---------- */

.sgm-calc input[type="text"],
.sgm-calc input[type="number"],
.sgm-calc select {
    width: 100%;
    min-width: 0;
    padding: 1rem 1.2rem;
    font-family: inherit;
    font-size: 1.5rem;
    line-height: 1.4;
    color: var(--sgm-text);
    background: #fff;
    border: 1px solid var(--sgm-line);
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -moz-appearance: textfield;
}

.sgm-calc input[type="number"]::-webkit-outer-spin-button,
.sgm-calc input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sgm-calc input:focus,
.sgm-calc select:focus {
    outline: none;
    border-color: var(--sgm-blue);
    box-shadow: 0 0 0 3px rgba(25, 84, 234, 0.12);
}

.sgm-calc input[readonly],
.sgm-calc input.sgm-readonly {
    background: var(--sgm-bg);
    color: var(--sgm-muted);
    border-color: var(--sgm-line-soft);
    cursor: default;
}

.sgm-calc select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231954EA' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    padding-right: 3.4rem;
    cursor: pointer;
}

.sgm-calc input[type="checkbox"] {
    width: 1.8rem;
    height: 1.8rem;
    accent-color: var(--sgm-blue);
    cursor: pointer;
}

/* ---------- Кнопки ---------- */

.sgm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1.3rem 2.8rem;
    font-family: inherit;
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #fff;
    background: var(--sgm-blue);
    border: 1px solid var(--sgm-blue);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sgm-btn:hover {
    background: var(--sgm-blue-dark);
    border-color: var(--sgm-blue-dark);
    color: #fff;
}

.sgm-btn--ghost {
    color: var(--sgm-text);
    background: #fff;
    border-color: var(--sgm-line);
}

.sgm-btn--ghost:hover {
    color: var(--sgm-blue);
    background: #fff;
    border-color: var(--sgm-blue);
}

.sgm-btn--sm { padding: 0.9rem 1.8rem; font-size: 1.2rem; }

/* ---------- Таблицы ---------- */

.sgm-table-wrap { width: 100%; overflow-x: auto; }

.sgm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.4rem;
}

.sgm-table th,
.sgm-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--sgm-line-soft);
    text-align: center;
    vertical-align: middle;
}

.sgm-table thead th {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--sgm-muted);
    background: var(--sgm-bg);
    border-bottom: 1px solid var(--sgm-line);
    white-space: nowrap;
}

.sgm-table tbody th {
    font-weight: 500;
    text-align: left;
    color: var(--sgm-text);
    white-space: nowrap;
}

.sgm-table td input,
.sgm-table td select { padding: 0.7rem 0.8rem; font-size: 1.4rem; }

.sgm-table--tight th,
.sgm-table--tight td { padding: 0.6rem 0.7rem; }

.sgm-table tfoot td,
.sgm-table tfoot th { border-top: 2px solid var(--sgm-line); border-bottom: none; }

.sgm-rowlabel { text-align: left; white-space: nowrap; }
.sgm-nowrap { white-space: nowrap; }

/* ---------- Результаты ---------- */

.sgm-result {
    display: flex;
    flex-wrap: wrap;
    gap: 1.6rem;
    margin: 2rem 0 0;
}

.sgm-result__item {
    flex: 1 1 200px;
    padding: 2rem;
    background: var(--sgm-bg);
    border: 1px solid var(--sgm-line-soft);
    border-left: 3px solid var(--sgm-blue);
    border-radius: 4px;
}

.sgm-result__label {
    font-size: 1.3rem;
    color: var(--sgm-muted);
    margin-bottom: 0.6rem;
}

.sgm-result__value {
    font-size: 2.8rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -1px;
    color: var(--sgm-text);
}

.sgm-result__value small {
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--sgm-muted);
}

.sgm-result__note {
    font-size: 1.2rem;
    color: var(--sgm-muted);
    margin-top: 0.6rem;
}

.sgm-result__item--ok { border-left-color: var(--sgm-ok); }
.sgm-result__item--warn { border-left-color: var(--sgm-warn); }
.sgm-result__item--danger { border-left-color: var(--sgm-danger); }

/* ---------- Статусы ионов / значений ---------- */

.sgm-state { display: inline-block; padding: 0.3rem 0.9rem; border-radius: 100px; font-size: 1.2rem; font-weight: 500; white-space: nowrap; }
.sgm-state--ok { color: var(--sgm-ok); background: rgba(10, 144, 65, 0.1); }
.sgm-state--warn { color: var(--sgm-warn); background: rgba(184, 134, 11, 0.12); }
.sgm-state--danger { color: var(--sgm-danger); background: rgba(232, 14, 67, 0.1); }
.sgm-state--muted { color: var(--sgm-muted); background: rgba(110, 113, 116, 0.1); }

.sgm-calc .is-ok { color: var(--sgm-ok); }
.sgm-calc .is-warn { color: var(--sgm-warn); }
.sgm-calc .is-danger { color: var(--sgm-danger); font-weight: 600; }
.sgm-calc .is-muted { color: var(--sgm-muted); }

/* ---------- Легенда ---------- */

.sgm-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem 2.4rem;
    padding: 1.6rem 0 0;
    margin-top: 1.6rem;
    border-top: 1px solid var(--sgm-line-soft);
    font-size: 1.3rem;
    color: var(--sgm-muted);
}

.sgm-legend span { display: inline-flex; align-items: center; gap: 0.6rem; }

.sgm-dot { width: 1rem; height: 1rem; border-radius: 50%; flex: none; }
.sgm-dot--ok { background: var(--sgm-ok); }
.sgm-dot--warn { background: var(--sgm-warn); }
.sgm-dot--danger { background: var(--sgm-danger); }

/* ---------- Панель действий ---------- */

.sgm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    align-items: center;
    margin-top: 2.4rem;
}

.sgm-note {
    padding: 1.4rem 1.8rem;
    background: rgba(25, 84, 234, 0.05);
    border-left: 3px solid var(--sgm-blue);
    border-radius: 4px;
    font-size: 1.4rem;
    color: var(--sgm-muted);
    margin: 1.6rem 0;
}

.sgm-note strong { color: var(--sgm-text); font-weight: 500; }

.sgm-error {
    display: none;
    padding: 1.4rem 1.8rem;
    margin: 1.6rem 0;
    background: rgba(232, 14, 67, 0.06);
    border-left: 3px solid var(--sgm-danger);
    border-radius: 4px;
    font-size: 1.4rem;
    color: var(--sgm-danger);
}

.sgm-error.is-visible { display: block; }

/* ---------- Списки в статьях ---------- */

.sgm-list { margin: 0 0 1.6rem; padding-left: 2rem; }
.sgm-list li { margin-bottom: 0.8rem; }

.sgm-steps { counter-reset: sgm-step; list-style: none; margin: 0 0 1.6rem; padding: 0; }

.sgm-steps li {
    position: relative;
    padding-left: 4.4rem;
    margin-bottom: 1.6rem;
}

.sgm-steps li::before {
    counter-increment: sgm-step;
    content: counter(sgm-step);
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    background: rgba(25, 84, 234, 0.1);
    color: var(--sgm-blue);
    font-size: 1.4rem;
    font-weight: 600;
}

/* ---------- Каталог калькуляторов (страница раздела и подраздела) ---------- */

.sgm-cat {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.sgm-cat__card {
    display: flex;
    flex-direction: column;
    padding: 2.8rem 2.4rem;
    background: #fff;
    border: 1px solid var(--sgm-line-soft);
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.sgm-cat__card:hover {
    border-color: var(--sgm-line);
    box-shadow: 0 12px 32px rgba(26, 27, 29, 0.08);
    transform: translateY(-3px);
    color: inherit;
}

.sgm-cat__icon {
    width: 5.6rem;
    height: 5.6rem;
    margin-bottom: 2rem;
    border-radius: 50%;
    background: rgba(25, 84, 234, 0.08);
    color: var(--sgm-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sgm-cat__icon svg { width: 2.8rem; height: 2.8rem; }

.sgm-cat__title {
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.8rem;
}

.sgm-cat__text {
    font-size: 1.4rem;
    color: var(--sgm-muted);
    margin-bottom: 2rem;
    flex: 1;
}

.sgm-cat__more {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--sgm-blue);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.sgm-cat__count {
    display: inline-block;
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
    color: var(--sgm-muted);
    background: var(--sgm-bg);
    border-radius: 100px;
    padding: 0.3rem 1rem;
    width: fit-content;
}

.sgm-list-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
}

.sgm-list-cards__item {
    display: flex;
    flex-direction: column;
    padding: 2.4rem;
    background: #fff;
    border: 1px solid var(--sgm-line-soft);
    border-radius: 4px;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.sgm-list-cards__item:hover {
    border-color: var(--sgm-line);
    box-shadow: 0 12px 32px rgba(26, 27, 29, 0.08);
    transform: translateY(-3px);
}

.sgm-list-cards__num {
    font-size: 1.2rem;
    color: var(--sgm-blue);
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 1.2rem;
}

.sgm-list-cards__title {
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 1rem;
}

.sgm-list-cards__title a { color: inherit; }
.sgm-list-cards__title a:hover { color: var(--sgm-blue); }

.sgm-list-cards__text {
    font-size: 1.4rem;
    color: var(--sgm-muted);
    line-height: 1.55;
    margin-bottom: 2rem;
    flex: 1;
}

.sgm-list-cards__link {
    font-size: 1.3rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--sgm-blue);
}

.sgm-list-cards__link:hover { color: var(--sgm-blue-dark); }

.sgm-list-cards__item--soon { opacity: 0.65; }

.sgm-badge-soon {
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 100px;
    background: var(--sgm-bg);
    border: 1px solid var(--sgm-line);
    color: var(--sgm-muted);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.2rem;
    width: fit-content;
}

/* ---------- Навигация «смотрите также» ---------- */

.sgm-related {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.6rem;
    margin-top: 1.6rem;
}

.sgm-related__item {
    padding: 2rem;
    background: var(--sgm-bg);
    border: 1px solid var(--sgm-line-soft);
    border-radius: 4px;
    font-size: 1.4rem;
    line-height: 1.45;
}

.sgm-related__item a { font-weight: 500; }

/* ---------- Адаптив ---------- */

@media (max-width: 1200px) {
    .sgm-cat,
    .sgm-list-cards,
    .sgm-related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .sgm-card { padding: 2rem 1.6rem; }
    .sgm-cat,
    .sgm-list-cards,
    .sgm-related,
    .sgm-grid--2,
    .sgm-grid--3 { grid-template-columns: 1fr; }
    .sgm-h2 { font-size: 2rem; margin-top: 3.2rem; }
    .sgm-lead { font-size: 1.6rem; }
    .sgm-result__value { font-size: 2.4rem; }
    .sgm-table th,
    .sgm-table td { padding: 0.7rem 0.6rem; font-size: 1.3rem; }
    .sgm-btn { width: 100%; }
}
