:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 78px;
    --navbar-height: 64px;
    --transition-speed: 0.25s;
}

body {
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* ==========================================================================
   Estructura del Layout Principal
   ========================================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--bs-tertiary-bg);
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) ease, transform var(--transition-speed) ease;
    z-index: 1030;
}

.sidebar-header {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--bs-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-menu {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    color: var(--bs-body-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.925rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    margin-bottom: 0.25rem;
}

.nav-link-custom:hover {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-primary);
}

.nav-link-custom.active {
    background-color: var(--bs-primary);
    color: #ffffff !important;
}

.nav-link-custom i {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
}

/* Sidebar colapsado en desktop */
.app-wrapper.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}

.app-wrapper.sidebar-collapsed .sidebar-brand-text,
.app-wrapper.sidebar-collapsed .nav-text {
    display: none;
}

.app-wrapper.sidebar-collapsed .nav-link-custom {
    justify-content: center;
    padding: 0.65rem;
}

/* Main Content Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-navbar {
    height: var(--navbar-height);
    background-color: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
}

/* Responsive Mobile */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
    }

    .app-wrapper.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1025;
        display: none;
    }

    .app-wrapper.sidebar-open .sidebar-backdrop {
        display: block;
    }
}

/* Tarjetas y componentes */
.card-stat {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* Toast container */
.toast-container {
    z-index: 1090;
}
