/**
 * Dashboard VoiceBot ILUMNO v4.0
 * Sidebar CSS
 */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--gradient-sidebar);
    color: white;
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal);
    overflow: hidden;
}

.sidebar:hover {
    width: var(--sidebar-width-expanded);
}

/* Logo */
.sidebar-logo {
    padding: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 70px;
    overflow: hidden;
}

/* Ícono pequeño - visible cuando colapsado */
.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.sidebar-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Ocultar ícono cuando sidebar está expandido */
.sidebar:hover .sidebar-logo-icon {
    width: 0;
    opacity: 0;
    margin: 0;
    overflow: hidden;
}

/* Logo completo - visible cuando expandido */
.sidebar-logo-full {
    height: 32px;
    width: 0;
    opacity: 0;
    transition: all var(--transition-normal);
}

.sidebar:hover .sidebar-logo-full {
    width: auto;
    opacity: 1;
}

/* Navegación */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-sm) 0;
}

.sidebar-section {
    margin-bottom: var(--space-md);
}

.sidebar-section-title {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar:hover .sidebar-section-title {
    opacity: 1;
}

/* Items del sidebar */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-item.active {
    background: rgba(102, 126, 234, 0.3);
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-accent);
    border-radius: 0 2px 2px 0;
}

.sidebar-item-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.sidebar-item:hover .sidebar-item-icon {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-item-icon svg {
    width: 20px;
    height: 20px;
}

/* Colores de iconos */
.sidebar-item-icon.blue { background: rgba(59, 130, 246, 0.2); }
.sidebar-item-icon.green { background: rgba(16, 185, 129, 0.2); }
.sidebar-item-icon.orange { background: rgba(249, 115, 22, 0.2); }
.sidebar-item-icon.purple { background: rgba(139, 92, 246, 0.2); }
.sidebar-item-icon.cyan { background: rgba(6, 182, 212, 0.2); }
.sidebar-item-icon.pink { background: rgba(236, 72, 153, 0.2); }
.sidebar-item-icon.red { background: rgba(239, 68, 68, 0.2); }

.sidebar-item-text {
    font-size: var(--font-size-sm);
    font-weight: 500;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar:hover .sidebar-item-text {
    opacity: 1;
}

/* Badges */
.sidebar-badge {
    position: absolute;
    right: var(--space-md);
    padding: 2px 8px;
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar:hover .sidebar-badge {
    opacity: 1;
}

.sidebar-badge.new {
    background: var(--color-success);
    color: white;
}

.sidebar-badge.beta {
    background: var(--color-warning);
    color: white;
}

/* Badge en modo colapsado (punto) */
.sidebar:not(:hover) .sidebar-badge::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Footer del sidebar */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--space-sm) 0;
}

/* Mobile overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width-expanded);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* En móvil, mostrar logo completo y ocultar ícono */
    .sidebar .sidebar-logo-icon {
        width: 0;
        opacity: 0;
        overflow: hidden;
    }
    
    .sidebar .sidebar-logo-full {
        width: auto;
        opacity: 1;
    }
    
    .sidebar .sidebar-section-title,
    .sidebar .sidebar-item-text,
    .sidebar .sidebar-badge {
        opacity: 1;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* ========================================
   SIDEBAR ITEM DISABLED
   ======================================== */
.sidebar-item.disabled {
    opacity: 0.7;
    cursor: pointer;
}

.sidebar-item.disabled:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-badge.coming-soon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar:hover .sidebar-badge.coming-soon,
.sidebar.expanded .sidebar-badge.coming-soon {
    opacity: 1;
}
/* ========================================
   INDICADOR DE CONEXIÓN
   ======================================== */

/* Estado conectado - palpitante verde */
#sidebarConnectionStatus.connected .sidebar-item-icon {
    animation: pulse-green 2s ease-in-out infinite;
}

/* Estado desconectado - palpitante rojo */
#sidebarConnectionStatus.error .sidebar-item-icon {
    animation: pulse-red 1s ease-in-out infinite;
}

/* Estado conectando - palpitante naranja */
#sidebarConnectionStatus.connecting .sidebar-item-icon {
    animation: pulse-orange 0.8s ease-in-out infinite;
}

/* Animación verde (conectado) */
@keyframes pulse-green {
    0%, 100% {
        background: rgba(16, 185, 129, 0.2);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        background: rgba(16, 185, 129, 0.35);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
}

/* Animación roja (error/desconectado) */
@keyframes pulse-red {
    0%, 100% {
        background: rgba(239, 68, 68, 0.2);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        background: rgba(239, 68, 68, 0.4);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

/* Animación naranja (conectando) */
@keyframes pulse-orange {
    0%, 100% {
        background: rgba(249, 115, 22, 0.2);
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4);
    }
    50% {
        background: rgba(249, 115, 22, 0.4);
        box-shadow: 0 0 0 6px rgba(249, 115, 22, 0);
    }
}

/* Color del ícono según estado */
#sidebarConnectionStatus.connected .sidebar-item-icon svg {
    color: var(--color-success);
}

#sidebarConnectionStatus.error .sidebar-item-icon svg {
    color: var(--color-danger);
}

#sidebarConnectionStatus.connecting .sidebar-item-icon svg {
    color: var(--color-warning);
}