/*
 * Visual Diagrams Styles
 * Диаграммы и визуальные схемы
 */

/* === ОБЩИЕ СТИЛИ ДИАГРАММ === */
.diagram-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    margin-bottom: var(--spacing-lg);
}

.diagram-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    text-align: center;
}

/* === SVG ДИАГРАММЫ === */
.svg-diagram {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.svg-diagram text {
    font-family: var(--font-family);
}

.svg-diagram .node-box {
    transition: all 0.2s ease;
}

.svg-diagram .node-box:hover {
    filter: brightness(1.1);
}

/* === БЛОК-СХЕМА === */
.flowchart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
}

.flow-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    justify-content: center;
}

.flow-node {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius);
    text-align: center;
    min-width: 120px;
    font-weight: 500;
    transition: transform 0.2s ease;
}

.flow-node:hover {
    transform: scale(1.05);
}

.flow-node.primary {
    background: var(--primary-color);
    color: white;
}

.flow-node.secondary {
    background: var(--secondary-color);
    color: white;
}

.flow-node.accent {
    background: var(--accent-color);
    color: white;
}

.flow-node.neutral {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.flow-node.folder {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    color: #333;
}

.flow-node.file {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.flow-arrow {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.flow-arrow.down {
    transform: rotate(90deg);
}

.flow-arrow.multi {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* === СЕТКА СВЯЗЕЙ === */
.connection-matrix {
    display: grid;
    gap: 2px;
    background: var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.matrix-cell {
    background: var(--bg-primary);
    padding: var(--spacing-sm);
    text-align: center;
    font-size: 0.85rem;
}

.matrix-cell.header {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.matrix-cell.active {
    background: var(--secondary-color);
    color: white;
}

.matrix-cell.partial {
    background: #f39c12;
    color: white;
}

/* === ИЕРАРХИЧЕСКАЯ КАРТА === */
.hierarchy-map {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.hierarchy-level {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.level-label {
    min-width: 100px;
    padding: var(--spacing-sm);
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.level-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    flex: 1;
}

.level-item {
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.level-item.highlight {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

/* === КРУГОВАЯ ДИАГРАММА СВЯЗЕЙ === */
.radial-diagram {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
}

.radial-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-align: center;
    font-size: 0.9rem;
    z-index: 10;
}

.radial-item {
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--bg-tertiary);
    border: 2px solid var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    text-align: center;
    transition: all 0.2s ease;
}

.radial-item:hover {
    background: var(--primary-light);
    color: white;
    transform: scale(1.1);
}

/* === ТАБЛИЧНАЯ ВИЗУАЛИЗАЦИЯ === */
.visual-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px;
}

.visual-table th,
.visual-table td {
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
}

.visual-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.visual-table td {
    background: var(--bg-tertiary);
}

.visual-table tr:hover td {
    background: var(--bg-secondary);
}

.visual-table .count-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.visual-table .bar {
    height: 20px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 10px;
    min-width: 10px;
}

/* === КАРТА САЙТА === */
.sitemap-visual {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.sitemap-row {
    display: flex;
    align-items: stretch;
    gap: var(--spacing-sm);
}

.sitemap-item {
    flex: 1;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sitemap-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.sitemap-item.root {
    background: var(--primary-color);
    color: white;
}

.sitemap-item.section {
    background: var(--primary-light);
    color: white;
}

.sitemap-item .item-icon {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
}

.sitemap-item .item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.sitemap-item .item-count {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: var(--spacing-xs);
}

/* === LEGEND === */
.diagram-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.85rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-color.folder { background: #f1c40f; }
.legend-color.file { background: #3498db; }
.legend-color.page { background: var(--primary-color); }
.legend-color.link { background: var(--secondary-color); }
.legend-color.param { background: var(--accent-color); }

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    .flow-row {
        flex-direction: column;
    }

    .flow-arrow {
        transform: rotate(90deg);
    }

    .flow-arrow.down {
        transform: rotate(90deg);
    }

    .radial-diagram {
        width: 300px;
        height: 300px;
    }

    .radial-center {
        width: 70px;
        height: 70px;
        font-size: 0.75rem;
    }

    .radial-item {
        width: 60px;
        height: 60px;
        font-size: 0.65rem;
    }

    .hierarchy-level {
        flex-direction: column;
    }

    .level-label {
        min-width: auto;
        width: 100%;
    }
}
