/* Estilo del contenedor principal */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Fondo animado para el wrapper */
.wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #1e3c72, #2a5298, #1e3c72);
    background-size: 200% 200%;
    animation: gradientAnimation 15s ease infinite;
    z-index: -1;
}

/* Animación del gradiente de fondo */
@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Estilo del sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #1e3c72 0%, #2a5298 100%);
    background-size: 200% 200%;
    color: #fff;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    padding-top: 20px;
    transition: all 0.5s ease;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    animation: gradientAnimation 10s ease infinite;
}

/* Sidebar colapsado */
.sidebar.collapsed {
    width: 60px;
}

/* Ajustar el contenido del sidebar cuando está colapsado */
.sidebar.collapsed .sidebar-brand {
    font-size: 1rem;
    padding: 10px;
}

.sidebar.collapsed .sidebar-brand span {
    display: none;
}

.sidebar.collapsed .toggle-btn {
    width: 40px;
    height: 40px;
    margin: 0 auto;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

/* Botón de hamburguesa para colapsar/expandir */
.toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px auto;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Estilo del título del sidebar */
.sidebar .sidebar-brand {
    padding: 20px;
    text-align: center;
    font-size: 1.8rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar .sidebar-brand:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Estilo de la lista de navegación del sidebar */
.sidebar .sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Estilo de los enlaces del sidebar */
.sidebar .nav-link {
    color: #e9ecef;
    padding: 12px 20px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
}

.sidebar .nav-link i {
    margin-right: 10px;
    transition: transform 0.3s ease;
}

.sidebar .nav-link span {
    transition: opacity 0.3s ease;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left: 4px solid #ffd700;
    transform: translateX(5px);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    animation: bounce 0.5s ease;
}

.sidebar .nav-link:hover i {
    transform: scale(1.2);
}

/* Efecto de resplandor al hacer hover */
.sidebar .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

.sidebar .nav-link:hover::before {
    left: 100%;
}

/* Animación de rebote */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(0); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(5px); }
}

/* Contenido principal */
.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 30px;
    background-color: #f8f9fa;
    transition: all 0.5s ease;
    position: relative;
    animation: fadeInContent 1s ease-in-out;
}

/* Contenido principal cuando el sidebar está colapsado */
.main-content.expanded {
    margin-left: 60px;
    width: calc(100% - 60px);
}

/* Animación de entrada para el contenido principal */
@keyframes fadeInContent {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Estilo de los mensajes de éxito y error */
.alert-success {
    background: #d4edda;
    color: #155724;
    border: none;
    max-width: 400px;
    margin: 0 auto 15px;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.5s ease-in-out;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: none;
    max-width: 400px;
    margin: 0 auto 15px;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.5s ease-in-out;
}

/* Animación de entrada para los mensajes */
@keyframes slideIn {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Estilo del footer */
footer {
    text-align: center;
    padding: 15px;
    color: #6c757d;
    font-size: 0.9rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
    margin-top: 20px;
}

/* Estilo responsivo: ocultar el sidebar en pantallas pequeñas */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .toggle-btn {
        display: none;
    }
}