@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #10b981;
    --info: #06b6d4;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --light: #f8fafc;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f1f5f9;
    color: #334155;
    overflow-x: hidden;
}

/* Layout Wrapper */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #94a3b8;
    flex-shrink: 0;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}

.sidebar-brand i {
    color: var(--primary);
    font-size: 1.4rem;
}

.sidebar-menu-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.85rem 0.75rem;
}

/* Custom Scrollbar */
.sidebar-menu-wrapper::-webkit-scrollbar {
    width: 5px;
}
.sidebar-menu-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-menu-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.sidebar-menu-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

.sidebar-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    font-weight: 700;
    color: #64748b;
    padding: 0.75rem 0.85rem 0.25rem;
}

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

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

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

.sidebar-link.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

/* Dropdown / Accordion Toggles */
.sidebar-link.dropdown-toggle-custom {
    justify-content: space-between;
}

.sidebar-link.dropdown-toggle-custom > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-link.dropdown-toggle-custom .dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease-in-out;
    opacity: 0.7;
}

.sidebar-link.dropdown-toggle-custom[aria-expanded="true"] .dropdown-arrow,
.sidebar-link.dropdown-toggle-custom:not(.collapsed) .dropdown-arrow {
    transform: rotate(90deg);
    opacity: 1;
}

.sidebar-link.parent-active {
    color: #ffffff;
    font-weight: 600;
}

/* Submenu / Dropdown items */
.sidebar-dropdown-menu {
    list-style: none;
    padding: 0.2rem 0;
    margin: 0;
}

.sidebar-dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.85rem 0.5rem 2.25rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.84rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 0.15rem;
}

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

.sidebar-dropdown-link.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.sidebar-dropdown-link i {
    font-size: 0.95rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f8fafc;
}

/* Navbar */
.top-navbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

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

/* Cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    background: #ffffff;
    margin-bottom: 1.5rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* =========================================================================
   ESTILOS GLOBALES DE TABLAS Y LISTADOS (Consistencia con Facturación)
   ========================================================================= */
.table,
.table-responsive .table {
    font-size: 0.8125rem;
}

.table thead tr,
.table thead th {
    font-size: 0.75rem;
    font-weight: 600;
}

.table th,
.table td {
    vertical-align: middle;
}


/* Badges */
.badge-fe-aceptado {
    background: #dcfce7;
    color: #15803d;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 9999px;
}

.badge-fe-pendiente {
    background: #fef3c7;
    color: #b45309;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 9999px;
}

.badge-fe-rechazado {
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 9999px;
}

/* POS Interface Styles */
.pos-product-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    height: 100%;
    background: #ffffff;
}

.pos-product-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pos-cart-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-top: none;
}

.pos-cart-totals {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 1rem;
}

/* =========================================================================
   DISEÑO RESPONSIVO MÓVIL Y TABLET (< 992px)
   ========================================================================= */
@media (max-width: 991.98px) {
    .app-wrapper {
        position: relative;
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    }

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

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(2px);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        width: 100%;
        min-width: 100%;
    }

    .top-navbar {
        padding: 0.6rem 0.85rem;
    }

    .content-body {
        padding: 0.85rem;
    }
}

/* =========================================================================
   BADGES DE COMPROBANTES DE ALTA LEGIBILIDAD (FE, TE, NC, ND, FEX, TI)
   ========================================================================= */
.bg-purple-subtle {
    background-color: #f3e8ff !important;
}
.text-purple {
    color: #6b21a8 !important;
}
.border-purple-subtle {
    border-color: #d8b4fe !important;
}

.badge-doc-fe {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    border: 1px solid #bfdbfe !important;
}
.badge-doc-te {
    background-color: #f3e8ff !important;
    color: #6b21a8 !important;
    border: 1px solid #d8b4fe !important;
}
.badge-doc-nc {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fca5a5 !important;
}
.badge-doc-nd {
    background-color: #e0f2fe !important;
    color: #0369a1 !important;
    border: 1px solid #bae6fd !important;
}
.badge-doc-fex {
    background-color: #dcfce7 !important;
    color: #166534 !important;
    border: 1px solid #86efac !important;
}
.badge-doc-ti {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}

/* =========================================================================
   ESTILOS DE IMPRESIÓN Y GENERACIÓN DE REPORTES / PDF (CORPORATIVO)
   ========================================================================= */
@media print {
    /* Ocultar elementos de interfaz web */
    .sidebar,
    .top-navbar,
    .no-print,
    .btn,
    .btn-group,
    .nav-pills,
    .nav-tabs,
    .card-header-tabs,
    .pagination,
    .modal-footer,
    .modal-header .btn-close,
    form,
    .form-control,
    .form-select,
    .swal2-container,
    .dropdown-menu {
        display: none !important;
    }

    /* Reset de contenedor principal */
    body, html {
        background-color: #ffffff !important;
        background: #ffffff !important;
        color: #0f172a !important;
        font-size: 10pt !important;
        font-family: 'Inter', Arial, sans-serif !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
    }

    .app-wrapper, .main-content, .content-body {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        min-height: auto !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        margin-bottom: 1rem !important;
        padding: 0 !important;
    }

    .card-header, .card-body {
        padding: 0.5rem 0 !important;
        border: none !important;
    }

    /* Si se está imprimiendo el contenedor de reporte imprimible */
    body.is-printing-report * {
        visibility: hidden;
    }
    body.is-printing-report #printableReportArea,
    body.is-printing-report #printableReportArea * {
        visibility: visible;
    }
    body.is-printing-report #printableReportArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        display: block !important;
    }

    /* Tablas en impresión */
    .table-responsive {
        overflow: visible !important;
    }

    .table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 8.5pt !important;
        page-break-inside: auto;
    }

    .table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    .table thead {
        display: table-header-group !important;
    }

    .table tfoot {
        display: table-footer-group !important;
    }

    .table th, .table td {
        border: 1px solid #cbd5e1 !important;
        padding: 4px 6px !important;
        color: #0f172a !important;
    }

    .table thead th {
        background-color: #f1f5f9 !important;
        font-weight: 700 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Insignias y badges en impresión */
    .badge {
        border: 1px solid #64748b !important;
        color: #0f172a !important;
        background: transparent !important;
        font-size: 7.5pt !important;
        padding: 2px 4px !important;
    }

    /* Ajuste de página */
    @page {
        size: letter portrait;
        margin: 1.2cm 1cm 1.2cm 1cm;
    }

    @page landscape {
        size: letter landscape;
        margin: 1cm 1cm 1cm 1cm;
    }
}

