/* CSS for the Matrix Visualization - Tema Preto e Dourado */
.matrix-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    padding: 20px 0;
}

/* Interactive Matrix Navigation */
.matrix-breadcrumb {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.matrix-back-button {
    padding: 8px 16px;
    background: linear-gradient(135deg, #D4AF37 0%, #FFD700 100%);
    color: #000000;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.matrix-back-button:hover {
    background: linear-gradient(135deg, #FFD700 0%, #D4AF37 100%);
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.matrix-current-user {
    font-size: 16px;
    font-weight: 600;
    color: #D4AF37;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.matrix-current-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    border-radius: 15px;
    border: 3px solid #D4AF37;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4), inset 0 0 30px rgba(212, 175, 55, 0.1);
}


.matrix-children-section {
    padding: 20px;
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.matrix-children-header {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #D4AF37;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.3);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.matrix-children-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    justify-items: center;
    max-width: 600px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .matrix-children-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        max-width: 100%;
    }
    
    .matrix-current-section {
        padding: 20px 15px;
    }
    
    .matrix-children-section {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .matrix-children-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .matrix-breadcrumb {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .matrix-back-button {
        width: 100%;
    }
}

.matrix-node.clickable {
    transition: all 0.3s ease;
}

.matrix-node.clickable:hover {
    transform: translateY(-8px) scale(1.15);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.6),
                0 0 40px rgba(212, 175, 55, 0.3);
    z-index: 10;
    border-color: #FFD700 !important;
}

.matrix-node.clickable:hover i {
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8),
                 0 0 30px rgba(255, 215, 0, 0.5);
}

.matrix-node.active.clickable:hover i {
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8),
                 0 0 30px rgba(255, 215, 0, 0.5);
}

.matrix-node.inactive.clickable:hover i {
    color: #9ca3af;
    text-shadow: 0 0 5px rgba(156, 163, 175, 0.3);
}

.matrix-current-section .matrix-node:hover {
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.8),
                0 0 50px rgba(255, 215, 0, 0.5);
}

.matrix-empty-children {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    border-radius: 12px;
    border: 1px dashed rgba(212, 175, 55, 0.3);
}

.matrix-generation {
    margin-bottom: 50px;
    padding: 0;
    background: transparent;
    border: none;
    position: relative;
}

.matrix-generation:last-child {
    margin-bottom: 0;
}

.matrix-generation .generation-header {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.generation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-bottom: none;
}

.generation-title {
    font-size: 18px;
    font-weight: bold;
    color: #495057;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.generation-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.generation-count {
    font-size: 14px;
    color: #6c757d;
    font-weight: normal;
}

.matrix-level {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    position: relative;
    min-height: 150px;
    align-items: flex-start;
    width: 100%;
    padding: 10px;
    overflow-x: auto;
    overflow-y: visible;
}

/* Parent-Child Group Visualization */
.matrix-parent-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin: 15px 10px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.8) 0%, rgba(0, 0, 0, 0.8) 100%);
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    transition: all 0.3s ease;
    vertical-align: top;
}

.matrix-parent-group:hover {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(26, 26, 26, 0.9) 100%);
    border-color: #D4AF37;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
}

.matrix-children-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    position: relative;
    padding-top: 15px;
    min-width: 200px;
}

.matrix-parent-group::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 10px;
    background: linear-gradient(to top, #D4AF37, transparent);
    opacity: 0.6;
    z-index: 0;
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}

.matrix-level::-webkit-scrollbar {
    height: 8px;
}

.matrix-level::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.matrix-level::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.matrix-level::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Container for node (name + circle) */
.matrix-node-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.matrix-node-name {
    font-weight: 600;
    font-size: 12px;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #D4AF37;
    text-align: center;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8),
                 0 0 20px rgba(255, 215, 0, 0.5),
                 0 2px 4px rgba(0, 0, 0, 0.8);
    margin-bottom: 0;
    z-index: 3;
    position: relative;
}

.matrix-node-container:hover .matrix-node-name {
    color: #FFD700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 1),
                 0 0 30px rgba(255, 215, 0, 0.7),
                 0 2px 4px rgba(0, 0, 0, 0.8);
}

.matrix-node {
    flex: 0 0 auto;
    min-width: 35px;
    width: var(--node-size, 90px);
    height: var(--node-size, 90px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    border: 3px solid;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s, width 0.3s ease, height 0.3s ease, font-size 0.3s ease;
    box-sizing: border-box;
    z-index: 2;
    overflow: hidden;
    background-color: #000000;
}

.matrix-node i {
    font-size: calc(var(--node-size, 90px) * 0.45);
    z-index: 2;
    position: relative;
    transition: all 0.3s ease;
    line-height: 1;
}


/* Node sizes are now calculated dynamically via JavaScript */

.matrix-node:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    z-index: 10;
}

.matrix-node.active {
    background-color: #000000;
    border-color: #D4AF37;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4),
                0 0 20px rgba(212, 175, 55, 0.2),
                inset 0 0 20px rgba(212, 175, 55, 0.1);
}

.matrix-node.active i {
    color: #D4AF37;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8),
                 0 0 15px rgba(212, 175, 55, 0.5),
                 0 0 20px rgba(212, 175, 55, 0.3);
}

.matrix-node.inactive {
    background-color: #1a1a1a;
    border-color: #4a4a4a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    opacity: 0.7;
}

.matrix-node.inactive i {
    color: #6c757d;
    text-shadow: none;
    filter: grayscale(100%) brightness(0.6);
}


/* Root node special styling */
.matrix-generation.root-generation .matrix-node,
.matrix-current-section .matrix-node {
    background-color: #000000;
    border-color: #FFD700;
    border-width: 4px;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.6),
                0 0 30px rgba(255, 215, 0, 0.4),
                inset 0 0 30px rgba(255, 215, 0, 0.2);
    animation: glow 2s ease-in-out infinite;
}

.matrix-generation.root-generation .matrix-node i,
.matrix-current-section .matrix-node i {
    color: #FFD700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8),
                 0 0 25px rgba(255, 215, 0, 0.5);
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.6),
                    0 0 30px rgba(255, 215, 0, 0.4),
                    inset 0 0 30px rgba(255, 215, 0, 0.2);
    }
    50% {
        box-shadow: 0 4px 25px rgba(255, 215, 0, 0.8),
                    0 0 40px rgba(255, 215, 0, 0.6),
                    inset 0 0 35px rgba(255, 215, 0, 0.3);
    }
}

.matrix-generation.root-generation .generation-badge {
    background: linear-gradient(135deg, #FFD700 0%, #D4AF37 100%);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
}

/* Empty state */
.matrix-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    border-radius: 12px;
    border: 1px dashed rgba(212, 175, 55, 0.3);
}

.matrix-empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.3));
}

/* Responsive Matrix */
@media (max-width: 768px) {
    .matrix-generation {
        padding: 15px;
        margin-bottom: 30px;
    }

    .generation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .generation-title {
        font-size: 16px;
    }

    .matrix-level {
        gap: 10px;
    }

    .matrix-node {
        width: 75px;
        height: 75px;
        font-size: 10px;
    }

    .matrix-generation.root-generation .matrix-node {
        width: 90px;
        height: 90px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .matrix-generation {
        padding: 10px;
        margin-bottom: 25px;
    }

    .generation-title {
        font-size: 14px;
    }

    .generation-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .matrix-level {
        gap: 8px;
    }

    .matrix-node {
        width: 60px;
        height: 60px;
        font-size: 9px;
        padding: 3px;
    }

    .matrix-generation.root-generation .matrix-node {
        width: 75px;
        height: 75px;
        font-size: 11px;
    }

    .matrix-node-name {
        font-size: 9px;
    }
}
