/* ===== Модальное окно сравнения ===== */
.comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
}

.comparison-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(14, 31, 37, 0.7);
    backdrop-filter: blur(4px);
}

.comparison-content {
    position: relative;
    max-width: 1000px;
    margin: 40px auto;
    background: var(--card);
    border-radius: 24px;
    padding: 40px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(23, 50, 58, 0.3);
}

.comparison-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: 0;
    background: var(--bg);
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.2s;
}

.comparison-close:hover {
    background: var(--accent);
    color: #fff;
}

.comparison-content h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin: 0 0 12px;
    text-align: center;
}

.comparison-subtitle {
    text-align: center;
    color: var(--muted);
    margin: 0 0 32px;
}

/* Переключатель режимов */
.mode-switcher {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 40px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    border: 2px solid var(--border);
    background: var(--card);
    border-radius: 16px;
    cursor: pointer;
    font: inherit;
    font-size: 1.05rem;
    transition: all 0.3s;
}

.mode-btn.active {
    border-color: var(--accent);
    background: rgba(43, 143, 163, 0.1);
    box-shadow: 0 4px 12px rgba(43, 143, 163, 0.2);
}

.mode-icon {
    font-size: 1.5rem;
}

/* Диаграммы */
.diagram-container {
    margin-bottom: 40px;
}

.diagram {
    display: none;
    animation: fadeIn 0.4s ease;
}

.diagram.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.diagram-title {
    text-align: center;
    margin-bottom: 32px;
}

.diagram-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(45, 134, 89, 0.15);
    color: #2d8659;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.diagram-badge.warning {
    background: rgba(176, 122, 42, 0.15);
    color: #b07a2a;
}

.diagram-title p {
    color: var(--muted);
    margin: 0;
    font-size: 1.1rem;
}

/* Поток трафика */
.traffic-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 32px;
    background: var(--bg);
    border-radius: 20px;
    margin-bottom: 32px;
}

.flow-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 20px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 16px;
    min-width: 140px;
    transition: all 0.3s;
}

.flow-node:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(23, 50, 58, 0.1);
}

.node-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.node-label {
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
}

.node-desc {
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    margin-top: 4px;
}

.flow-arrow {
    font-size: 1.8rem;
    color: var(--accent);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Разветвление для каскада */
.flow-split {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 600px;
    margin-top: 16px;
}

.split-label {
    text-align: center;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.9rem;
}

.split-path {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--card);
    border-radius: 12px;
    border: 2px solid var(--border);
}

.split-path.domestic {
    border-color: #bfe5c9;
    background: #f0faf2;
}

.split-path.foreign {
    border-color: #d8e8ec;
}

.path-arrow {
    font-size: 1.5rem;
    color: var(--accent);
}

.path-node {
    flex: 1;
}

.path-status {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.path-status.fast {
    background: rgba(45, 134, 89, 0.2);
    color: #2d8659;
}

/* Сетка характеристик */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.feature-card {
    padding: 20px;
    border-radius: 16px;
    border: 2px solid var(--border);
    background: var(--card);
}

.feature-card.positive {
    border-color: #bfe5c9;
    background: #f0faf2;
}

.feature-card.negative {
    border-color: #f0c2c2;
    background: #fff4f4;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.feature-card h4 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.feature-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Таблица сравнения */
.comparison-table {
    margin-bottom: 40px;
}

.comparison-table h3 {
    font-family: var(--font-serif);
    margin: 0 0 20px;
    text-align: center;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.comparison-table th,
.comparison-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.comparison-table th {
    background: var(--bg);
    font-weight: 600;
}

.comparison-table th.cascade-col {
    color: var(--accent-dark);
}

.comparison-table th.direct-col {
    color: var(--muted);
}

.comparison-table td.better {
    color: #2d8659;
    font-weight: 600;
}

.comparison-table tr:last-child td {
    border-bottom: 0;
}

/* Рекомендации */
.recommendation h3 {
    font-family: var(--font-serif);
    margin: 0 0 24px;
    text-align: center;
}

.rec-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.rec-card {
    padding: 28px;
    border-radius: 20px;
    border: 2px solid var(--border);
    background: var(--card);
}

.rec-card h4 {
    margin: 0 0 12px;
    font-size: 1.3rem;
}

.rec-card p {
    margin: 0 0 16px;
    color: var(--muted);
}

.rec-card ul {
    margin: 0;
    padding-left: 20px;
}

.rec-card li {
    margin-bottom: 8px;
    color: var(--text);
    line-height: 1.6;
}

/* Адаптивность */
@media (max-width: 768px) {
    .comparison-content {
        padding: 24px;
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
    
    .mode-switcher {
        flex-direction: column;
    }
    
    .mode-btn {
        justify-content: center;
    }
    
    .traffic-flow {
        flex-direction: column;
    }
    
    .flow-arrow {
        transform: rotate(90deg);
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}
