/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-body: #f4f6fc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: #2563eb;
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.03), 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Sidebar Styling */
#sidebar {
    width: 270px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--sidebar-bg);
    color: #fff;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#sidebar::-webkit-scrollbar {
    width: 6px;
}
#sidebar::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}
#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.35rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.brand-text {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.sidebar-menu {
    padding: 1.25rem 0.85rem;
    list-style: none;
    margin: 0;
}

.menu-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
    font-weight: 700;
    padding: 0.85rem 1rem 0.35rem;
}

.sidebar-menu .nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
}

.sidebar-menu .nav-link i {
    font-size: 1.15rem;
    transition: transform 0.2s ease;
}

.sidebar-menu .nav-link:hover {
    color: #ffffff;
    background-color: var(--sidebar-hover-bg);
}

.sidebar-menu .nav-link:hover i {
    transform: translateX(3px);
}

.sidebar-menu .nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* Main Content Area */
#main-content {
    margin-left: 270px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* Top Navbar */
.top-navbar {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.9rem 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.dropdown-menu {
    z-index: 1050 !important;
}

/* Cards & Glassmorphism */
.card-custom {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
}

.card-kpi {
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    padding: 1.4rem;
    position: relative;
    overflow: hidden;
}

.card-kpi .kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Multi-Tenant Company Selector */
.company-badge {
    background: var(--accent-light);
    color: var(--accent-primary);
    border: 1px solid rgba(37, 99, 235, 0.2);
    padding: 0.35rem 0.85rem;
    border-radius: 30px;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

/* Custom Table Styles */
.table-custom {
    border-collapse: separate;
    border-spacing: 0 0.4rem;
}

.table-custom tbody tr {
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.15s ease;
}

.table-custom tbody tr:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
}

.table-custom th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    border: none;
    padding: 0.85rem 1rem;
}

.table-custom td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.table-custom td:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    border-left: 1px solid #f1f5f9;
}

.table-custom td:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    border-right: 1px solid #f1f5f9;
}

.btn, a, button {
    cursor: pointer;
}

/* Prevenir desbordamiento horizontal global en celulares */
html, body {
    max-width: 100vw;
    overflow-x: hidden !important;
    position: relative;
}

#main-content {
    max-width: 100vw;
    overflow-x: hidden;
}

.table-responsive {
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.5rem;
}

/* Responsive adjustments for Mobile & Tablet */
@media (max-width: 991.98px) {
    #sidebar {
        margin-left: -270px;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
    }
    #sidebar.show {
        margin-left: 0;
    }
    #main-content {
        margin-left: 0;
    }
    .top-navbar {
        padding: 0.75rem 1rem;
    }
    .company-badge {
        font-size: 0.78rem;
        max-width: 220px;
    }
}

@media (max-width: 767.98px) {
    .container-fluid {
        padding-left: 0.65rem !important;
        padding-right: 0.65rem !important;
    }

    .card-custom {
        padding: 1rem !important;
        border-radius: 12px;
    }

    h3, .h3 {
        font-size: 1.25rem !important;
    }

    h4, .h4 {
        font-size: 1.1rem !important;
    }

    .modal-dialog {
        margin: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .company-badge span {
        max-width: 110px;
        display: inline-block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: bottom;
    }
    .top-navbar {
        padding: 0.5rem 0.65rem;
    }
}

/* ==========================================
   REGLAS DE IMPRESIÓN OFICIAL (IMPRESORA / PDF)
   Oculta la barra lateral, menús y botones
   ========================================== */
@media print {
    #sidebar,
    .top-navbar,
    footer,
    .btn,
    .nav-tabs,
    .no-print {
        display: none !important;
    }

    #main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt !important;
    }

    .container-fluid {
        padding: 0 !important;
    }

    .card-custom {
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        background: #ffffff !important;
        margin-bottom: 15px !important;
        page-break-inside: avoid;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Mostrar encabezado oficial de impresión */
    .print-header {
        display: block !important;
        margin-bottom: 20px;
        text-align: center;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }
}

.print-header {
    display: none;
}
