/* ============================================
   Árbol Genealógico - Frontend Styles
   Diseñado para integrarse con cualquier tema WordPress
   ============================================ */

.gpe-arbol-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
    font-family: inherit;
}

/* ---- Sección de búsqueda ---- */

.gpe-search-section {
    margin-bottom: 24px;
}

.gpe-search-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: inherit;
}

/* Select2: aspecto limpio y grande */
.gpe-arbol-wrapper .select2-container--default .select2-selection--single {
    border: 2px solid #ddd;
    border-radius: 8px;
    height: 48px;
    padding: 8px 12px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
}

.gpe-arbol-wrapper .select2-container--default .select2-selection--single:hover {
    border-color: #2271b1;
}

.gpe-arbol-wrapper .select2-container--default.select2-container--focus .select2-selection--single,
.gpe-arbol-wrapper .select2-container--default.select2-container--open .select2-selection--single {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
    outline: none;
}

.gpe-arbol-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 30px;
    padding-left: 4px;
    color: inherit;
}

.gpe-arbol-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px;
}

.gpe-arbol-wrapper .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999;
}

/* Select2 dropdown: resultados */
.select2-results__option {
    padding: 10px 14px;
    font-size: 14px;
}

.select2-results__option--highlighted {
    background-color: #2271b1 !important;
}

/* ---- Banner de información del perro ---- */

.gpe-perro-info {
    background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
    color: #fff;
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.25);
    line-height: 1.5;
}

.gpe-perro-info strong {
    color: #fff;
}

/* ---- Contenedor del árbol ---- */

.gpe-tree-wrapper {
    margin-top: 20px;
    overflow: auto;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fafbfc;
    padding: 30px 20px;
    min-height: 300px;
    position: relative;
}

.gpe-tree-chart {
    width: 100%;
    min-height: 300px;
    min-width: 700px;
    position: relative;
}

/* ---- Nodos del árbol (Treant.js) ---- */

.nodo-perro {
    background: linear-gradient(135deg, #2271b1 0%, #1a5a8e 100%) !important;
    border-radius: 10px !important;
    padding: 0 !important;
    color: #fff !important;
    font-weight: bold !important;
    font-family: inherit !important;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 10px rgba(34, 113, 177, 0.3) !important;
    border: none !important;
    min-width: 120px;
    text-align: center;
}

.nodo-perro .nodo-inner {
    padding: 10px 20px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    color: #fff;
    user-select: none;
}

/* Nodos clickeables */
.nodo-clickable {
    cursor: pointer !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.nodo-clickable:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(34, 113, 177, 0.45) !important;
    background: linear-gradient(135deg, #2980d9 0%, #2271b1 100%) !important;
}

.nodo-clickable .nodo-inner:hover {
    text-decoration: underline;
}

/* Nodos sin datos en la DB */
.nodo-sin-datos {
    background: linear-gradient(135deg, #6c757d 0%, #555 100%) !important;
    cursor: default !important;
    opacity: 0.8;
}

.nodo-sin-datos:hover {
    transform: none !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2) !important;
}


/* Estilos adicionales para UI Premium */
.nodo-rel-padre {
    border-left: 5px solid #0ea5e9 !important; /* Borde izquierdo azul brillante para el padre */
}

.nodo-rel-madre {
    border-left: 5px solid #ec4899 !important; /* Borde izquierdo rosa brillante para la madre */
}

.gpe-node-name {
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.gpe-node-badge {
    display: inline-block;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 5px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.gpe-badge-padre {
    background-color: rgba(14, 165, 233, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.4);
}

.gpe-badge-madre {
    background-color: rgba(236, 72, 153, 0.2);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.4);
}

/* En nodos sin datos de la BD, hacemos el badge gris */
.nodo-sin-datos .gpe-badge-padre,
.nodo-sin-datos .gpe-badge-madre {
    background-color: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ---- Conectores del árbol ---- */

.gpe-tree-chart .Treant .collapse-switch { display: none; }

/* ---- Spinner de carga ---- */

.gpe-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.gpe-spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: gpe-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes gpe-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---- Mensaje de error ---- */

.gpe-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 14px 20px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    margin-top: 16px;
    font-size: 15px;
}

/* ---- Hint/ayuda ---- */

.gpe-hint {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 15px;
    line-height: 1.6;
}

.gpe-hint .dashicons,
.gpe-hint .gpe-hint-icon {
    font-size: 48px;
    display: block;
    margin: 0 auto 12px;
    opacity: 0.4;
}


/* ---- Breadcrumbs (Historial) ---- */
.gpe-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: #f8f9fa;
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    margin-bottom: 16px;
    color: #555;
    font-size: 14px;
}

.gpe-breadcrumbs span.gpe-bc-item {
    font-weight: 500;
}

.gpe-breadcrumbs a.gpe-bc-link {
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.gpe-breadcrumbs a.gpe-bc-link:hover {
    color: #135e96;
    text-decoration: underline;
}

.gpe-breadcrumbs .gpe-bc-separator {
    margin: 0 8px;
    color: #ccc;
    font-weight: normal;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .gpe-arbol-wrapper {
        padding: 12px 0;
    }

    .gpe-tree-wrapper {
        padding: 15px 10px;
    }

    .gpe-tree-chart {
        min-width: 500px;
    }

    .nodo-perro .nodo-inner {
        padding: 8px 12px;
        font-size: 11px;
    }

    .gpe-perro-info {
        font-size: 13px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .gpe-tree-chart {
        min-width: 400px;
    }

    .nodo-perro .nodo-inner {
        padding: 6px 10px;
        font-size: 10px;
    }
}
