/* Estilos para el árbol de referidos moderno - ADAPTADO AL SISTEMA GAINOVO */
.gainovo-arbol-moderno {
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

/* Sección de resumen */
.arbol-resumen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 0;
}

.resumen-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Sombra Gainovo */
    border: 1px solid #e9ecef; /* Borde Gainovo */
    transition: all 0.3s ease; /* Transición Gainovo */
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    height: 180px; /* ALTURA FIJA PARA DESKTOP */
    display: flex;
    align-items: center;
    justify-content: center;
}

.resumen-card:hover {
    transform: translateY(-2px); /* Efecto hover Gainovo */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); /* Sombra Gainovo */
}

.resumen-card.vertical {
    display: flex;
    align-items: center;
    gap: 15px;
    height: 180px; /* ALTURA FIJA ESPECÍFICA PARA VERTICAL */
}

.resumen-card-inner {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    height: 100%; /* OCUPA TODA LA ALTURA DISPONIBLE */
}

.metric-icon {
    width: 48px;
    height: 48px;
    color: #0F52AA; /* Primary Gainovo */
    flex-shrink: 0;
}

.resumen-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* CENTRA VERTICALMENTE EL CONTENIDO */
    height: 100%;
}

.resumen-label {
    display: block;
    font-size: 14px;
    color: #6c757d; /* Text-muted Gainovo */
    font-weight: 500;
    margin-bottom: 8px; /* MÁS ESPACIO ENTRE LABEL Y VALOR */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.resumen-valor {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #0F52AA; /* Primary Gainovo */
    line-height: 1.2;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Contenedor del árbol */
.arbol-container {
    background: white;
    border-radius: 12px;
    border: 1px solid #e9ecef; /* Borde Gainovo */
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Sombra Gainovo */
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Items de nivel */
.nivel-item {
    margin-bottom: 0;
    border-bottom: 1px solid #e9ecef; /* Borde Gainovo */
}

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

.nivel-header {
    background: #f8f9fa; /* bg-light Gainovo */
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
    text-align: left;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.nivel-header:hover {
    background: rgba(15, 82, 170, 0.05); /* Primary Gainovo con transparencia */
}

.nivel-header.active {
    background: #0F52AA; /* Primary Gainovo */
    color: white;
}

.nivel-title {
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    color: inherit;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.nivel-header.active .nivel-title {
    color: white;
}

.nivel-badge {
    background: #0F52AA; /* Primary Gainovo */
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.nivel-header.active .nivel-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.nivel-arrow {
    transition: transform 0.3s ease;
    color: #0F52AA; /* Primary Gainovo */
}

.nivel-header.active .nivel-arrow {
    transform: rotate(180deg);
    color: white;
}

.nivel-content {
    display: none;
    padding: 0;
    background: white;
}

.nivel-content.active {
    display: block;
}

/* Items de referido */
.referido-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 20px;
    padding: 16px 20px;
    border-bottom: 1px solid #f8f9fa; /* bg-light Gainovo */
    align-items: center;
    transition: background-color 0.2s ease;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.referido-item:hover {
    background: #f8f9fa; /* bg-light Gainovo */
}

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

.referido-name {
    font-weight: 600;
    color: #333; /* Text-color Gainovo */
    font-size: 14px;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.referido-kyc {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6c757d; /* Text-muted Gainovo */
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.kyc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.kyc-approved { background: #28a745; } /* Success Gainovo */
.kyc-pending { background: #ffc107; } /* Warning Gainovo */
.kyc-rejected { background: #dc3545; } /* Error Gainovo */
.kyc-under_review { background: #0ea5e9; } /* Info Gainovo */

.referido-volume {
    font-weight: 600;
    color: #28a745; /* Success Gainovo */
    text-align: right;
    font-size: 14px;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.referido-date {
    font-size: 12px;
    color: #6c757d; /* Text-muted Gainovo */
    text-align: right;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Estados vacíos */
.no-referidos {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d; /* Text-muted Gainovo */
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.no-referidos p {
    margin: 0;
    font-size: 16px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .gainovo-arbol-moderno {
        padding: 0 15px;
    }
    
    .arbol-resumen {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .resumen-card {
        height: auto; /* ALTURA AUTOMÁTICA EN MÓVIL */
        min-height: 140px; /* ALTURA MÍNIMA PARA MÓVIL */
    }
    
    .resumen-card.vertical {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        height: auto; /* ALTURA AUTOMÁTICA EN MÓVIL */
        min-height: 140px; /* ALTURA MÍNIMA PARA MÓVIL */
    }
    
    .resumen-card-inner {
        flex-direction: column;
        height: auto; /* ALTURA AUTOMÁTICA EN MÓVIL */
    }
    
    .resumen-text {
        justify-content: flex-start; /* ALINEACIÓN NORMAL EN MÓVIL */
    }
    
    .referido-item {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
        padding: 14px 16px;
    }
    
    .referido-volume,
    .referido-date {
        text-align: center;
    }
    
    .nivel-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .nivel-header {
        padding: 14px 16px;
    }
}

/* Botones de información */
.gainovo-info-button {
    background: none;
    border: none;
    color: #0F52AA; /* Primary Gainovo */
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 5px;
}

.gainovo-info-button:hover {
    background: rgba(15, 82, 170, 0.1); /* Primary Gainovo con transparencia */
}

/* Notices - ESTILO GAINOVO */
.notice {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.notice-error {
    background: rgba(220, 53, 69, 0.1); /* Error Gainovo con transparencia */
    border-left-color: #dc3545; /* Error Gainovo */
    color: #dc3545;
}

.notice-success {
    background: rgba(40, 167, 69, 0.1); /* Success Gainovo con transparencia */
    border-left-color: #28a745; /* Success Gainovo */
    color: #28a745;
}

/* Asegurar que no hay márgenes/padding extra en contenedores */
.gainovo-arbol-moderno * {
    box-sizing: border-box;
}

.arbol-resumen > *,
.arbol-container > * {
    margin-left: 0;
    margin-right: 0;
}

/* Mejoras adicionales Gainovo */
.resumen-card .resumen-valor.highlight {
    color: #167BFF; /* Secondary Gainovo para destacar */
}

.nivel-header .nivel-badge.highlight {
    background: #167BFF; /* Secondary Gainovo */
}

/* Efectos de focus para accesibilidad */
.nivel-header:focus {
    outline: 2px solid #38bdf8; /* Accent Gainovo */
    outline-offset: 2px;
}

.gainovo-info-button:focus {
    outline: 2px solid #38bdf8; /* Accent Gainovo */
    outline-offset: 1px;
}