/* 
 * Compact & Sharp UI Overrides 
 * This file systematically overrides default styles across all 205 backend pages
 * to make the entire panel consistently compact and sharp.
 */

/* =========================================
   1. LAYOUT & CONTAINERS
   ========================================= */
.card {
    border-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    margin-bottom: 15px !important;
}

.card .card-header {
    border-radius: 4px 4px 0 0 !important;
    padding: 0.75rem 1rem !important; /* Tighter header */
}

.card-body {
    padding: 1rem !important; /* Reduced from 1.6rem */
}

.main-content-inner {
    padding: 0 15px 30px !important; /* Reduced side padding */
}

.header-area {
    padding: 8px 15px !important; /* Reduced padding */
    min-height: 50px !important;
}

.page-title-area {
    padding: 8px 15px !important;
}

/* Slimmer Sidebar & Global White Styling */
.sidebar-menu {
    width: 240px !important;
    max-width: 240px !important;
    background: #ffffff !important; /* Pure white modern sidebar globally */
    border-right: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.02) !important; /* Soft edge shadow */
}

.sbar_collapsed .sidebar-menu {
    margin-left: -240px !important;
}

/* Top-Level Menu Items */
.metismenu > li > a {
    padding: 10px 15px !important; 
    font-size: 14px !important;
    margin: 4px 15px !important; /* Pill shape margin */
    border-radius: 8px !important; /* Modern rounded pills */
    color: #4b5563 !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    transition: background-color 0.2s ease, color 0.2s ease !important;
}

/* Hover on top-level items */
.metismenu > li > a:hover {
    background: #eff6ff !important; /* Very light blue hover background */
    color: #2563eb !important; /* Vibrant blue hover text */
}

/* Active top-level page (without sub-menu) */
.metismenu > li.active-nav > a {
    background: #111827 !important; /* Solid black background */
    color: #ffffff !important; /* White text */
    font-weight: 600 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
}

/* Parent folder of active sub-page (override active-nav style so folder isn't black) */
.metismenu > li.active-nav:has(ul) > a,
.metismenu > li.active-nav.active > a {
    background: #dbeafe !important; /* Premium light blue background */
    color: #1e3a8a !important; /* Dark blue text */
    font-weight: 700 !important; /* Extra bold */
    border-left: 4px solid #3b82f6 !important; /* Vibrant blue left indicator line */
    border-radius: 8px !important; /* Fully rounded on both sides */
    box-shadow: none !important;
}

/* Folder that is currently expanded (regardless of active sub-page) */
.metismenu > li.active > a {
    background: #eff6ff !important; /* Very light blue background */
    color: #1e3a8a !important; /* Dark blue text */
    font-weight: 600 !important;
    box-shadow: none !important;
}

/* Ensure icons and arrows inherit the parent color and are centered */
.metismenu li a i {
    color: inherit !important;
}
.metismenu li a:after {
    color: inherit !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    transition: transform 0.2s ease !important;
}

/* Ensure parent li itself doesn't show any background color */
.metismenu li {
    background: transparent !important;
}

body.guest, .main-content {
    background-color: #f4f6f9 !important; /* Standardized cool grey */
}

/* =========================================
   2. FORMS & INPUTS
   ========================================= */
.form-control, 
.custom-select {
    border-radius: 4px !important;
    height: 34px !important; /* Shorter inputs */
    padding: 4px 10px !important;
    font-size: 14px !important;
}

.select2-container .select2-selection--single {
    border-radius: 4px !important;
    height: 34px; /* Shorter inputs (no !important to allow overrides like invoice form) */
    padding: 4px 10px; /* no !important to allow custom padding */
    font-size: 14px !important;
}

.select2-container .select2-selection--multiple {
    border-radius: 4px !important;
    min-height: 34px; /* Flexible height to support multiple selected items */
    padding: 4px 10px; /* no !important to allow custom padding */
    font-size: 14px !important;
}

/* Fix select2 inner line-heights */
.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 26px; /* no !important to allow override */
}
.select2-container .select2-selection--single .select2-selection__arrow {
    height: 32px; /* no !important to allow override */
}

.form-group {
    margin-bottom: 12px !important; /* Tighter spacing between fields */
}

.col-form-label {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    font-size: 14px !important;
}

/* =========================================
   3. BUTTONS
   ========================================= */
.btn {
    border-radius: 4px !important;
    padding: 5px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    height: 34px !important;
    line-height: 1.5 !important;
    box-shadow: none !important; /* Flatter, sharper look */
}

.btn-sm, .btn-group-sm > .btn {
    padding: 3px 8px !important;
    font-size: 12px !important;
    height: 28px !important;
}

/* =========================================
   4. TABLES & DATATABLES
   ========================================= */

/* -- Base Table -- */
.table {
    font-size: 13px !important;
    margin-bottom: 0 !important;
    border-collapse: collapse !important;
}

.table th,
.table td {
    padding: 0.55rem 0.75rem !important;
    vertical-align: middle !important;
    border-top: 1px solid #f0f0f0 !important;
}

/* -- Table Head -- */
.table thead th {
    font-weight: 700 !important;
    text-transform: uppercase !important;
    font-size: 11px !important;
    letter-spacing: 0.6px !important;
    background-color: #f1f5f9 !important;
    border-top: none !important;
    border-bottom: 2px solid #e2e8f0 !important;
    color: #374151 !important;
    white-space: nowrap;
}

/* -- Fix: Remove rounded corners from sales/invoice table header (rounded-table-header class) -- */
.rounded-table-header thead,
.rounded-table-header thead th:first-child,
.rounded-table-header thead th:last-child {
    border-radius: 0 !important;
}

/* -- Row hover highlight -- */
.table tbody tr {
    transition: background-color 0.12s ease !important;
}
.table tbody tr:hover {
    background-color: #f8fafd !important;
}

/* -- Subtle row striping (only for striped tables) -- */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: #fafbfc !important;
}
.table-striped tbody tr:nth-of-type(odd):hover {
    background-color: #f0f5ff !important;
}

/* -- DataTable core -- */
table.dataTable {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* -- DataTables search box -- */
.dataTables_wrapper .dataTables_filter {
    text-align: right;
}
.dataTables_wrapper .dataTables_filter input {
    height: 32px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 13px !important;
    outline: none !important;
    background-color: #f8fafc !important;
    transition: border-color 0.2s ease !important;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #2563eb !important;
    background-color: #fff !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08) !important;
}

/* -- DataTables length dropdown -- */
.dataTables_wrapper .dataTables_length select {
    height: 32px !important;
    padding: 2px 20px 2px 8px !important;
    border-radius: 4px !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 13px !important;
    background-color: #f8fafc !important;
}

/* -- DataTables info text -- */
.dataTables_wrapper .dataTables_info {
    font-size: 12px !important;
    color: #6b7280 !important;
    padding-top: 6px !important;
}

/* -- Pagination -- */
.page-item .page-link {
    border-radius: 4px !important;
    padding: 4px 10px !important;
    margin: 0 2px !important;
    font-size: 12px !important;
    color: #374151 !important;
    border: 1px solid #e2e8f0 !important;
    background-color: #fff !important;
    transition: all 0.15s ease !important;
}
.page-item .page-link:hover {
    background-color: #eff6ff !important;
    border-color: #93c5fd !important;
    color: #2563eb !important;
}
.page-item.active .page-link {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #fff !important;
}
.page-item.disabled .page-link {
    color: #d1d5db !important;
    border-color: #f3f4f6 !important;
    background-color: #fafafa !important;
}

/* =========================================
   5. MODALS, ALERTS & BADGES
   ========================================= */
.modal-content {
    border-radius: 4px !important;
    border: none !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important;
}

.modal-header {
    padding: 1rem 1.2rem !important;
    border-radius: 4px 4px 0 0 !important;
}

.modal-body {
    padding: 1.2rem !important;
}

.modal-footer {
    padding: 1rem 1.2rem !important;
}

.alert {
    border-radius: 4px !important;
    padding: 10px 15px !important;
    margin-bottom: 15px !important;
}

.badge {
    border-radius: 3px !important; /* Sharp badges */
    padding: 4px 6px !important;
    font-weight: 500 !important;
    font-size: 11px !important;
}

/* =========================================
   6. MISC COMPONENTS
   ========================================= */
.search-box input {
    border-radius: 4px !important;
    height: 34px !important;
}

.dropdown-menu {
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

.dropdown-item {
    padding: 6px 15px !important;
    font-size: 13px !important;
}

/* =========================================
   7. FUTURISTIC DASHBOARD OVERRIDES
   ========================================= */
.futuristic-card {
    border-radius: 4px !important;
    padding: 1rem !important;
}

.stat-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.25rem !important;
    margin-bottom: 1rem !important;
    border-radius: 4px !important;
}

.stat-value {
    font-size: 1.5rem !important;
}

.futuristic-table thead th {
    padding: 0.75rem 1rem !important;
    font-size: 0.7rem !important;
}

.futuristic-table tbody td {
    padding: 0.75rem 1rem !important;
}

.package-card-wide {
    padding: 1.25rem !important;
    border-radius: 4px !important;
}

.package-icon-wrap {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.5rem !important;
    border-radius: 4px !important;
}

/* =========================================
   8. STICKY & STYLISH LAYOUT ENGINE
   ========================================= */

@media (min-width: 992px) {
    /* 1. Locked Sidebar Layout */
    .sidebar-menu {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important; /* Prevents outer overflow */
        z-index: 1050 !important;
    }

    .sidebar-menu .extra-details {
        flex-shrink: 0 !important;
        overflow: visible !important; /* Allow switch dropdown to overlay */
        z-index: 1060 !important;
    }

    .sidebar-menu .main-menu {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: calc(100vh - 130px) !important; /* Fallback height */
    }

    .sidebar-menu .menu-inner {
        overflow: visible !important;
        height: auto !important;
    }

    /* Override slimScroll if active */
    .slimScrollDiv {
        overflow: visible !important;
        height: auto !important;
    }
    
    /* Custom Scrollbar for Sidebar Menu List */
    .sidebar-menu .main-menu::-webkit-scrollbar {
        width: 5px !important;
    }
    .sidebar-menu .main-menu::-webkit-scrollbar-track {
        background: transparent !important;
    }
    .sidebar-menu .main-menu::-webkit-scrollbar-thumb {
        background-color: #e5e7eb !important;
        border-radius: 10px !important;
    }
    .sidebar-menu .main-menu::-webkit-scrollbar-thumb:hover {
        background-color: #d1d5db !important;
    }

    /* 2. Locked & Stylish Top Bar */
    .header-area {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: 240px !important; /* Width of sidebar */
        width: calc(100% - 240px) !important;
        z-index: 1040 !important;
        height: 55px !important;
        padding: 0 15px !important;
        background: rgba(255, 255, 255, 0.85) !important;
        backdrop-filter: blur(10px) !important; /* Glassmorphism */
        -webkit-backdrop-filter: blur(10px) !important;
        border-bottom: 1px solid rgba(0,0,0,0.05) !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
        display: flex !important;
        align-items: center !important;
        transition: left 0.3s ease, width 0.3s ease !important;
    }

    /* 3. Content Isolation */
    .main-content {
        margin-left: 240px !important;
        min-height: 100vh !important;
        padding-top: 75px !important; /* Prevent content from going under the fixed top bar */
        transition: margin-left 0.3s ease !important;
    }

    .main-content-inner {
        padding-top: 15px !important; 
    }

    /* 4. Handle Collapsed Sidebar State */
    .sidebar-menu {
        width: 240px !important;
        max-width: 240px !important;
        transition: margin-left 0.3s ease !important;
    }

    .sbar_collapsed .sidebar-menu {
        margin-left: -240px !important;
    }

    .sbar_collapsed .header-area {
        left: 0 !important;
        width: 100% !important;
    }

    .sbar_collapsed .main-content {
        margin-left: 0 !important;
    }

    /* 5. Desktop Navigation Button Styling & Reset */
    .nav-btn {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        background: transparent !important;
        padding: 8px !important;
        margin: 0 15px 0 0 !important;
        display: inline-flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        cursor: pointer !important;
        z-index: 1045 !important;
        height: 36px !important;
        width: 36px !important;
        border-radius: 50% !important;
        transition: background-color 0.2s ease !important;
    }

    .nav-btn:hover {
        background-color: #f3f4f6 !important;
    }

    .nav-btn span {
        background: #1f2937 !important;
        margin: 3px 0 !important;
        display: block !important;
        width: 22px !important;
        height: 2px !important;
        border-radius: 15px !important;
        transition: all 0.3s ease 0s !important;
        box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.02) !important;
    }

    .nav-btn:hover span {
        background: #2563eb !important;
    }

    .nav-btn span:first-child {
        -webkit-transform: translateY(8px) rotate(45deg) !important;
        transform: translateY(8px) rotate(45deg) !important;
    }

    .nav-btn span:last-child {
        -webkit-transform: translateY(-8px) rotate(-45deg) !important;
        transform: translateY(-8px) rotate(-45deg) !important;
    }

    .sbar_collapsed .nav-btn span {
        background: #1f2937 !important;
        -webkit-transform: none !important;
        transform: none !important;
    }

    .sbar_collapsed .nav-btn:hover span {
        background: #2563eb !important;
    }
}

/* Fix header alignment internally */
.header-area .row {
    width: 100% !important;
    margin: 0 !important;
}
.header-area .col-md-6 {
    padding: 0 !important;
}

/* =========================================
   9. TOP BAR & USER PROFILE FIXES
   ========================================= */

/* Sidebar Nested Menus Container */
.metismenu li ul {
    background: #f9fafb !important; /* Very soft light gray box for submenu grouping */
    padding: 6px 0 !important;
    margin: 4px 15px 8px 15px !important;
    border-radius: 8px !important;
    border: 1px solid #f3f4f6 !important;
    list-style: none !important;
}
.metismenu .collapse.in, .metismenu .collapse {
    background: transparent !important;
}

/* Nested Sub-Menu Links */
.metismenu li ul li a {
    color: #6b7280 !important; /* Slate Gray for nested */
    font-size: 13px !important;
    padding: 8px 15px !important;
    margin: 2px 8px !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    transition: background-color 0.2s ease, color 0.2s ease !important;
}
.metismenu li ul li a:hover {
    color: #2563eb !important; /* Vibrant blue hover text */
    background: #eff6ff !important; /* Very light blue hover background */
}

/* Active nested item (the current active page) */
.metismenu li ul li.active-nav > a,
.metismenu li ul li.active > a {
    background: #111827 !important; /* Solid black background for active sub-item! */
    color: #ffffff !important; /* White text! */
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

/* Top Bar Fixes & Anti-Jumping Rules */
.nav-btn {
    margin-top: 0 !important;
    padding: 5px !important;
}

/* Centered & Locked Top Bar Elements */
.notification-area {
    margin-top: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    position: relative !important;
    list-style: none !important;
    padding-left: 0 !important;
}

/* Prevent list items and dropdown containers from jumping when opened (disables styles.css display block override) */
.notification-area li,
.notification-area li.show,
.notification-area .dropdown,
.notification-area .dropdown.show {
    display: inline-flex !important;
    align-items: center !important;
    height: 55px !important;
    margin-left: 15px !important;
}

/* Ensure the absolute dropdown menu itself remains display: block when active */
.notification-area .dropdown-menu.show,
.user-profile .dropdown-menu.show {
    display: block !important;
}

#selectLanguage {
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 50px !important; /* Pill shape */
    height: 40px !important;
    padding: 0 15px !important;
    color: #4b5563 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
}
#selectLanguage:hover {
    background: #e5e7eb !important;
}

.notification-area > li > i.dropdown-toggle {
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 50% !important; /* Circle shape */
    height: 40px !important;
    width: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #4b5563 !important;
    font-size: 18px !important;
    cursor: pointer !important;
    position: relative !important;
    transition: all 0.2s ease !important;
}
.notification-area > li > i.dropdown-toggle:hover {
    background: #e5e7eb !important;
}
.notification-area > li > i.dropdown-toggle > span {
    position: absolute !important;
    top: -3px !important;
    right: -3px !important;
    background: #ef4444 !important; /* Red dot */
    color: white !important;
    font-size: 10px !important;
    height: 18px !important;
    width: 18px !important;
    line-height: 14px !important;
    text-align: center !important;
    border-radius: 50% !important;
    border: 2px solid #ffffff !important;
}

.notification-area .dropdown-menu {
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    margin-top: 10px !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    top: 100% !important;
    right: 0 !important; /* Align to the right edge of trigger */
    left: auto !important; /* Prevent cutoff on right edge */
    transform: none !important; /* Stop bootstrap jumping */
}

/* User Profile Button & Dropdown Fixes */
.user-profile,
.notification-area .user-profile,
.notification-area .user-profile.show {
    background: transparent !important; /* Remove blocky background */
    margin: 0 !important;
    padding: 0 !important;
    height: 55px !important; 
    display: inline-flex !important;
    align-items: center !important;
    position: relative !important;
    flex-wrap: nowrap !important; /* Prevent line wraps */
}
.user-name.dropdown-toggle {
    background: #f3f4f6 !important; /* Button background */
    border: 1px solid #e5e7eb !important;
    border-radius: 50px !important; /* Pill shape */
    height: 40px !important; 
    padding: 4px 15px 4px 4px !important; /* Tight padding to hug the avatar */
    display: inline-flex !important;
    align-items: center !important;
    cursor: pointer !important;
    color: #4b5563 !important; /* Match modern text */
    font-size: 13px !important;
    font-weight: 600 !important;
    margin-bottom: 0 !important;
    transition: all 0.2s ease !important;
}
.user-name.dropdown-toggle:hover {
    background: #e5e7eb !important;
}
.user-profile img.avatar {
    height: 30px !important;
    width: 30px !important;
    border-radius: 50% !important;
    margin-right: 8px !important;
}
.user-profile .dropdown-menu {
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    margin-top: 10px !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    min-width: 200px !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important; /* Stop bootstrap from shifting it up */
}
.user-profile .dropdown-menu a {
    padding: 8px 15px !important;
    color: #4b5563 !important;
    font-weight: 500 !important;
    border-radius: 4px !important;
    margin: 2px 5px !important;
    display: block !important;
}
.user-profile .dropdown-menu a:hover {
    background: rgba(99, 102, 241, 0.05) !important;
    color: #4f46e5 !important;
}

/* =========================================
   10. MOBILE & SMALL DEVICE OVERRIDES
   ========================================= */
@media (max-width: 991.98px) {
    /* 1. Mobile Sidebar Drawer Setup */
    .sidebar-menu {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 1050 !important;
        width: 240px !important;
        max-width: 240px !important;
        background: #ffffff !important;
        overflow-y: auto !important; /* Enable scroll on the entire sidebar */
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important; /* iOS smooth scroll */
        transition: left 0.3s ease !important;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15) !important;
        border-right: 1px solid rgba(0, 0, 0, 0.05) !important;
    }

    /* Handle Collapsed State on Mobile */
    .sbar_collapsed .sidebar-menu {
        left: -240px !important; /* Move fully off-screen */
    }

    /* Reset main menu overflow inside scrollable sidebar container */
    .sidebar-menu .main-menu {
        height: auto !important;
        overflow: visible !important;
        padding-bottom: 80px !important; /* Space at the bottom */
    }

    .sidebar-menu .menu-inner {
        overflow: visible !important;
        height: auto !important;
    }

    /* 2. Mobile Header/Top Bar Layout */
    .header-area {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 55px !important;
        z-index: 1040 !important;
        padding: 0 15px !important;
        background: #ffffff !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
        display: flex !important;
        align-items: center !important;
    }

    .header-area .row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .header-area .col-4,
    .header-area .col-8 {
        flex: 0 0 auto !important;
        max-width: none !important;
        width: auto !important;
        padding: 0 !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding-top: 70px !important; /* Spacing below the fixed top bar */
    }

    /* Hide notification area (right-side buttons) when sidebar drawer is open on mobile */
    .page-container:not(.sbar_collapsed) .notification-area {
        display: none !important;
    }

    /* Turn user profile badge into a matching clean circle on mobile */
    .user-name.dropdown-toggle {
        font-size: 0 !important; /* Hides "Store Admin" text */
        padding: 0 !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 50% !important; /* Circle badge */
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
        background: #f3f4f6 !important;
    }

    .user-name.dropdown-toggle img.avatar {
        margin-right: 0 !important; /* Center avatar */
    }

    .user-name.dropdown-toggle i {
        display: none !important; /* Hide caret arrow */
    }

    /* 3. Mobile Close Button Placement (Flush with Sidebar) */
    .nav-btn {
        position: fixed !important;
        z-index: 1060 !important;
        left: 240px !important; /* Positioned exactly next to the open sidebar */
        top: 0 !important;
        height: 55px !important; /* Matches top bar height perfectly */
        width: 55px !important;
        background: #ef4444 !important; /* Flat modern red close button */
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        border-radius: 0 0 8px 0 !important;
        box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2) !important;
        transition: left 0.3s ease !important;
    }

    .nav-btn span {
        background: #ffffff !important; /* White X lines */
        margin: 3px 0 !important;
    }

    /* Mobile Hamburger Button (Sidebar is collapsed/closed) */
    .sbar_collapsed .nav-btn {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        height: 40px !important; /* Balanced circle size */
        width: 40px !important;
        background: #f3f4f6 !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        box-shadow: none !important;
        margin-right: 0 !important;
    }

    .sbar_collapsed .nav-btn span {
        background: #4b5563 !important; /* Slate gray hamburger lines */
        margin: 3px 0 !important;
    }
}

/* =========================================
   11. PREMIUM DASHBOARD PAGE DESIGN
   ========================================= */

.dashboard-business-badge {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #4b5563 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 6px 14px !important;
    border-radius: 50px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
    display: inline-flex !important;
    align-items: center !important;
}

.dashboard-business-badge i {
    color: #2563eb !important;
}

.metric-card {
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    background: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.metric-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.05) !important;
}

.metric-title {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    color: #6b7280 !important;
}

.metric-value {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    letter-spacing: -0.03em !important;
}

.metric-subtext {
    font-size: 11px !important;
    color: #9ca3af !important;
    display: inline-flex !important;
    align-items: center !important;
}

.metric-icon-container {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 15px !important;
    flex-shrink: 0 !important;
}

.metric-icon-green {
    background-color: #dcfce7 !important;
    color: #16a34a !important;
}

.metric-icon-blue {
    background-color: #dbeafe !important;
    color: #2563eb !important;
}

.metric-icon-cyan {
    background-color: #ecfeff !important;
    color: #0891b2 !important;
}

.metric-icon-orange {
    background-color: #fef3c7 !important;
    color: #d97706 !important;
}

.metric-icon-red {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
}

.card-header-dashboard {
    background-color: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    padding: 10px 16px !important;
}

.card-header-dashboard .panel-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #111827 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
}

.dashboard-table thead th {
    background-color: #f9fafb !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    color: #4b5563 !important;
    font-weight: 600 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 10px 12px !important;
}

.dashboard-table tbody td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
    font-size: 13px !important;
    color: #374151 !important;
    padding: 10px 12px !important;
}

/* =========================================
   12. QUICK CREATE & CALCULATOR OVERRIDES
   ========================================= */

.quick-create-dropdown .dropdown-toggle {
    background: #2563eb !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    height: 32px !important;
    width: 32px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.quick-create-dropdown .dropdown-toggle:hover {
    background: #1d4ed8 !important;
    transform: scale(1.08) !important;
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3) !important;
}

.quick-create-dropdown .dropdown-toggle::after {
    display: none !important;
}

.quick-create-dropdown .dropdown-menu {
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    margin-top: 10px !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    padding: 6px 0 !important;
}

.quick-create-dropdown .dropdown-item {
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    color: #374151 !important;
    display: flex !important;
    align-items: center !important;
    transition: all 0.15s ease !important;
}

.quick-create-dropdown .dropdown-item i {
    font-size: 14px !important;
    width: 20px !important;
    margin-right: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.quick-create-dropdown .dropdown-item:hover {
    background: rgba(37, 99, 235, 0.05) !important;
    color: #2563eb !important;
}

/* Calculator Styles */
.calculator-menu {
    min-width: 260px !important;
}

.calc-display {
    border: 1px solid #e5e7eb !important;
    text-shadow: 0 1px 0 #ffffff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.calc-keys .btn {
    height: 38px !important;
    padding: 0 !important;
    font-size: 15px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #e5e7eb !important;
    background: #ffffff !important;
    color: #374151 !important;
    transition: all 0.15s ease !important;
}

.calc-keys .btn:hover {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
}

.calc-keys .btn:active {
    transform: scale(0.95) !important;
}

.calc-keys .btn-primary {
    color: #ffffff !important;
}

.calc-keys .btn-primary:hover {
    background: #1d4ed8 !important;
}

.notification-area > li > i#headerCalculatorDropdown {
    font-size: 18px !important;
}

@media (max-width: 991.98px) {
    /* 1. Header Dropdown Container Resets to viewport-relative */
    .header-area .row,
    .header-area [class*="col-"],
    .header-area .dropdown,
    .header-area .quick-create-dropdown,
    .header-area .notification-area,
    .header-area .notification-area > li,
    .header-area .notification-area > li.show,
    .header-area .user-profile,
    .header-area .user-profile.show,
    .header-area .notification-area .user-profile.show {
        position: static !important;
    }

    /* 2. Centered & Responsively Sized Header Dropdowns on Mobile/Tablet */
    .header-area .dropdown-menu,
    .header-area .notification-area .dropdown-menu,
    .header-area .user-profile .dropdown-menu {
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: calc(100vw - 20px) !important;
        max-width: 340px !important;
        min-width: 0 !important;
        top: 52px !important;
        right: auto !important;
        margin-top: 0 !important;
    }

    /* 3. Header spacing reductions to prevent icon cutoff on narrow screens */
    .header-area {
        padding: 0 10px !important;
    }

    .notification-area li,
    .notification-area li.show,
    .notification-area .dropdown,
    .notification-area .dropdown.show {
        margin-left: 8px !important;
    }

    /* 4. Turn language selector pill into matching clean circle on mobile */
    #selectLanguage {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }
    #selectLanguage span,
    #selectLanguage i.fa-angle-down {
        display: none !important;
    }
    #selectLanguage img {
        margin-right: 0 !important;
        width: 20px !important;
        height: 20px !important;
        border-radius: 50% !important;
    }
}

@media (max-width: 575.98px) {
    /* 3. Responsive Page Title/Badge Header */
    .main-content-inner .row.align-items-center.mb-4 {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .main-content-inner .row.align-items-center.mb-4 > .col,
    .main-content-inner .row.align-items-center.mb-4 > .col-auto {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    
    .dashboard-business-badge {
        margin-top: 8px !important;
        display: inline-flex !important;
    }
}

/* =========================================
   13. GLOBAL TABLE RESPONSIVENESS OVERRIDES
   ========================================= */

/* Fix: styles.css applies large negative margins to DataTables rows
   (e.g. margin-left: -1.6rem). These pull the table outside the card
   boundary, breaking overflow-x:auto clipping on mobile. Reset them. */
.dataTables_wrapper > .row:nth-child(1),
.dataTables_wrapper > .row:nth-child(2) {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

@media (max-width: 991.98px) {
    /* Fix: the table wrapper col gets padding:0 from styles.css (line 4615).
       Make it a proper scroll container on mobile. */
    .dataTables_wrapper > .row:nth-child(2) .col-sm-12 {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Also catch any other .dataTables_wrapper .col-sm-12 */
    .dataTables_wrapper .col-sm-12 {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Ensure standard tables inside card bodies can scroll horizontally */
    .card-body {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Prevent tables from expanding beyond their scroll container */
    .dataTables_wrapper table.dataTable {
        width: 100% !important;
        min-width: 500px; /* allow scroll when narrower than this */
    }
}
