/* =============================================================
   modals.css — Базовые стили модальных окон и кнопки закрытия
   ============================================================= */

/* === ФОНОВЫЙ ОВЕРЛЕЙ МОДАЛКИ === */

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 5000;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 40px 20px;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
}

.modal.active-modal {
    display: block !important;
}

.modal:not(.hidden) {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

/* === ОБЁРТКА И СОДЕРЖИМОЕ === */

.modal-wrapper, .dossier-container {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
}

.modal-content, .modal-wrapper {
    margin: auto;
    position: relative;
}

.modal-content {
    background: #0d0d0d;
    border: 1px solid var(--blood-red);
    padding: 30px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-shadow: 0 0 30px rgba(0,0,0,0.9);
    box-sizing: border-box;
    padding-bottom: 20px;
}

.modal-content.dossier-style {
    background: #050505;
    border: 2px solid var(--blood-red);
    padding: 30px;
    width: 100%;
    box-sizing: border-box;
}

/* === КНОПКА ЗАКРЫТИЯ === */

.close-btn {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 26px;
    color: var(--blood-red);
    cursor: pointer;
    z-index: 10001 !important;
    pointer-events: auto !important;
    text-shadow: 0 0 10px var(--blood-red);
}

.close-btn:hover { color: #fff; }

/* === СЕТКА ФРАКЦИЙ В ОКНЕ ГОРОДА === */

.factions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    border-top: 1px solid #333;
    padding-top: 20px;
}

.char-link {
    color: #a8a8a8;
    text-decoration: underline;
    cursor: pointer;
    display: block;
    margin-bottom: 5px;
}

.char-link:hover { color: var(--blood-red); }

/* === СТИЛЬ «INTELLIGENCE REPORT» === */

.dossier-style {
    background: #050505 !important;
    border: 2px solid var(--blood-red) !important;
    box-shadow: 0 0 25px rgba(138, 3, 3, 0.4) !important;
    padding: 40px !important;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(197, 31, 36, 0.78) rgba(255, 255, 255, 0.04);
}

.dossier-style::-webkit-scrollbar {
    width: 9px;
}

.dossier-style::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.035);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.dossier-style::-webkit-scrollbar-thumb {
    border: 2px solid #070708;
    background: rgba(197, 31, 36, 0.78);
}

.dossier-style::-webkit-scrollbar-thumb:hover {
    background: #d12b30;
}

.report-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.clearance-tag {
    font-size: 10px;
    border: 1px solid var(--blood-red);
    padding: 2px 8px;
    color: var(--blood-red);
}

.tech-label {
    font-family: monospace;
    font-size: 11px;
    color: #444;
    border-bottom: 1px solid #222;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.intelligence-body {
    position: relative;
    background: rgba(10, 10, 10, 0.5);
    padding: 15px;
    border: 1px solid #1a1a1a;
}

.terminal-nav {
    border-top: 1px solid var(--blood-red) !important;
    padding-top: 20px !important;
}

/* Подстиль выезжающего свитка */
.dossier-style-sub {
    background: #080808 !important;
    border: 1px solid var(--blood-red) !important;
    border-top: none !important;
}

.scroll-header {
    border-bottom: 1px solid #222;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* === СКАНИРУЮЩАЯ ПОЛОСА ДЛЯ ОТЧЁТОВ === */

.dossier-style .scanline {
    width: 100%;
    height: 60px;
    position: absolute;
    left: 0;
    top: -60px;
    background: linear-gradient(
        to bottom,
        rgba(138, 3, 3, 0)   0%,
        rgba(138, 3, 3, 0.1) 48%,
        rgba(138, 3, 3, 0.8) 50%,
        rgba(138, 3, 3, 0.1) 52%,
        rgba(138, 3, 3, 0)   100%
    );
    animation: scanDossier 4s linear infinite;
    pointer-events: none;
    z-index: 50;
}

@keyframes scanDossier {
    0%   { top: -60px; }
    100% { top: 100%;  }
}
/* =============================================================
   СТИЛИ ДОСЬЕ ПЕРСОНАЖА (ШРЕКНЕТ)
   ============================================================= */

.char-dossier {
    max-width: 650px;
    border: 1px solid var(--blood-red);
    box-shadow: 0 0 20px rgba(138, 3, 3, 0.2), inset 0 0 15px rgba(0, 0, 0, 0.8);
    background: #050505;
}

/* Сетка шапки: Фото + Статы */
.dossier-header {
    display: flex;
    gap: 20px;
    border-bottom: 2px solid #222;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

/* Рамка для фото */
.dossier-photo-frame {
    flex-shrink: 0;
    width: 140px;
    border: 1px solid #333;
    padding: 4px;
    background: #111;
    position: relative;
}

.dossier-photo-frame img {
    width: 100%;
    height: auto;
    display: block;
    filter: grayscale(30%) contrast(110%); /* Придаем фото слегка "мрачный" вид */
}

/* Идентификатор под фото */
.dossier-id {
    text-align: center;
    background: var(--blood-red);
    color: #000;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 12px;
    padding: 3px 0;
    margin-top: 4px;
    letter-spacing: 1px;
}

/* Таблица характеристик */
.dossier-stats-grid {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-content: start;
}

.stat-box {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #222;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
}

.stat-box.full-width {
    grid-column: 1 / -1; /* Занимает всю ширину */
    background: rgba(138, 3, 3, 0.1);
    border-color: #441111;
}

.stat-label {
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 3px;
}

.stat-value {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #ddd;
    font-weight: bold;
}

.stat-value.highlight {
    color: var(--blood-red);
    font-size: 16px;
}

.stat-record-link {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    min-height: 44px;
    margin: -10px 0 -8px;
    padding: 8px 0;
    color: #ddd;
    font: inherit;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: rgba(197, 31, 36, .62);
    text-underline-offset: 4px;
    background: transparent;
    border: 0;
    cursor: pointer;
    touch-action: manipulation;
    transition: color 180ms ease, text-decoration-color 180ms ease;
}

.stat-record-link:hover,
.stat-record-link:focus-visible {
    color: #fff;
    text-decoration-color: var(--blood-bright);
    outline: none;
}

.stat-record-link.is-disabled,
.stat-record-link:disabled {
    color: #ddd;
    text-decoration: none;
    cursor: default;
    opacity: 1;
}

/* Блок биографии */
.detail-section {
    background: #0a0a0a;
    border-left: 3px solid var(--blood-red);
    padding: 10px 15px;
    margin-bottom: 20px;
}

.section-label {
    font-size: 11px;
    color: var(--blood-red);
    font-weight: bold;
    letter-spacing: 2px;
    border-bottom: 1px dotted #333;
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.terminal-text {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #aaa;
}

/* Блоки связей (Сир, Союзники, Враги) */
.dossier-connections {
    display: flex;
    gap: 10px;
}

.connection-group {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid #222;
    padding: 10px;
}

.conn-label {
    font-size: 10px;
    color: #666;
    text-align: center;
    border-bottom: 1px solid #222;
    padding-bottom: 5px;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.conn-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

/* Кликабельные теги (Паутина связей) */
.char-link-tag {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(138, 3, 3, 0.15);
    border: 1px solid var(--blood-red);
    color: #eee;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.char-link-tag:hover {
    background: var(--blood-red);
    color: #000;
    box-shadow: 0 0 10px rgba(138, 3, 3, 0.6);
}

.char-link-dead {
    display: inline-block;
    padding: 3px 8px;
    background: transparent;
    border: 1px dashed #444;
    color: #555;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}
