/**
 * Sistema de Navegación Centralizado - DigiTech ITSM
 * Estilos para el sidebar y menú de navegación
 * Versión: 1.0.0
 */

/* Sidebar Container - Usar ID + clase para máxima especificidad contra Tailwind */
#sidebar.ti-sidebar,
.ti-sidebar {
    background: linear-gradient(135deg, #8b5cf6, #a855f7, #c084fc) !important;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.3) !important;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 16rem;
    z-index: 50;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar personalizado para el sidebar */
.ti-sidebar::-webkit-scrollbar {
    width: 6px;
}

.ti-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.ti-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.ti-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Header del Sidebar */
.ti-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 4rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ti-sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin: 0;
    text-align: center;
}

/* Navegación del Sidebar */
.ti-sidebar nav {
    margin-top: 1.25rem;
    padding: 0 0.5rem;
}

.ti-sidebar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Elementos del Menú */
.ti-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.ti-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: white;
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ti-menu-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
    transform: translateX(5px);
    color: white !important;
}

.ti-menu-item:hover::before {
    transform: scaleY(1);
}

.ti-menu-item.active {
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px);
    transform: translateX(5px);
    color: white !important;
    font-weight: 600;
}

.ti-menu-item.active::before {
    transform: scaleY(1);
}

/* Iconos del Menú */
.ti-menu-item svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    stroke: currentColor;
    margin-right: 0.75rem;
}

.ti-menu-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
}

/* Estado Mobile - Sidebar Oculto */
@media (max-width: 1023px) {
    .ti-sidebar {
        transform: translateX(-100%);
    }

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

/* Overlay para cerrar el sidebar en mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

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

/* Responsive Design */
@media (min-width: 1024px) {
    .ti-sidebar {
        transform: translateX(0) !important;
    }
}

/* Dark Mode Support (para futuro) */
@media (prefers-color-scheme: dark) {
    .ti-sidebar {
        box-shadow: 0 0 40px rgba(139, 92, 246, 0.5);
    }
}

/* Animaciones */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.ti-sidebar.animating {
    animation: slideInLeft 0.3s ease-out;
}

/* Print Styles */
@media print {
    .ti-sidebar,
    .sidebar-overlay {
        display: none !important;
    }
}

/* Accessibility */
.ti-menu-item:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.ti-menu-item:focus:not(:focus-visible) {
    outline: none;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ti-sidebar {
        background: #6b21a8;
        border-right: 2px solid white;
    }

    .ti-menu-item {
        border: 1px solid transparent;
    }

    .ti-menu-item:hover,
    .ti-menu-item.active {
        border-color: white;
        background: rgba(255, 255, 255, 0.3);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ti-sidebar,
    .ti-menu-item,
    .sidebar-overlay {
        transition: none;
        animation: none;
    }

    .ti-menu-item:hover,
    .ti-menu-item.active {
        transform: none;
    }
}
