/* Estilos para las tarjetas de sede */
.sede-card {
    width: 220px;
    height: 70px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sede-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.sede-card-circle {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    z-index: 0;
}

.sede-card-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 10px;
    width: 100%;
}

.sede-id {
    position: absolute;
    top: 20%;
    left: 10%;
    background: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    vertical-align: middle;
    border:1px solid gray;
    color:gray;
}

.sede-title {
    font-size: 1rem;
    margin: 0;
    padding: 0;
    font-weight: 600;
}

/* Estilos para la información de conexión */
.connection-info-container {
    margin: 10px auto;
    text-align: center;
}

.connection-badge {
    display: inline-block;
    background-color: #28a745;
    color: white;
    font-size: 0.95rem;
    padding: 4px 12px;
    border-radius: 4px;
    margin:10px auto;
    width:100% !important;
    text-align:center;
}

.connection-details {
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.connection-icon {
    flex: 0 0 40px;
    margin-right: 15px;
}

.connection-icon img {
    width: 40px;
    height: 40px;
}

.connection-info {
    flex: 1;
    text-align: left;
}

.connection-info h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: #2e7d32;
}

.connection-data {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    font-size: 0.9rem;
}

.connection-data span {
    margin-right: 10px;
}

/* Badge para la card de conexiones de desarrollo */
.position-relative {
    position: relative;
}

.dev-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #dc3545;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    margin: -4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ═══════════════════════════════════════════════════════════
   ÁRBOL DE CLIENTES Y SEDES — suros-admin-clientes
   Idea: suros-admin-clientes — Vista árbol jerárquica
   ═══════════════════════════════════════════════════════════ */

/* Contenedor principal del árbol */
.client-tree {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* Cada nodo del cliente (nivel raíz) */
.client-tree-node {
    border-bottom: 1px solid #eef0f4;
}

.client-tree-node:last-child {
    border-bottom: none;
}

/* Fila principal del nodo cliente */
.client-tree-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    gap: 10px;
    user-select: none;
}

.client-tree-row:hover {
    background-color: #f0f6ff;
}

.client-tree-row.inactivo {
    opacity: 0.55;
    background-color: #f9fafb;
}

/* Icono de expansión / colapso */
.tree-expand-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #6b7280;
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.tree-expand-icon.expanded {
    transform: rotate(90deg);
}

.tree-expand-icon.hidden {
    visibility: hidden;
}

/* Avatar / icono del cliente */
.client-tree-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.82rem;
    color: #fff;
    /* Fondo por defecto: los clientes que no son grupo (solo su sede principal)
       no traían fondo y el icono blanco quedaba invisible sobre blanco.
       Idea: suros-admin-clientes — legibilidad del avatar del cliente. */
    background: linear-gradient(135deg, #0d6efd, #1e40af);
}

.client-tree-avatar.grupo {
    background: linear-gradient(135deg, #1e3a5f, #0f172a);
}

.client-tree-avatar.sede {
    background: linear-gradient(135deg, #198754, #0d6efd);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 0.72rem;
}

/* Contenido del nodo */
.client-tree-content {
    flex: 1;
    min-width: 0;
}

.client-tree-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.client-tree-code {
    font-weight: 700;
    font-size: 0.82rem;
    color: #0f172a;
    white-space: nowrap;
}

.client-tree-name {
    font-size: 0.72rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.client-tree-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}

/* Barra de progreso del nodo */
.client-tree-progress {
    flex-shrink: 0;
    min-width: 100px;
    max-width: 160px;
}

.progress-mini {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress-mini-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-mini-text {
    font-size: 0.6rem;
    color: #6b7280;
    text-align: right;
    margin-top: 1px;
}

/* Tiempo transcurrido */
.client-tree-time {
    flex-shrink: 0;
    min-width: 80px;
    text-align: right;
    font-size: 0.62rem;
    color: #6b7280;
}

.client-tree-time i {
    margin-right: 3px;
}

/* Badge de estado en el nodo */
.client-tree-status {
    flex-shrink: 0;
}

/* Badges de la pantalla "Gestión de Clientes y Sedes".
   El tamaño y el padding de los badges se centralizaron en la regla estándar del
   componente Badge (wwwroot/css/suros-theme.css + SUROS.Framework/CONTRACTS/BADGE.md):
   font-size 0.75rem, padding 4px 10px, peso 600, line-height 1.25, radius 6px,
   e íconos a 0.64rem. Estos valores nacieron en este panel como precedente
   (idea suros-admin-clientes), así que ya no hacen falta reglas locales. */

/* Subárbol de sedes — indentado */
.client-tree-children {
    padding-left: 32px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.client-tree-children.expanded {
    /* Tope holgado: con clientes de muchas sedes el límite anterior (2000px)
       recortaba la última fila del subárbol. Se amplía y se agrega aire inferior.
       Idea: suros-admin-clientes — visualización completa al desplegar el cliente. */
    max-height: 8000px;
    padding-bottom: 22px;
}

/* Separador visual entre niveles */
.client-tree-children::before {
    content: '';
    position: absolute;
    left: calc(16px + 18px + 16px);
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e5e7eb;
}

.client-tree-children {
    position: relative;
}

/* Fila de sede (hija) */
.sede-tree-row {
    display: flex;
    align-items: center;
    padding: 7px 12px;
    gap: 8px;
    transition: background-color 0.15s ease;
    border-bottom: 1px dashed #f0f2f5;
    cursor: pointer;
}

.sede-tree-row:last-child {
    border-bottom: none;
}

.sede-tree-row:hover {
    background-color: #f8fafc;
}

.sede-tree-row.inactivo {
    opacity: 0.5;
}

/* Indicador de conexión (línea vertical) */
.sede-tree-row::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    width: 12px;
    height: 1px;
    background: #d1d5db;
}

.sede-tree-row {
    position: relative;
}

/* Estado del nodo — punto de color */
.node-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.node-dot.operativa { background: #16a34a; }
.node-dot.degradada { background: #d97706; }
.node-dot.mantenimiento { background: #6b7280; }
.node-dot.fuera-servicio { background: #dc3545; }
.node-dot.inactiva { background: #9ca3af; }

/* Botones de acción en el nodo */
.client-tree-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
    /* Contenedor y botones conservan su ancho natural: el botón "Ver" (y demás
       acciones del nodo) no se parte en dos líneas cuando el nodo se comprime.
       Idea: suros-admin-clientes — acciones legibles en el árbol. */
    white-space: nowrap;
}

.client-tree-actions .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.client-tree-row:hover .client-tree-actions,
.sede-tree-row:hover .client-tree-actions {
    opacity: 1;
}

/* Badges compactos para sedes */
.sede-mini-badges {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}

/* Barra de progreso de sede */
.sede-mini-progress {
    height: 5px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    flex: 1;
    min-width: 60px;
    max-width: 100px;
}

.sede-mini-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Animación de expansión suave */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.client-tree-children.expanded > .sede-tree-row {
    animation: slideDown 0.2s ease forwards;
}

.client-tree-children.expanded > .sede-tree-row:nth-child(1) { animation-delay: 0.02s; }
.client-tree-children.expanded > .sede-tree-row:nth-child(2) { animation-delay: 0.04s; }
.client-tree-children.expanded > .sede-tree-row:nth-child(3) { animation-delay: 0.06s; }
.client-tree-children.expanded > .sede-tree-row:nth-child(4) { animation-delay: 0.08s; }
.client-tree-children.expanded > .sede-tree-row:nth-child(5) { animation-delay: 0.10s; }

/* Responsive */
@media (max-width: 768px) {
    .client-tree-progress {
        min-width: 70px;
        max-width: 100px;
    }
    .client-tree-time {
        min-width: 60px;
        font-size: 0.58rem;
    }
    .client-tree-children {
        padding-left: 16px;
    }
    .client-tree-row {
        padding: 8px 10px;
    }
}

/* ═══════════════════════════════════════════════════════════
   PANEL DE HERRAMIENTAS DE DESPLIEGUE — suros-admin-clientes
   Idea: suros-admin-clientes — Flujo de despliegue desde el árbol
   ═══════════════════════════════════════════════════════════ */

.client-tree-deploy-panel {
    border-top: 2px solid #e2e8f0;
    background: #f8fafc;
}

/* Cabecera del panel de despliegue */
.sede-deploy-section {
    border-bottom: 1px solid #e5e7eb;
}

.sede-deploy-section:last-child {
    border-bottom: none;
}

/* Fila de cabecera de sede en el panel de despliegue */
.sede-deploy-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    user-select: none;
    border-bottom: 1px solid transparent;
}

.sede-deploy-header:hover {
    background-color: #f0f6ff;
}

.sede-deploy-header.has-activity {
    border-bottom: 1px solid #fde68a;
    background-color: #fffbeb;
}

/* Detalle desplegable de la sede */
.sede-deploy-detail {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease;
}

.sede-deploy-detail.expanded {
    max-height: 1500px;
}

/* Formulario flotante de nuevo despliegue */
.deploy-form-overlay {
    position: relative;
    margin: 12px 16px;
}

.deploy-form-card {
    background: #fff;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    overflow: hidden;
}

.deploy-form-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-bottom: 1px solid #bfdbfe;
    font-size: 0.82rem;
}

.deploy-form-header .btn-close {
    margin-left: auto;
    font-size: 0.7rem;
}

.deploy-form-body {
    padding: 14px;
}

.deploy-form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* — Removido fix experimental :has — se vuelve al patrón oficial del Framework */

/* ═══════════════════════════════════════════════════════════
   FIX menú de tres puntos — Gestión de Clientes y Sedes
   — mantiene acciones visibles y evita clip por overflow
   Idea: suros-admin-clientes — menú contextual activo sobre la fila
   ═══════════════════════════════════════════════════════════ */
.client-tree-row.has-open .client-tree-actions,
.sede-tree-row.has-open .client-tree-actions,
.client-tree-row:focus-within .client-tree-actions,
.sede-tree-row:focus-within .client-tree-actions {
    opacity: 1 !important;
}

/* Cuando hay menú abierto, permitir que el dropdown escape del contenedor */
.client-tree:has(.dropdown-menu.show),
.client-tree-node:has(.dropdown-menu.show),
.client-tree-children.expanded:has(.dropdown-menu.show) {
    overflow: visible !important;
}

/* Asegurar que el menú contextual sea clickeable y no quede detrás */
.client-tree-actions .dropdown-menu.show,
td .dropdown-menu.show {
    z-index: 1050 !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.16) !important;
    border: 1px solid #e5e7eb !important;
}

.client-tree-actions .dropdown-menu .dropdown-item,
td .dropdown-menu .dropdown-item {
    cursor: pointer;
    white-space: nowrap;
}

.client-tree-actions .dropdown-menu .dropdown-item:active,
td .dropdown-menu .dropdown-item:active {
    background-color: #eff6ff;
    color: #1e40af;
}
/* Línea de tiempo global de eventos (ADM-OBS-04) — EventosPanel */
.ev-grupo {
    margin-bottom: 18px;
}

.ev-grupo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 2px 8px;
}

.ev-grupo-titulo {
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    text-transform: capitalize;
}

.ev-timeline {
    position: relative;
    padding-left: 26px;
}

    .ev-timeline::before {
        content: "";
        position: absolute;
        left: 10px;
        top: 4px;
        bottom: 4px;
        width: 2px;
        background: #e2e8f0;
        border-radius: 1px;
    }

.ev-item {
    position: relative;
    display: flex;
    gap: 10px;
    padding-bottom: 12px;
}

.ev-dot {
    position: absolute;
    left: -26px;
    top: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.58rem;
    box-shadow: 0 0 0 2px #fff;
}

.ev-card {
    flex: 1;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
}

    .ev-card:hover {
        border-color: #cbd5e1;
        box-shadow: 0 2px 6px rgba(15,23,42,0.08);
    }

.ev-hora {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.ev-titulo {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0f172a;
}

.ev-descripcion {
    font-size: 0.75rem;
    color: #475569;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ev-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
    font-size: 0.68rem;
    color: #64748b;
}

.ev-skeleton {
    display: flex;
    gap: 12px;
    padding: 10px 4px;
}

.ev-skeleton-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: ev-shimmer 1.2s infinite;
}

.ev-skeleton-body {
    flex: 1;
}

.ev-skeleton-line {
    height: 10px;
    border-radius: 4px;
    margin-bottom: 6px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: ev-shimmer 1.2s infinite;
}

@keyframes ev-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}


/* Planes de Despliegue (ADM-DPL-02) */

.pl-form {
    border-left: 3px solid #1a73e8;
}

.pl-detail {
    border-left: 3px solid #1a73e8;
}

.pl-progress {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.pl-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.pl-paso-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1a73e8;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
}

.pl-paso {
    border-left: 3px solid transparent;
}

.pl-paso-completado {
    background: #f0fdf4;
}

.pl-paso-activo {
    background: #eff6ff;
    border-left-color: #1a73e8;
}

.pl-chip-esquema {
    font-weight: 600;
    letter-spacing: 0.03em;
}

.pl-skeleton-line {
    height: 36px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: pl-shimmer 1.2s infinite;
}

@keyframes pl-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

