/* Paleta y fuentes inspiradas en /imagenes (fondos lavanda, acentos violeta y oro) */
:root {
    --hla-bg: #f4f3ff;
    --hla-surface: #ffffff;
    --hla-primary: #4b3f91;
    --hla-primary-dark: #322c66;
    --hla-accent: #f1c40f;
    --hla-highlight: #e6007e;
    --hla-text: #1f1f1f;
    --hla-muted: #6b6b7a;
    --hla-shadow: 0 12px 28px rgba(75, 63, 145, 0.15);
}

/* Estilos para el Monedero en el Checkout */
.hla-checkout-wallet-info {
    margin-bottom: 22px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #f8f7ff 0%, #eef0ff 100%);
    border-left: 6px solid var(--hla-primary);
    border-radius: 12px;
    color: var(--hla-text);
    font-family: 'Poppins', 'Inter', system-ui, -apple-system, sans-serif;
    box-shadow: var(--hla-shadow);
}

.hla-checkout-wallet-info strong {
    display: block;
    font-size: 1.12em;
    margin-bottom: 6px;
    color: var(--hla-primary-dark);
}

.hla-checkout-wallet-info .balance-amount {
    color: var(--hla-primary);
    font-weight: 700;
}

.hla-checkout-wallet-info p {
    margin: 6px 0 0;
    color: var(--hla-muted);
    font-size: 0.95em;
}

.hla-checkout-wallet-info .hla-wallet-note {
    font-weight: 600;
}

.hla-checkout-wallet-info .hla-wallet-note.is-warning {
    color: #b42318;
}

.hla-checkout-wallet-info .hla-wallet-note.is-success {
    color: #127a52;
}

/* Estilos genéricos para paneles */
.hla-dashboard {
    background: var(--hla-surface);
    padding: 22px;
    border-radius: 16px;
    border: 1px solid #e5e3ff;
    box-shadow: var(--hla-shadow);
}

.hla-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}

.hla-stat-card {
    flex: 1;
    background: linear-gradient(145deg, #ffffff 0%, #f6f5ff 100%);
    padding: 16px;
    border-radius: 14px;
    text-align: center;
    border: 1px solid #e5e3ff;
    box-shadow: var(--hla-shadow);
}

.hla-stat-card h4 {
    margin: 0;
    font-size: 0.95em;
    color: var(--hla-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hla-stat-value {
    display: block;
    margin-top: 6px;
    font-size: 1.6em;
    font-weight: 800;
    color: var(--hla-primary-dark);
}

/* Barra de Progreso */
.hla-progress-container {
    margin: 22px 0;
    padding: 18px;
    background: linear-gradient(135deg, #ffffff 0%, #f6f5ff 100%);
    border: 1px solid #e5e3ff;
    border-radius: 14px;
    box-shadow: var(--hla-shadow);
}

.hla-progress-container p {
    margin: 0 0 8px;
    color: var(--hla-muted);
    font-weight: 600;
}

.hla-progress-bar-bg {
    background: #e4e2ff;
    border-radius: 999px;
    height: 14px;
    overflow: hidden;
    margin: 10px 0;
}

.hla-progress-bar-fill {
    background: linear-gradient(90deg, var(--hla-primary) 0%, #8b5cf6 50%, var(--hla-accent) 100%);
    height: 100%;
    transition: width 0.5s ease-in-out;
}

/* Link de referido */
.hla-referral-link {
    margin: 18px 0;
    background: var(--hla-surface);
    border: 1px solid #e5e3ff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--hla-shadow);
}
.hla-referral-link label {
    display: block;
    margin-bottom: 6px;
    color: var(--hla-primary-dark);
    font-weight: 700;
}
.hla-referral-link input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #d7d5ff;
    background: #f8f7ff;
    color: var(--hla-text);
    font-weight: 600;
}
.hla-referral-link input[type="text"]:focus {
    outline: 2px solid var(--hla-primary);
    box-shadow: 0 0 0 3px rgba(75,63,145,0.2);
}

/* Botones genéricos para controles del panel */
.hla-controls button {
    background: var(--hla-primary);
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    margin-right: 8px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--hla-shadow);
    transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.hla-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(75,63,145,0.22);
}
.hla-controls button:active {
    transform: translateY(0);
}

/* Ajustes del contenedor de red (por si los estilos inline cambian) */
#hla-zoom-container {
    background: #f0efff;
    border: 1px solid #d7d5ff;
}

/* Panel de red de referidos */
.hla-tree-wrapper {
    background:
        radial-gradient(circle at top right, rgba(241, 196, 15, 0.14), transparent 28%),
        linear-gradient(180deg, #f7f6ff 0%, #eeedfb 100%);
    border: 1px solid #e5e3ff;
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--hla-shadow);
}

.hla-tree-metrics {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.hla-tree-metrics .card {
    flex: 1;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    border: 1px solid #e7e4ff;
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--hla-shadow);
    text-align: center;
}

.hla-tree-metrics .card h4 {
    margin: 0;
    font-size: 0.88em;
    color: var(--hla-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hla-tree-metrics .card .val {
    display: block;
    margin-top: 8px;
    font-size: 1.85em;
    font-weight: 800;
    color: var(--hla-primary-dark);
}

.hla-zoom-shell {
    position: relative;
    overflow: auto;
    max-height: 560px;
    cursor: grab;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)),
        #eceaf8;
    border-radius: 22px;
    border: 1px solid #d7d5ff;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.hla-tree {
    width: 100%;
    min-width: 720px;
    padding: 36px 28px 56px;
    display: flex;
    justify-content: center;
    transform-origin: 50% 0;
}

.hla-tree ul {
    padding-top: 26px;
    position: relative;
    display: flex;
    justify-content: center;
    padding-left: 0;
}

.hla-tree li {
    list-style: none;
    text-align: center;
    position: relative;
    padding: 20px 14px 0;
}

.hla-tree li::before,
.hla-tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #796fb2;
    width: 50%;
    height: 24px;
    z-index: 0;
}

.hla-tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #796fb2;
}

.hla-tree li:first-child::before,
.hla-tree li:last-child::after {
    border: 0 none;
}

.hla-tree li:first-child::after {
    border-radius: 18px 0 0 0;
}

.hla-tree li:last-child::before {
    border-right: 2px solid #796fb2;
    border-radius: 0 18px 0 0;
}

.hla-tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #796fb2;
    width: 0;
    height: 24px;
    margin-left: -1px;
}

.hla-tree ul ul::after {
    content: '▼';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #ffd46b 0%, #f1c40f 100%);
    color: #2f2f2f;
    border-radius: 999px;
    width: 24px;
    height: 24px;
    font-size: 10px;
    line-height: 24px;
    z-index: 1;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.16);
}

.hla-node {
    position: relative;
    background: rgba(255, 255, 255, 0.96);
    padding: 18px;
    border-radius: 20px;
    box-shadow: 0 14px 28px rgba(52, 44, 102, 0.12);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 180px;
    border: 1px solid rgba(229, 227, 255, 0.9);
}

.hla-node[data-clickable="true"] {
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.18s ease;
}

.hla-node[data-clickable="true"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 30px rgba(52, 44, 102, 0.16);
}

.hla-node h3 {
    margin: 12px 0 6px;
    font-size: 15px;
    line-height: 1.2;
    color: var(--hla-primary-dark);
    font-weight: 800;
}

.hla-node p {
    margin: 0 0 10px;
    font-size: 11px;
    color: var(--hla-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hla-circle {
    width: 78px;
    height: 78px;
    border: 4px solid var(--hla-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background:
        radial-gradient(circle at 35% 30%, rgba(255, 212, 107, 0.35), transparent 44%),
        #fff;
}

.hla-circle .initials {
    font-size: 24px;
    font-weight: 700;
    color: #374151;
    line-height: 1;
}

.hla-circle .role {
    font-size: 9px;
    font-weight: 700;
    color: #9388bb;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
}

.hla-node-main {
    width: 160px;
    min-height: 160px;
    justify-content: center;
    background: linear-gradient(180deg, #ffffff 0%, #f8f7ff 100%);
}

.hla-node-main .hla-circle {
    width: 96px;
    height: 96px;
    border-width: 5px;
}

.hla-gain {
    font-weight: 800;
    color: #127a52;
    font-size: 12px;
}

.hla-controls {
    margin-top: 14px;
}

@media (max-width: 768px) {
    .hla-stats,
    .hla-tree-metrics {
        flex-direction: column;
    }

    .hla-tree-wrapper {
        padding: 16px;
        border-radius: 18px;
    }

    .hla-tree {
        min-width: 600px;
        padding: 28px 18px 42px;
    }
}

/* --- Sidebar de Detalles del Referido --- */
.hla-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(31, 31, 31, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.hla-sidebar-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.hla-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 100%;
    max-width: 380px;
    height: 100vh;
    background: var(--hla-surface);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-radius: 24px 0 0 24px;
}

.hla-sidebar.is-open {
    right: 0;
}

.hla-sidebar-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--hla-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.hla-sidebar-close:hover {
    color: var(--hla-highlight);
}

.hla-sidebar-content {
    padding: 60px 30px 40px;
}

.hla-sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #e5e3ff;
    padding-bottom: 25px;
}

.hla-sidebar-header h3 {
    margin: 15px 0 5px;
    color: var(--hla-primary-dark);
    font-size: 22px;
}
