/* =====================
VARIABLES
===================== */
:root {
    --primary-color: #0d47a1;
    --primary-hover: #1565c0;
    --bg-light: #f8f9fa;
    --sidebar-width: 250px;
}

/* =====================
RESET BASE
===================== */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
}

/* =====================
LAYOUT PRINCIPAL
===================== */
.page {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
}

article.content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: var(--bg-light);
}

/* =====================
SIDEBAR
===================== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    background: linear-gradient(180deg, #1e3a5f 0%, #0d2137 100%) !important;
    display: flex;
    flex-direction: column;
}

    .sidebar .top-row {
        background-color: rgba(255, 255, 255, 0.05) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        padding: 1rem;
        height: auto;
    }

    .sidebar .navbar-brand {
        color: #ffffff !important;
        font-weight: 700;
        font-size: 1.1rem;
        letter-spacing: 0.5px;
    }

    .sidebar .nav-item {
        padding: 0.15rem 0.75rem;
    }

    .sidebar .nav-link {
        color: rgba(255, 255, 255, 0.75) !important;
        border-radius: 8px;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        gap: 0.6rem;
    }

        .sidebar .nav-link:hover {
            color: #ffffff !important;
            background-color: rgba(255, 255, 255, 0.12);
        }

        .sidebar .nav-link.active {
            color: #ffffff !important;
            background-color: rgba(255, 255, 255, 0.2);
            font-weight: 600;
        }

    .sidebar small.text-white-50 {
        font-size: 0.7rem;
        letter-spacing: 1px;
        text-transform: uppercase;
        display: block;
        padding: 0.75rem 1rem 0.25rem;
        color: rgba(255, 255, 255, 0.4) !important;
    }

    .sidebar .border-top {
        border-color: rgba(255, 255, 255, 0.1) !important;
    }

/* =====================
TOPBAR
===================== */
.topbar {
    min-height: 3.5rem;
    flex-shrink: 0;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: relative;
    z-index: 100;
    overflow: visible;
}

    /* Controles dentro del topbar: texto oscuro */
    .topbar select,
    .topbar input,
    .topbar label,
    .topbar span:not(.bi) {
        color: #1e293b !important;
    }

    .topbar .form-select {
        border-color: #cbd5e1;
        background-color: #ffffff;
        font-size: 0.9rem;
        font-weight: 500;
        color: #0d47a1 !important;
        max-width: 300px;
    }

        .topbar .form-select:focus {
            border-color: #0d47a1;
            box-shadow: 0 0 0 0.25rem rgba(13, 71, 161, 0.1);
        }

    .topbar .company-label {
        font-weight: 600;
        color: #64748b !important;
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
    }

/* =====================
BOTÓN DE USUARIO
===================== */
.user-menu-toggle {
    color: #0d47a1 !important;
    font-weight: 600;
    font-size: 0.9rem;
    border: 0;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    background-color: transparent;
    transition: all 0.2s ease;
}

    .user-menu-toggle:hover,
    .user-menu-toggle:focus,
    .user-menu-toggle.show {
        background-color: rgba(13, 71, 161, 0.08) !important;
        color: #1565c0 !important;
        box-shadow: none !important;
    }

    .user-menu-toggle .bi {
        font-size: 1.2rem;
        color: inherit;
    }

.dropdown-toggle::after {
    vertical-align: middle;
}

/* =====================
DROPDOWN MENÚ
===================== */
.dropdown-menu {
    z-index: 1050;
    min-width: 220px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #334155 !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s ease;
}

    .dropdown-item:hover {
        background-color: #f1f5f9;
        color: #0d47a1 !important;
    }

    .dropdown-item.text-danger {
        color: #dc2626 !important;
    }

        .dropdown-item.text-danger:hover {
            background-color: #fef2f2;
            color: #b91c1c !important;
        }

.dropdown-divider {
    border-color: #e2e8f0;
    margin: 0.35rem 0;
}

/* =====================
BOTONES GLOBALES
===================== */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

    .btn-primary:hover {
        background-color: var(--primary-hover);
        border-color: var(--primary-hover);
    }

/* =====================
LOGIN
===================== */
.login-container {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d47a1 0%, #1a237e 100%);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    background: white;
}

/* =====================
   RESPONSIVE / MÓVIL
   ===================== */
.mobile-nav-button {
    display: none;
    border: none;
    padding: 0.25rem 0.5rem;
    background: transparent;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
}

    .sidebar-overlay.show {
        display: block;
    }

@media (max-width: 767.98px) {

    .mobile-nav-button {
        display: block !important;
    }

    /* Anular las propiedades fijas del sidebar base */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        min-width: unset !important; /* <-- esto es clave */
        z-index: 2000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease-in-out !important;
        flex-shrink: unset !important;
    }

        .sidebar.show {
            transform: translateX(0) !important;
        }

    main {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .topbar {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

@media (min-width: 768px) {
    .mobile-nav-button {
        display: none !important;
    }

    .sidebar {
        position: relative !important;
        transform: none !important;
        min-width: var(--sidebar-width) !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}
/* Botón hamburguesa */
.mobile-nav-button {
    display: none; /* Oculto en PC */
    border: none;
    padding: 0.25rem 0.5rem;
}