/* ==============================================================================
 * BBM SMART ERP - Unified Tabler Enterprise CSS Stylesheet
 * Standardized for Tabler UI v1.0.0-beta20 + Bootstrap 5 + Inter Font
 * ============================================================================== */

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

:root {
    --tblr-font-sans-serif: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --tblr-primary: #6366f1;       /* Tím chàm Indigo chuẩn kho mực */
    --tblr-primary-rgb: 99, 102, 241;
    --tblr-primary-fg: #ffffff;
    --tblr-body-bg: #f8fafc;
    --tblr-card-border-radius: 14px;
    --tblr-border-color: #e2e8f0;
}

body, html, input, button, select, textarea, table, .table, .card, .btn, .dropdown-menu {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Sidebar Branding & Navigation Customization */
.navbar-vertical[data-bs-theme="dark"] {
    background-color: #0f172a !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.navbar-vertical .navbar-brand {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.navbar-vertical .nav-item .nav-link {
    font-size: 0.86rem;
    font-weight: 500;
    border-radius: 6px;
    margin: 2px 8px;
    padding: 0.55rem 0.75rem;
    color: #94a3b8;
    transition: all 0.15s ease-in-out;
}

.navbar-vertical .nav-item .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.navbar-vertical .nav-item.active > .nav-link,
.navbar-vertical .nav-item .nav-link.active {
    color: #ffffff !important;
    background: #6366f1 !important;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4) !important;
    border-radius: 10px !important;
}

.btn-primary {
    background-color: #6366f1 !important;
    border-color: #6366f1 !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25) !important;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35) !important;
}

.navbar-vertical .nav-link-icon {
    font-size: 1.15rem;
    margin-right: 0.5rem;
}

.navbar-vertical .nav-header {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: #64748b;
    padding: 1rem 1.25rem 0.35rem;
    text-transform: uppercase;
}

/* Page Header & Breadcrumbs */
.page-header {
    margin-bottom: 1.25rem;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.breadcrumb-item a {
    text-decoration: none;
    color: #64748b;
}

.breadcrumb-item a:hover {
    color: var(--tblr-primary);
}

/* Cards & Data Tables Chuẩn Kho Mực */
.card {
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -2px rgba(0, 0, 0, 0.03) !important;
    border-radius: 16px !important;
    background: #ffffff !important;
}

.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.08) !important;
}

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

.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 0.95rem 1.25rem;
    font-weight: 700;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.table {
    margin-bottom: 0;
}

.table-hover tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.04) !important;
}

.badge-lot {
    background: #eef2ff !important;
    color: #4f46e5 !important;
    padding: 5px 10px !important;
    border-radius: 8px !important;
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    border: 1px solid #e0e7ff !important;
    display: inline-block;
}

.table th {
    background-color: #f8fafc !important;
    color: #64748b !important;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.88rem;
    border-bottom: 1px solid #f1f5f9;
}

.table-hover tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.04) !important;
}

/* Badges & Status Dots */
.badge {
    font-weight: 600;
    font-size: 0.76rem;
    letter-spacing: 0.02em;
    padding: 0.3em 0.65em;
    border-radius: 4px;
}

.status-dot-animated {
    animation: status-pulse 1.8s infinite;
}

@keyframes status-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 164, 79, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(46, 164, 79, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 164, 79, 0); }
}

/* Action Buttons */
.btn-action-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.btn-action-icon i {
    font-size: 1rem;
}

/* Metric / Stat Tiles */
.stat-widget {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

/* Launchpad Tiles (Square Portal Cards) */
.portal-module-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2.25rem 1.5rem;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
    height: 100%;
}

.portal-module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 28px -4px rgba(99, 102, 241, 0.12), 0 4px 8px -2px rgba(99, 102, 241, 0.06);
    border-color: #c7d2fe;
    color: #0f172a;
}

.portal-module-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    margin-bottom: 1.25rem;
    transition: transform 0.2s ease;
}

.portal-module-card:hover .portal-module-icon {
    transform: scale(1.08);
}

.portal-module-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    text-align: center;
}

.portal-module-desc {
    font-size: 0.82rem;
    color: #64748b;
    text-align: center;
    margin-bottom: 0.85rem;
    line-height: 1.4;
}

.portal-module-stats {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #475569;
}


/* Layout integration for Module Pages (main-content & app-main) */
@media (min-width: 992px) {
    /* Khi main-content nằm trong page-wrapper của Tabler/KHSX thì KHÔNG được cộng dồn margin-left */
    .page-wrapper .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    body:not(.has-page-wrapper) > .main-content:not(.page-wrapper *), 
    .app-main {
        margin-left: 260px !important;
        width: calc(100% - 260px) !important;
        min-height: calc(100vh - 54px);
        padding: 0 !important;
        background-color: var(--tblr-body-bg);
        transition: margin-left 0.2s ease-in-out;
    }
}

@media (max-width: 991.98px) {
    .main-content, .app-main {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 1rem !important;
    }
    .main-topbar-header {
        margin-left: 0 !important;
    }
}

/* Card & Widget standardization across modules */
.card-custom, .stat-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px 0 rgba(0, 0, 0, 0.02) !important;
    padding: 1.25rem !important;
    margin-bottom: 1.25rem;
}

.stat-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04) !important;
    transform: translateY(-2px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* DataTables & Tabler UI Table Integration */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
    font-size: 0.86rem;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
    font-size: 0.86rem;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
    font-size: 0.86rem;
    outline: none;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #0054a6;
    box-shadow: 0 0 0 0.25rem rgba(0, 84, 166, 0.15);
}

.dataTables_wrapper .page-item.active .page-link {
    background-color: #0054a6 !important;
    border-color: #0054a6 !important;
}

/* Tabler modal styling */
.modal-content {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    border-top-left-radius: 9px;
    border-top-right-radius: 9px;
}

.modal-footer {
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 0.85rem 1.25rem;
    border-bottom-left-radius: 9px;
    border-bottom-right-radius: 9px;
}


/* Desktop topbar unification for muc_ton & other modules */
@media (min-width: 992px) {
    .topbar, .mobile-header {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 15rem !important;
        width: calc(100% - 15rem) !important;
        height: auto !important;
        overflow: visible !important;
        min-height: calc(100vh - 54px);
    }
    .content-area {
        padding: 1.5rem 2rem !important;
        height: auto !important;
        overflow: visible !important;
    }
    body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }
}

/* ==============================================================================
 * BBM SMART ERP - Master Layout UI/UX Refinements (Sidebar, Topbar & Breadcrumbs)
 * ============================================================================== */

.erp-brand-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
    background-color: #ffffff;
    padding: 2px;
}

.border-white-10 {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.letter-spacing-tight {
    letter-spacing: -0.02em;
}

/* Sidebar Custom Styling */
.navbar-vertical.erp-sidebar {
    background-color: #0b1324 !important; /* Premium Dark Navy */
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.erp-sidebar .erp-mod-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.15s ease;
}

.erp-sidebar .erp-mod-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.erp-sidebar .nav-link {
    font-size: 0.86rem;
    font-weight: 500;
    border-radius: 6px;
    margin: 2px 8px;
    padding: 0.55rem 0.75rem;
    color: #94a3b8;
    transition: all 0.15s ease-in-out;
}

.erp-sidebar .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.erp-sidebar .nav-item.active > .nav-link,
.erp-sidebar .nav-link.active {
    color: #ffffff !important;
    background: #0054a6 !important;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 84, 166, 0.35);
}

.erp-sidebar .nav-link-icon {
    font-size: 1.15rem;
    margin-right: 0.65rem;
    width: 20px;
    text-align: center;
}

/* Desktop Sidebar Collapsible System */
@media (min-width: 992px) {
    .erp-sidebar {
        width: 16rem !important;
        transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .page-wrapper {
        margin-left: 16rem !important;
        transition: margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    body.sidebar-collapsed .erp-sidebar {
        width: 4.8rem !important;
    }
    body.sidebar-collapsed .erp-sidebar .erp-sidebar-text,
    body.sidebar-collapsed .erp-sidebar .erp-brand-text,
    body.sidebar-collapsed .erp-sidebar .nav-header {
        display: none !important;
    }
    body.sidebar-collapsed .erp-sidebar .nav-link {
        justify-content: center;
        padding: 0.65rem 0;
        margin: 4px 6px;
    }
    body.sidebar-collapsed .erp-sidebar .nav-link-icon {
        margin-right: 0 !important;
        font-size: 1.35rem;
    }
    body.sidebar-collapsed .erp-sidebar .erp-module-switcher {
        padding: 0.5rem 0.4rem !important;
    }
    body.sidebar-collapsed .page-wrapper {
        margin-left: 4.8rem !important;
    }
}

/* Topbar & Breadcrumbs */
.erp-topbar {
    z-index: 1020;
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.95) !important;
}

.erp-topbar .breadcrumb {
    font-size: 0.86rem;
}

.erp-topbar .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.15rem;
    line-height: 1;
    vertical-align: -1px;
    color: #94a3b8;
    padding: 0 0.45rem;
}

.erp-topbar .breadcrumb-item a {
    color: #64748b;
    transition: color 0.15s ease;
}

.erp-topbar .breadcrumb-item a:hover {
    color: var(--tblr-primary);
}

/* ERP High-Density Table Standard */
.table-erp {
    font-size: 0.86rem;
}

.table-erp th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

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

.table-erp tbody tr:hover {
    background-color: #f8fafc !important;
}

/* ==============================================================================
 * BBM SMART ERP - UI/UX PRO MAX (uupm.cc) MODERN MINIMALIST SAAS DESIGN SYSTEM
 * Style Profile: Modern Minimalist & Swiss Precision (Linear / Vercel Enterprise)
 * ============================================================================== */

:root {
    --uupm-bg: #f8fafc;
    --uupm-card-bg: #ffffff;
    --uupm-border: #e2e8f0;
    --uupm-border-subtle: #f1f5f9;
    --uupm-text-main: #0f172a;
    --uupm-text-muted: #64748b;
    --uupm-primary: #2563eb;       /* Modern Electric Blue */
    --uupm-primary-hover: #1d4ed8;
    --uupm-radius: 8px;
    --uupm-radius-sm: 6px;
}

/* Modern Minimalist Layout Mode (UI/UX Pro Max) */
body.theme-modern {
    background-color: var(--uupm-bg) !important;
    color: var(--uupm-text-main) !important;
}

/* Light & Clean Modern Sidebar */
body.theme-modern .navbar-vertical.erp-sidebar {
    background-color: #ffffff !important;
    border-right: 1px solid var(--uupm-border) !important;
    box-shadow: none !important;
}

body.theme-modern .erp-sidebar .navbar-brand {
    border-bottom: 1px solid var(--uupm-border) !important;
    background: transparent !important;
}

body.theme-modern .erp-sidebar .erp-brand-text .fw-bold {
    color: #0f172a !important;
    font-weight: 800 !important;
}

body.theme-modern .erp-sidebar .erp-brand-text .text-secondary {
    color: #64748b !important;
}

body.theme-modern .erp-sidebar .erp-mod-btn {
    background: #f8fafc !important;
    border: 1px solid var(--uupm-border) !important;
    color: #1e293b !important;
}

body.theme-modern .erp-sidebar .erp-mod-btn .text-white {
    color: #0f172a !important;
}

body.theme-modern .erp-sidebar .erp-mod-btn:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

body.theme-modern .erp-sidebar .nav-header {
    color: #94a3b8 !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
}

body.theme-modern .erp-sidebar .nav-link {
    color: #475569 !important;
    font-weight: 500;
    margin: 2px 10px;
    padding: 0.5rem 0.75rem;
    border-radius: var(--uupm-radius-sm);
    transition: all 0.12s ease;
}

body.theme-modern .erp-sidebar .nav-link:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

body.theme-modern .erp-sidebar .nav-item.active > .nav-link,
body.theme-modern .erp-sidebar .nav-link.active {
    background-color: #eff6ff !important;
    color: var(--uupm-primary) !important;
    font-weight: 600;
    border-left: 3px solid var(--uupm-primary);
    box-shadow: none !important;
}

body.theme-modern .erp-sidebar .nav-item.active > .nav-link .nav-link-icon,
body.theme-modern .erp-sidebar .nav-link.active .nav-link-icon {
    color: var(--uupm-primary) !important;
}

body.theme-modern .erp-sidebar-user {
    border-top: 1px solid var(--uupm-border) !important;
    background: #fafafa;
}

body.theme-modern .erp-sidebar-user .text-white {
    color: #0f172a !important;
}

/* Command Palette Topbar Search Trigger */
.erp-command-trigger {
    background: #f8fafc;
    border: 1px solid var(--uupm-border);
    border-radius: var(--uupm-radius-sm);
    color: #64748b;
    padding: 0.4rem 0.85rem;
    font-size: 0.84rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 240px;
}

.erp-command-trigger:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

.erp-command-trigger kbd {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.72rem;
    font-family: inherit;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

/* Bento-Grid KPI Widgets (UI/UX Pro Max) */
.bento-card {
    background: #ffffff;
    border: 1px solid var(--uupm-border);
    border-radius: var(--uupm-radius);
    padding: 1.25rem;
    transition: border-color 0.15s ease;
    height: 100%;
}

.bento-card:hover {
    border-color: #cbd5e1;
}

.bento-card .bento-label {
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.bento-card .bento-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.bento-card .bento-pill {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Modern Segmented Navigation Tabs */
.nav-segmented {
    background: #f1f5f9;
    padding: 3px;
    border-radius: var(--uupm-radius-sm);
    display: inline-flex;
    gap: 2px;
    border: 1px solid var(--uupm-border);
}

.nav-segmented .nav-link {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    border-radius: 4px;
    border: none;
    transition: all 0.12s ease;
}

.nav-segmented .nav-link:hover {
    color: #0f172a;
}

.nav-segmented .nav-link.active {
    background: #ffffff;
    color: #0f172a;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Swiss High-Density Table with Row Selection */
.table-swiss {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.84rem;
}

.table-swiss thead th {
    background: #fafafa;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid var(--uupm-border);
    border-bottom: 1px solid var(--uupm-border);
    white-space: nowrap;
}

.table-swiss tbody td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--uupm-border-subtle);
    vertical-align: middle;
}

.table-swiss tbody tr:hover td {
    background-color: #f8fafc;
}

.table-swiss .form-check-input {
    border-color: #cbd5e1;
    cursor: pointer;
}

.table-swiss .form-check-input:checked {
    background-color: var(--uupm-primary);
    border-color: var(--uupm-primary);
}


