@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4e73df;
    --primary-light: rgba(78, 115, 223, 0.1);
    --secondary: #858796;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --bg-color: #f8f9fc;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --text-main: #5a5c69;
    --text-muted: #b7b9cc;
    --border-color: #e3e6f0;
    --sidebar-width: 250px;
    --shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    margin: 0;
}

/* Sidebar Styling - Matching Image */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar-brand {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    margin-right: 12px;
}

.brand-text {
    font-weight: 800;
    font-size: 1.2rem;
    color: #3a3b45;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-weight: 500;
    border-radius: 0.5rem;
    text-decoration: none;
    margin-bottom: 0.125rem;
    transition: all 0.2s;
}

.nav-link i {
    width: 20px;
    margin-right: 1rem;
    font-size: 1.1rem;
    text-align: center;
}

.nav-link:hover {
    background: var(--bg-color);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* Sidebar Dropdown - Sub-menu */
.nav-item-dropdown {
    position: relative;
    margin-bottom: 0.125rem;
}

.nav-item-dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-weight: 500;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item-dropdown .dropdown-toggle i:first-child {
    width: 20px;
    margin-right: 1rem;
    font-size: 1.1rem;
    text-align: center;
}

.nav-item-dropdown .dropdown-toggle .arrow {
    font-size: 0.75rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
}

/* Fix double arrow issue (hide Bootstrap's default) */
.nav-item-dropdown .dropdown-toggle::after {
    display: none !important;
}

.nav-item-dropdown.dropdown-open .dropdown-toggle {
    background: var(--bg-color);
    color: var(--primary);
}

.nav-item-dropdown.dropdown-open .dropdown-toggle .arrow {
    transform: rotate(180deg);
}

.nav-item-dropdown .sub-menu {
    display: none;
    padding: 0.25rem 0 0.5rem 0;
    list-style: none;
    margin: 0 0 0 2rem;
    border-left: 1px solid var(--border-color);
}

.nav-item-dropdown.dropdown-open .sub-menu {
    display: block;
}

.sub-menu-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    color: var(--text-main) !important;
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 500;
    border-radius: 0 0.5rem 0.5rem 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sub-menu-link i {
    font-size: 0.85rem;
    width: 18px;
    margin-right: 0.75rem;
    opacity: 0.7;
    transition: all 0.2s;
}

.sub-menu-link:hover {
    color: var(--primary) !important;
    background: var(--primary-light);
}

.sub-menu-link:hover i {
    opacity: 1;
    transform: scale(1.1);
}

.sub-menu-link.active {
    color: var(--primary) !important;
    background: var(--primary-light);
    font-weight: 600;
}

.sub-menu-link.active::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

/* User Section at Bottom of Sidebar */
.sidebar-user {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: #fdfdfe;
}

.user-box {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.user-box img {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    margin-right: 10px;
}

.logout-link {
    color: var(--danger);
    font-size: 0.85rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 0;
    min-height: 100vh;
}

/* Top Bar - Matching Image */
.top-bar {
    height: 70px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
}

.search-container {
    width: 400px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    background: #f1f3f7;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
}

.search-inner-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
}

.top-bar-right {
    display: flex;
    align-items: center;
}

.top-icon {
    margin-right: 1.5rem;
    color: var(--text-muted);
    position: relative;
    cursor: pointer;
}

.top-icon .badge {
    position: absolute;
    top: -5px;
    right: -10px;
    padding: 2px 5px;
    border-radius: 50px;
}

.top-user-info {
    display: flex;
    align-items: center;
    border-left: 1px solid var(--border-color);
    padding-left: 1.5rem;
}

.top-user-info.dropdown-toggle::after {
    display: none !important;
}

/* Page Styling */
.container-fluid {
    padding: 2rem;
}

/* Cards / Widgets */
.card-widget {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    height: 100%;
}

.card-widget hr {
    border-top-color: var(--border-color) !important;
    opacity: 1;
}

/* --- Document Management Utilities --- */
.border-dashed {
    border: 2px dashed #dee2e6 !important;
}

.hover-shadow:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-2px);
}

.transition {
    transition: all 0.3s ease;
}
.card-widget .nav-link i{
    margin-right: 0.2rem;
}
.bg-primary-soft { background-color: rgba(78, 115, 223, 0.08) !important; }
.bg-success-soft { background-color: rgba(28, 200, 138, 0.08) !important; }
.bg-info-soft { background-color: rgba(54, 185, 204, 0.08) !important; }
.bg-danger-soft { background-color: rgba(231, 74, 59, 0.08) !important; }
.bg-warning-soft { background-color: rgba(246, 194, 62, 0.08) !important; }
.bg-secondary-soft { background-color: rgba(133, 135, 150, 0.08) !important; }
.bg-white-soft { background-color: rgba(255, 255, 255, 0.4) !important; }

.nav-tabs-modern .nav-link{
    border-radius: 0;
}
/* --- Minimalist & Scrollable Tabs --- */
.nav-tabs-modern {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    padding: 0 5px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.nav-tabs-modern::-webkit-scrollbar {
    display: none;
}

.nav-tabs-modern .nav-item {
    margin-bottom: -1px;
}

.nav-tabs-modern .nav-link {
    border: none;
    color: var(--text-muted);
    padding: 10px 15px;
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: all 0.2s ease-in-out;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0.6;
    background: transparent !important;
}

.nav-tabs-modern .nav-link i {
    font-size: 1rem;
    line-height: 1;
}

.nav-tabs-modern .nav-link:hover {
    color: var(--text-main);
    opacity: 0.9;
}

.nav-tabs-modern .nav-link.active {
    color: var(--primary) !important;
    border-bottom: 2px solid var(--primary) !important;
    opacity: 1;
}

.nav-tabs-modern .nav-link.active i {
    color: var(--primary);
}

.nav-scroller {
    position: relative;
    z-index: 2;
    margin-bottom: -1px;
}

.bg-light-soft {
    background-color: #f8f9fc !important;
}

.widget-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #3a3b45;
}

.stat-trend {
    font-size: 0.8rem;
    font-weight: 600;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(78, 115, 223, 0.3);
}

/* Modern Modals */
.modal-content {
    background-color: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header .btn-close {
    background-color: var(--primary-light);
    padding: 0.5rem;
    border-radius: 50%;
    font-size: 0.65rem;
    opacity: 0.6;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: none;
}

.modal-header .btn-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.75rem 1.5rem;
    color: var(--text-main);
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.02);
    gap: 10px;
}

/* Modern Form Elements */
.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    opacity: 0.8;
}

.form-control, .form-select {
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    background-color: var(--card-bg);
    color: var(--text-main);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    background-color: var(--card-bg);
    color: var(--text-main);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.input-icon-group {
    position: relative;
}

.input-icon-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.input-icon-group .form-control {
    padding-left: 2.75rem;
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Ultra-Compact Currency Ticker */
.currency-widget {
    background: transparent;
    gap: 1.25rem;
    padding-right: 1.25rem;
    border-right: 1px solid rgba(0,0,0,0.05);
}

.currency-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
}

.curr-header {
    display: flex;
    align-items: center;
    gap: 4px;
}

.curr-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.curr-change {
    font-size: 0.65rem;
    font-weight: 700;
}

.curr-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.01em;
}

.curr-change.up { color: #10b981; }
.curr-change.down { color: #ef4444; }
.curr-change.stable { color: #94a3b8; }

.dark-mode-toggle {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-right: 1.5rem;
}

.dark-mode-toggle:hover {
    color: var(--primary);
}

/* Print Optimization */
@media print {
    @page {
        margin: 0.5cm;
    }
    
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 9pt !important;
    }

    .sidebar, .top-bar, .dt-buttons, .dataTables_filter, .dataTables_length, 
    .dataTables_info, .dataTables_paginate, .dark-mode-toggle, .mobile-toggle {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .container-fluid {
        padding: 0 !important;
    }

    .card-widget {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    table.dataTable {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 0 !important;
    }

    table.dataTable thead th {
        background: #f8f9fc !important;
        color: #000 !important;
        border: 1px solid #dee2e6 !important;
        padding: 4px 8px !important;
        font-size: 8pt !important;
        text-transform: uppercase;
    }

    table.dataTable tbody td {
        padding: 3px 8px !important;
        font-size: 8pt !important;
        border: 1px solid #dee2e6 !important;
        white-space: normal !important; /* Allow wrapping in print if needed */
    }

    .badge {
        border: 1px solid #ccc !important;
        background: transparent !important;
        color: #000 !important;
        padding: 1px 4px !important;
        font-size: 7pt !important;
    }
    
    /* Action columns usually not needed in print, but leaving for now if user wants IDs */
}

/* Responsive Styling */
@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 280px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
        z-index: 2000;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .top-bar {
        padding: 0 1rem;
    }

    .search-container {
        width: 100%;
        max-width: 250px;
    }

    .container-fluid {
        padding: 1rem;
    }

    .currency-widget {
        gap: 0.75rem;
        padding-right: 0.75rem;
        margin-right: 0.75rem !important;
    }

    .curr-label {
        font-size: 0.6rem;
    }

    .curr-val {
        font-size: 0.75rem;
    }
}

@media (max-width: 767.98px) {
    .currency-widget {
        display: none !important;
    }

    .top-user-info {
        padding-left: 0.75rem;
    }

    .top-icon {
        margin-right: 0.75rem;
    }

    .dark-mode-toggle {
        margin-right: 0.75rem;
    }

    .search-container {
        display: none !important;
    }
}

@media (max-width: 575.98px) {
    .top-icon:not(:last-type) {
        display: none !important;
    }
    
    .top-user-info {
        padding-left: 0.5rem;
        border-left: none;
    }
    
    .top-bar {
        padding: 0 0.5rem;
    }
    
    .top-user-info .me-3 {
        display: none !important;
    }
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    display: none;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.show {
    display: block;
}

.mobile-toggle {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-main);
}

/* Dashboard Specific Responsive */
@media (max-width: 575.98px) {
    .stat-value {
        font-size: 1.25rem;
    }
    
    .card-widget {
        padding: 1rem;
    }

    /* Fix pie chart placeholder on small screens */
    .col-lg-5 .row.align-items-center > .col-6 {
        width: 100%;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .col-lg-5 .row.align-items-center > .col-6 div[style*="width: 150px"] {
        margin: 0 auto;
        width: 120px !important;
        height: 120px !important;
    }
}

/* DataTables Responsive Fix */
.table-responsive {
    border: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.dataTable {
    width: 100% !important;
    white-space: nowrap; /* Keep content on one line for better scrolling experience */
}

div.dataTables_wrapper div.dataTables_length select {
    width: auto;
    display: inline-block;
}

@media (max-width: 767.98px) {
    div.dataTables_wrapper div.dataTables_length, 
    div.dataTables_wrapper div.dataTables_filter, 
    div.dataTables_wrapper div.dataTables_info, 
    div.dataTables_wrapper div.dataTables_paginate {
        text-align: center !important;
    }
    
    .dt-buttons {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        margin-bottom: 1rem;
    }
}

/* Modern Select2 Styling */
.select2-container--default .select2-selection--single {
    background-color: var(--input-bg, #fff);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 48px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-main);
    padding-left: 15px;
    line-height: 48px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px;
    right: 10px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #a0aec0 transparent transparent transparent;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(78, 115, 223, 0.1);
}

/* Dropdown styling */
.select2-dropdown {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1070; /* Higher than modal backdrop */
}

.select2-search--dropdown .select2-search__field {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    padding: 8px 12px;
}

.select2-results__option {
    padding: 10px 15px;
    color: var(--text-main);
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--primary);
    color: #fff;
}

.select2-container--default .select2-results__option--selected {
    background-color: rgba(78, 115, 223, 0.1);
    color: var(--primary);
}

/* Custom File Input Styling */
.form-control[type="file"] {
    padding: 9px 12px;
}
.form-control[type="file"]::file-selector-button {
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    margin-right: 15px;
    cursor: pointer;
    transition: 0.2s;
}
/* Modern Image Upload (Dropzone Style) */
.image-upload-container {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    background-color: var(--input-bg, #f8f9fc);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
}

.image-upload-container:hover {
    border-color: var(--primary);
    background-color: rgba(78, 115, 223, 0.05);
}

.image-upload-container i {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: block;
    transition: 0.3s;
}

.image-upload-container:hover i {
    color: var(--primary);
    transform: translateY(-5px);
}

.image-upload-container .upload-text {
    font-weight: 600;
    color: var(--text-main);
    display: block;
    margin-bottom: 0.25rem;
}

.image-upload-container .upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.image-upload-container input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.image-preview-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 5;
    display: none;
}

.image-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-upload-container .preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
    z-index: 6;
}

.image-upload-container:hover .preview-overlay {
    opacity: 1;
}



.select2-container--default .select2-selection--single .select2-selection__clear{
    margin-right: 0!important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered{
    padding-left: 2px;
}