/* Gemelo Digital - Layout con Menu */

/* Layout Principal */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--bg-tertiary);
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(79, 195, 247, 0.08));
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-blue), #0288d1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(79, 195, 247, 0.3);
}

.logo-text h1 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.logo-text span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    margin: 0.1rem 0;
}

.nav-link:hover {
    background: rgba(79, 195, 247, 0.08);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(79, 195, 247, 0.12);
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
}

.nav-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    background: var(--accent-blue);
    color: white;
}

.nav-icon.dashboard { background: linear-gradient(135deg, #2196f3, #1976d2); color: white; }
.nav-icon.pid { background: linear-gradient(135deg, #4caf50, #388e3c); color: white; }
.nav-icon.predictions { background: linear-gradient(135deg, #8b5cf6, #6366f1); color: white; }
.nav-icon.equipos { background: linear-gradient(135deg, #ff9800, #f57c00); color: white; }
.nav-icon.arquitectura { background: linear-gradient(135deg, #9c27b0, #7b1fa2); color: white; }
.nav-icon.grafana { background: linear-gradient(135deg, #ff5722, #e64a19); color: white; }
.nav-icon.config { background: linear-gradient(135deg, #607d8b, #455a64); color: white; }

.nav-text {
    flex: 1;
}

.nav-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    background: var(--accent-blue);
    color: white;
    border-radius: 10px;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--bg-tertiary);
    background: var(--bg-tertiary);
}

.connection-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-yellow);
    animation: pulse 1.5s infinite;
}

.connection-dot.connected {
    background: var(--accent-green);
    animation: none;
}

.connection-dot.disconnected {
    background: var(--accent-red);
    animation: none;
}

/* Main Content */
.main-wrapper {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.top-bar-center {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sim-time {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: var(--accent-blue);
    background: var(--bg-primary);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--bg-tertiary);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-menu:hover {
    background: rgba(79, 195, 247, 0.15);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), #0288d1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: white;
    font-weight: 600;
}

.user-name {
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: var(--accent-blue);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-secondary);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.page-header h2 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h2::before {
    content: "";
    width: 4px;
    height: 24px;
    background: var(--accent-blue);
    border-radius: 2px;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }
}

@media (max-width: 576px) {
    .top-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .top-bar-center {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* Collapsible Navigation Section */
.nav-collapsible {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.nav-collapsible:hover {
    color: var(--text-primary);
}

.nav-toggle-icon {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--accent-blue);
    transition: transform 0.2s;
}

.nav-collapsible-content {
    overflow: hidden;
    max-height: 200px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.nav-collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
}

/* Synoptic Container - Larger */
.synoptic-container {
    width: 100%;
    min-height: calc(100vh - 180px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0.5rem;
}

.synoptic-container svg {
    width: 100%;
    max-width: 1400px;
    height: auto;
    min-height: 600px;
}
