:root {
    --primary-color: #1e293b;
    --primary-dark: #0f172a;
    --primary-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    --secondary-color: #475569;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --light-gray: #f1f5f9;
    --medium-gray: #64748b;
    --dark-gray: #334155;
    --navbar-height: 70px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Navbar Principal */
.navbar-modern {
    background: var(--primary-gradient) !important;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
    padding: 0;
    height: var(--navbar-height);
    top: 0;
    left: 0;
    right: 0;
    transition: all 0.3s ease;
    border-bottom: 2px solid var(--accent-blue);
    position: relative;
    z-index: 9999;
}

.navbar-modern.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Brand */
.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: white !important;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    transform: translateY(-2px);
    color: var(--accent-cyan) !important;
}

.navbar-brand i {
    font-size: 1.6rem;
    color: var(--accent-blue);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Nav Links */
.navbar-nav {
    align-items: center;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    padding: 1.5rem 1rem !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--accent-blue);
    transform: translateX(-50%);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--accent-blue);
}

.nav-link:hover {
    color: white !important;
    background: rgba(59, 130, 246, 0.1);
}

.nav-link:hover::before {
    width: 80%;
}

.nav-link i {
    font-size: 1.1rem;
    color: var(--accent-cyan);
}

/* Dropdown Menu */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: 12px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    min-width: 250px;
    animation: slideDown 0.3s ease;
    background: var(--primary-dark);
    border: 1px solid var(--dark-gray);
    position: absolute;
    z-index: 10000;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.dropdown-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: var(--accent-blue);
}

.dropdown-item:hover {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-cyan) 100%);
    color: white;
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.dropdown-item:hover i {
    color: white;
}

.dropdown-divider {
    margin: 0.5rem 0;
    opacity: 0.2;
    border-color: var(--medium-gray);
}

.dropdown-header {
    font-weight: 700;
    color: var(--accent-blue);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badge */
.badge {
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.7rem;
    letter-spacing: 0.3px;
}

.badge.bg-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* User Dropdown */
.dropdown-menu-end {
    right: 0;
    left: auto;
}

.text-danger {
    color: var(--danger-color) !important;
}

.dropdown-item.text-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white !important;
}

.dropdown-item.text-danger:hover i {
    color: white !important;
}

/* Navbar Toggler */
.navbar-toggler {
    border: 2px solid rgba(59, 130, 246, 0.5);
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.1);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Demo Content */
.demo-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
}

.card-demo {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    border-left: 4px solid var(--accent-blue);
}

.card-demo h2 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
    border: 1px solid var(--dark-gray);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.stat-card i {
    font-size: 2.5rem;
    opacity: 0.8;
    margin-bottom: 1rem;
    color: var(--accent-blue);
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-card p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
    color: var(--light-gray);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.stat-card:nth-child(2) i {
    color: var(--accent-cyan);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
}

.stat-card:nth-child(3) i {
    color: var(--accent-blue);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.stat-card:nth-child(4) i {
    color: var(--success-color);
}

.dropdown-menu.show {
    position: absolute !important;
    z-index: 10001 !important;
    display: block;
}
@media (max-width: 991.98px) {
    .dropdown-menu.show {
        position: static !important;
    }
}

.dashboard-header {
    border-left: 4px solid var(--accent-blue);
}

.stat-box {
    min-width: 110px;
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.bg-gradient-dark {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: stretch !important;
        text-align: center;
    }

    .stat-box {
        flex: 1 1 45%;
        min-width: 100px;
    }
}

/* ── Submenú anidado ── */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -6px;
    margin-left: 2px;
    min-width: 180px;
}

/* Pequeña flecha indicadora en items con submenú */
.dropdown-submenu > .dropdown-item::after {
    content: '\f054';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: .6rem;
    margin-left: auto;
    opacity: .5;
    transition: transform .2s;
}

.dropdown-submenu:hover > .dropdown-item::after {
    transform: translateX(3px);
    opacity: 1;
}

/* ── Desktop: submenus on hover ── */
@media (min-width: 992px) {
    .dropdown-submenu .dropdown-menu {
        left: 100%;
        top: 0;
        margin-top: -6px;
        margin-left: 2px;
    }
}

/* ══════════════════════════════════════════════════
   MOBILE — Single consolidated block
   ══════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
    .navbar-modern {
        height: auto;
    }
    body {
        padding-top: 0;
    }

    /* ── Collapsed panel: full width, no overflow ── */
    .navbar-collapse {
        background: var(--primary-dark);
        backdrop-filter: blur(10px);
        padding: .5rem .75rem;
        border-radius: 10px;
        margin-top: .5rem;
        border: 1px solid var(--dark-gray);
        max-width: 100%;
        overflow: hidden;
    }

    /* ── Remove slow animations ── */
    .dropdown-menu {
        animation: none !important;
        transition: none !important;
    }
    .dropdown-item {
        transition: none !important;
        transform: none !important;
    }
    .nav-link {
        transition: none !important;
    }

    /* ── Nav items: full width, stacked ── */
    .navbar-nav {
        width: 100%;
    }
    .navbar-nav .nav-item {
        width: 100%;
    }
    .navbar-nav .nav-link {
        padding: .65rem .75rem !important;
        width: 100%;
        border-radius: 8px;
    }
    .navbar-nav .nav-link::before {
        display: none;
    }

    /* ── Dropdowns: static, no overflow ── */
    .dropdown-menu {
        position: static !important;
        box-shadow: none;
        border: none;
        background: rgba(255,255,255,.05);
        margin-left: .75rem;
        margin-top: 0;
        padding: .15rem 0;
        min-width: 0;
        max-width: 100%;
    }
    .dropdown-menu .dropdown-menu {
        margin-left: 1.5rem;
    }

    /* ── Submenus: static position, no overflow ── */
    .dropdown-submenu .dropdown-menu {
        position: static !important;
        left: 0;
        top: 100%;
        margin-top: 2px;
        margin-left: 1rem;
        min-width: 0;
        max-width: 100%;
    }
    .dropdown-submenu > .dropdown-item::after {
        content: '\f078';
    }
}