:root {
    --primary-color: #8c25f4;
    --primary-color-hover: #b05bff;
    --secondary-color: #f125a0;
    --accent-color: #1affc6;
    --bg-dark: #07090e;
    --card-bg: rgba(22, 26, 38, 0.65);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    --neon-glow: 0 0 15px rgba(140, 37, 244, 0.4), 0 0 30px rgba(241, 37, 160, 0.2);
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 68px;
}

body {
    background-color: var(--bg-dark);
    font-family: 'Spline Sans', system-ui, -apple-system, sans-serif;
    color: #f1f5f9;
    background-image: radial-gradient(circle at 15% 50%, rgba(140, 37, 244, 0.15), transparent 35%),
                      radial-gradient(circle at 85% 30%, rgba(241, 37, 160, 0.12), transparent 35%);
    background-attachment: fixed;
    background-size: cover;
}

.navbar {
    background: rgba(7, 9, 14, 0.85) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(140, 37, 244, 0.15);
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card, .modal-content {
    background-color: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(140, 37, 244, 0.3);
    box-shadow: var(--neon-glow);
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    padding: 0.6rem 1.7rem;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(140, 37, 244, 0.3);
    transition: all 0.3s ease;
    color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--primary-color-hover) 0%, var(--secondary-color) 100%);
    box-shadow: 0 6px 20px rgba(241, 37, 160, 0.5);
    transform: translateY(-2px);
    color: #fff;
}

/* Sidebar specific dark layout */
#sidebar-container .card {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.list-group-item {
    background-color: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    border-radius: 10px;
    margin-bottom: 0.3rem;
    transition: all 0.2s ease;
}

.list-group-item:hover, .list-group-item:focus {
    background-color: rgba(140, 37, 244, 0.1) !important;
    color: #fff !important;
}

.list-group-item.active {
    background-color: rgba(140, 37, 244, 0.2) !important;
    color: #fff !important;
    border-left: 3px solid var(--primary-color) !important;
}

/* Glassmorphism effects */
.glass {
    background: rgba(22, 26, 38, 0.7);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(140, 37, 244, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================
   LAYOUT PRINCIPAL: sidebar + contenido
   Flexbox puro, sin depender del grid Bootstrap
================================================ */
.app-layout {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - 60px);
}

/* Sidebar: ancho fijo gestionado 100% por CSS */
#sidebar-container {
    width: 260px;
    min-width: 260px;
    overflow: hidden;
    transition: width 0.3s ease, min-width 0.3s ease;
    padding: 1rem 0.75rem;
}

/* Contenido: ocupa el resto */
.app-content {
    flex: 1 1 auto;
    min-width: 0;
    /* Evita overflow */
    padding: 1.5rem;
}

/* ================================================
   SIDEBAR: modo colapsado (solo iconos)
================================================ */
#sidebar-container.sidebar-mini {
    width: 64px !important;
    min-width: 64px !important;
    padding: 1rem 0.25rem;
}

/* Ocultar textos */
#sidebar-container.sidebar-mini .sidebar-text {
    display: none !important;
}

/* Centrar iconos y limpiar padding */
#sidebar-container.sidebar-mini .list-group-item {
    text-align: center;
    padding-left: 0;
    padding-right: 0;
}

#sidebar-container.sidebar-mini .list-group-item i {
    margin-right: 0 !important;
    font-size: 1.2rem;
}

/* Botón toggle */
#btn-toggle-sidebar {
    cursor: pointer;
    transition: opacity 0.2s;
}

#btn-toggle-sidebar:hover {
    opacity: 0.7;
}

/* ================================================
   NAVEGACIÓN INFERIOR PARA MÓVIL
================================================ */
.mobile-navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.25);
    display: none;
    /* Oculto por defecto, CSS lo muestra en móvil */
    padding: 0.4rem 0;
    padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
}

.mobile-navbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.6rem;
    text-decoration: none;
    flex: 1;
    padding: 0.25rem 0.25rem;
    transition: color 0.2s;
}

.mobile-navbar a.active,
.mobile-navbar a:hover {
    color: #fff;
}

.mobile-navbar a i {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.mobile-navbar a span {
    font-size: 0.6rem;
    letter-spacing: 0.01em;
}

/* Sumar espacio al contenido para que no quede tapado por la barra inferior */
body.has-mobile-nav main {
    padding-bottom: 80px !important;
}

/* Custom Table Styles for Dark Theme */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: #f1f5f9;
    --bs-table-hover-bg: rgba(140, 37, 244, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

.table > :not(caption) > * > * {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #94a3b8 !important;
    border-bottom: 2px solid rgba(140, 37, 244, 0.2) !important;
}

@media (max-width: 767px) {
    .mobile-navbar {
        display: flex;
    }

    body.has-mobile-nav main {
        padding-bottom: 80px !important;
    }

    /* El sidebar lateral se oculta completamente en móvil */
    #sidebar-container {
        display: none !important;
    }

    /* El contenido ocupa todo el ancho en móvil */
    #content-container {
        width: 100% !important;
        flex: unset !important;
    }
}