/* ===== Общие стили для диагностики бумаги ==========================
   Используются и на полной странице (/bond-diag-page), и в модальном
   окне (partials/bond-diag-modal.ejs) — единый вид карточки эмитента,
   информации об облигации и истории купонов, чтобы не расходились. */

.bond-info {
    background: var(--surface);
    color: var(--text);
    padding: 16px 18px;
    border-radius: 10px;
    margin: 14px 0;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.bond-info h3 {
    color: var(--text);
    margin-top: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.bond-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 8px;
}

.bond-info-item {
    margin: 0;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.bond-info-block {
    margin: 6px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.bond-info-item strong {
    color: var(--text-muted);
    min-width: 160px;
    font-weight: 600;
    font-size: 12.5px;
}

.bond-info-item .value {
    text-align: right;
    font-weight: 600;
    font-family: var(--font-mono), var(--font-mono-fallback);
    font-variant-numeric: tabular-nums;
}

.price-indicator, .yield-indicator, .rating-badge, .status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    font-family: var(--font-mono), var(--font-mono-fallback);
}

.price-high { background: var(--poor-soft); color: var(--poor); }
.price-low { background: var(--good-soft); color: var(--good); }
.price-normal { background: var(--ok-soft); color: var(--ok); }

.yield-high { background: var(--good-soft); color: var(--good); font-weight: bold; }
.yield-normal { background: var(--neutral-pill); color: var(--text-muted); }
.yield-extreme { background: var(--poor); color: var(--accent-contrast); font-weight: 800; }

.rating-good { background: var(--good-soft); color: var(--good); }
.rating-ok { background: var(--ok-soft); color: var(--ok); }
.rating-poor { background: var(--poor-soft); color: var(--poor); }

.status-active { background: var(--good-soft); color: var(--good); }
.status-inactive { background: var(--poor-soft); color: var(--poor); }

.rating-history-list {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
}
.rating-history-list li {
    margin-bottom: 4px;
}
.rating-history-list .rating-badge {
    margin-left: 0;
    margin-right: 6px;
}

.rating-history-details {
    margin-top: 6px;
}

.rating-history-details summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    user-select: none;
    list-style: none;
}

.rating-history-details summary::-webkit-details-marker {
    display: none;
}

.rating-history-details summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.15s ease;
}

.rating-history-details[open] summary::before {
    transform: rotate(90deg);
}

.rating-history-details summary:hover {
    color: var(--text);
}

.rating-history-details .rating-history-list {
    margin-top: 8px;
    padding-left: 10px;
    border-left: 2px solid var(--border);
}

.emitter-description-text {
    margin: 8px 0 0;
    padding-left: 10px;
    border-left: 2px solid var(--border);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-muted);
    white-space: pre-line;
}

.bond-type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

.bond-type-badge.floating {
    background: var(--ok-soft);
    color: var(--ok);
}

.bond-type-badge.fixed {
    background: var(--good-soft);
    color: var(--good);
}

/* История купонов */
.coupon-history {
    margin: 14px 0;
}

.section-title {
    color: var(--text);
    font-family: var(--font-display);
    font-weight: 700;
    margin: 14px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    font-size: 15px;
}

.coupon-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.coupon-table th {
    background: var(--surface-2);
    color: var(--text-muted);
    padding: 7px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

/* Встроенный график цены (bond-diag-price-chart.ejs + bond-diag-chart.js) */
.price-chart-section {
    margin: 14px 0;
}

.chart-period-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.chart-period-buttons button {
    padding: 5px 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 999px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--font-primary);
    transition: all 0.15s;
}

.chart-period-buttons button:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.chart-period-buttons button.active {
    background: var(--accent);
    color: var(--accent-contrast);
    border-color: var(--accent);
}

.bond-diag-chart-container {
    position: relative;
    width: 100%;
    height: 320px;
    /* #1e1e1e — совпадает с layout.background в bond-diag-chart.js */
    background: #1e1e1e;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

/* Панель OHLCV поверх графика (как в TradingView/TabTrader), а не отдельным
   блоком под ним — создаётся динамически bond-diag-chart.js. Скрыта до
   первого движения курсора над свечами (.visible добавляет сам JS). */
.bond-diag-candle-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: var(--shadow);
    pointer-events: none;
}

.bond-diag-candle-overlay.visible {
    display: grid;
}

.coupon-table td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.coupon-table tr.coupon-upcoming td {
    color: var(--text-faint);
    font-style: italic;
}

.coupon-table tr:last-child td {
    border-bottom: none;
}

.coupon-value {
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-mono), var(--font-mono-fallback);
}

.coupon-empty {
    color: var(--text-faint);
    padding: 15px 0;
}

/* Таблица "сестринских" выпусков в bond-diag-rating-context.ejs — с
   пагинацией через bond-diag-siblings-table.js, для эмитентов с большим
   числом выпусков (СФО/структурные ноты вроде Сбербанк КИБ). */
.siblings-table-wrap {
    margin-top: 8px;
}

.siblings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.siblings-table th {
    text-align: left;
    padding: 6px 10px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    border-bottom: 1px solid var(--border);
}

.siblings-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.siblings-table tr:last-child td {
    border-bottom: none;
}

.siblings-table a {
    color: var(--accent);
    text-decoration: none;
    font-family: var(--font-mono), var(--font-mono-fallback);
}

.siblings-table a:hover {
    text-decoration: underline;
}

.siblings-table-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.siblings-table-pager button {
    padding: 4px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
}

.siblings-table-pager button:hover:not(:disabled) {
    border-color: var(--border-strong);
}

.siblings-table-pager button:disabled {
    opacity: 0.4;
    cursor: default;
}

.no-bond-data {
    background: var(--poor-soft);
    padding: 18px;
    border-radius: 10px;
    margin: 20px 0;
    color: var(--poor);
    text-align: center;
}

/* Дефолт — рейтинг D от первоисточника (см. bond-diag-default-warning.ejs).
   Сознательно ярче и тревожнее любых других карточек на странице — самая
   важная информация о бумаге, если она есть. */
.default-warning {
    background: var(--poor);
    color: var(--accent-contrast);
    padding: 14px 18px;
    border-radius: 10px;
    margin: 14px 0;
    box-shadow: var(--shadow);
}

.default-warning h3 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    color: var(--accent-contrast);
}

.default-warning p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.default-warning a {
    color: var(--accent-contrast);
    text-decoration: underline;
}

/* Новости эмитента (bond-diag-emitter-news.ejs) */
.emitter-news-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.emitter-news-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.emitter-news-item:last-child {
    border-bottom: none;
}

.emitter-news-date {
    font-family: var(--font-mono), var(--font-mono-fallback);
    font-size: 11.5px;
    color: var(--text-faint);
    white-space: nowrap;
    flex-shrink: 0;
    width: 76px;
}

.emitter-news-source {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.emitter-news-title {
    color: var(--text);
    text-decoration: none;
    line-height: 1.4;
}

.emitter-news-title:hover {
    color: var(--accent);
    text-decoration: underline;
}

.emitter-news-bond-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--good);
    background: var(--good-soft);
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.emitter-news-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.emitter-news-pager button {
    padding: 4px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
}

.emitter-news-pager button:hover:not(:disabled) {
    border-color: var(--border-strong);
}

.emitter-news-pager button:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Свёрнутый техблок для разработчиков */
.tech-details {
    margin: 24px 0;
    padding: 14px 18px;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.tech-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
}

.tech-details summary:hover {
    color: var(--text);
}

.tech-details[open] summary {
    margin-bottom: 15px;
}
