/* ═══════════════════════════════════════════════════════════
   NETSENSE IOT - EXPLORE VIEW
   Navegación jerárquica minimalista
   ═══════════════════════════════════════════════════════════ */

   /* ═══ PAGE HEADER (igual que Eventos/Informes) ═══ */
   .explore-wrapper {
       display: flex;
       flex-direction: column;
       gap: 24px;
   }

   .explore-page-header {
       margin-bottom: 8px;
   }

   .explore-page-title {
       font-size: 28px;
       font-weight: 600;
       color: var(--text-primary);
       margin: 0 0 4px 0;
   }

   .explore-page-subtitle {
       font-size: 14px;
       color: var(--text-muted);
       margin: 0;
   }

   .explore-content {
       display: flex;
       flex-direction: column;
       gap: 20px;
   }

   /* ═══ BREADCRUMB BAR ═══ */
   .explore-breadcrumb-bar {
       background: var(--bg-secondary);
       border: 1px solid var(--border-primary);
       border-radius: 8px;
       padding: 12px 20px;
   }

   .explore-breadcrumb {
       display: flex;
       align-items: center;
       gap: 8px;
       flex-wrap: wrap;
       font-size: 14px;
   }

   .breadcrumb-link {
       color: var(--primary);
       text-decoration: none;
       transition: opacity 0.15s ease;
   }

   .breadcrumb-link:hover {
       opacity: 0.8;
       text-decoration: underline;
   }

   .breadcrumb-sep {
       color: var(--text-disabled);
   }

   .breadcrumb-current {
       color: var(--text-primary);
       font-weight: 500;
   }

.explore-page {
    padding: 0;
    min-height: 100%;
}

.explore-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ═══ LOADING ═══ */
.explore-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
}

.explore-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══ HEADER ═══ */
.explore-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
}

.explore-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 14px;
}

.explore-nav-item {
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.explore-nav-item:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.explore-nav-separator {
    color: var(--text-disabled);
    font-size: 12px;
}

.explore-nav-current {
    font-weight: 600;
    color: var(--text-primary);
    padding: 4px 8px;
}

.explore-period {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.explore-period:focus {
    outline: none;
    border-color: var(--primary);
}

/* ═══ CHILDREN GRID ═══ */
.explore-children {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.child-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.child-card:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.child-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.child-card-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.3;
}

.child-card-arrow {
    color: var(--text-disabled);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.child-card:hover .child-card-arrow {
    transform: translateX(2px);
    color: var(--primary);
}

.child-card-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.child-card-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
}

.child-card-badge.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.child-card-badge.critical {
    background: var(--danger-light);
    color: var(--danger);
}

/* ═══ ASSETS SECTION ═══ */
.explore-assets {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    overflow: hidden;
}

.explore-assets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
}

.explore-assets-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.explore-assets-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* ═══ ASSETS TABLE ═══ */
.explore-table {
    width: 100%;
    border-collapse: collapse;
}

.explore-table th {
    text-align: left;
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
}

.explore-table th:nth-child(1) {
    width: 30%;
}

.explore-table th:nth-child(2) {
    width: 20%;
}

.explore-table th:nth-child(3) {
    width: 20%;
}

.explore-table th:nth-child(4) {
    width: 15%;
}

.explore-table th:nth-child(5) {
    width: 15%;
    text-align: center;
}

.explore-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-primary);
    vertical-align: middle;
    font-size: 13px;
}

.explore-table td:nth-child(5) {
    text-align: center;
}

.explore-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.explore-table tbody tr:hover {
    background: var(--bg-hover);
}

.explore-table tbody tr:last-child td {
    border-bottom: none;
}

/* Asset name cell */
.explore-container .asset-name-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.asset-name-label {
    font-weight: 500;
    color: var(--text-primary);
}

.asset-name-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Level cell */
.asset-level-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.explore-container .level-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    max-width: 80px;
}

.level-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.level-bar-fill.ok {
    background: var(--success);
}

.level-bar-fill.warning {
    background: var(--warning);
}

.level-bar-fill.critical {
    background: var(--danger);
}

.level-bar-fill.offline {
    background: var(--text-disabled);
}

.level-value {
    font-family: var(--font-mono);
    font-weight: 500;
    min-width: 36px;
}



/* Empty state */
.explore-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.explore-empty-icon {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.explore-empty-text {
    font-size: 14px;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .explore-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .explore-children {
        grid-template-columns: 1fr;
    }

    .explore-table th:nth-child(3),
    .explore-table td:nth-child(3),
    .explore-table th:nth-child(4),
    .explore-table td:nth-child(4) {
        display: none;
    }
}

/* ═══ MAP ═══ */
.explore-map {
    width: 100%;
    height: 500px;
    border-radius: 10px;
    border: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    overflow: hidden;
}

.explore-map-empty {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    color: var(--text-muted);
}

.custom-marker {
    background: transparent !important;
    border: none !important;
}

/* Leaflet tooltip styling */
.leaflet-tooltip {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.leaflet-tooltip-top:before {
    border-top-color: var(--border-primary);
}

/* ═══ NODE DETAIL PANEL (Lateral) ═══ */
.node-detail-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.node-detail-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.node-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.node-detail-panel.open {
    transform: translateX(0);
}

.node-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.node-detail-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.node-detail-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 6px;
    transition: all 0.15s ease;
}

.node-detail-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.node-detail-close svg {
    width: 20px;
    height: 20px;
}

.node-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.node-detail-section {
    margin-bottom: 24px;
}

.node-detail-section:last-child {
    margin-bottom: 0;
}

.node-detail-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.node-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.node-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.node-detail-label {
    font-size: 12px;
    color: var(--text-muted);
}

.node-detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.node-detail-value.mono {
    font-family: var(--font-mono);
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.ok {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.status-badge.critical {
    background: var(--danger-light);
    color: var(--danger);
}

.status-badge.offline {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.status-badge .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Fluid cards */
.node-detail-fluid-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.node-detail-fluid-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.node-detail-fluid-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.node-detail-fluid-info {
    flex: 1;
}

.node-detail-fluid-name {
    font-size: 14px;
    font-weight: 600;
}

.node-detail-fluid-stats {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Assets list */
.node-detail-assets-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.node-detail-asset {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.node-detail-asset:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.node-detail-asset-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.node-detail-asset-info .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.node-detail-asset-info .status-dot.ok {
    background: var(--success);
}

.node-detail-asset-info .status-dot.warning {
    background: var(--warning);
}

.node-detail-asset-info .status-dot.critical {
    background: var(--danger);
}

.node-detail-asset-info .status-dot.offline {
    background: var(--text-disabled);
}

.node-detail-asset-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-detail-asset-level {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.node-detail-asset-pct {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
}

.node-detail-asset-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.node-detail-asset-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.node-detail-asset-bar-fill.ok {
    background: var(--success);
}

.node-detail-asset-bar-fill.warning {
    background: var(--warning);
}

.node-detail-asset-bar-fill.critical {
    background: var(--danger);
}

.node-detail-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Footer */
.node-detail-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.node-detail-footer .btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.node-detail-footer .btn-primary:hover {
    background: var(--primary-hover);
}