
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --sidebar-bg: #0c5cd3;
    --sidebar-text: #f2fcff;
    --sidebar-active: rgb(48, 48, 235);
    --sidebar-hover: rgb(23, 8, 157);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow-x: hidden;
}

/* Collapsible Sidebar Styles */
.sidebar.sidebar-collapsed {
    align-items: center !important;
}

.sidebar.sidebar-collapsed .sidebar-header {
    padding: 0.5rem;
}

.sidebar.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem 0.5rem;
}

.sidebar.sidebar-collapsed .nav-link .nav-icon {
    margin: 0;
}

.sidebar.sidebar-collapsed .nav-link:hover {
    background-color: var(--sidebar-hover);
    border-radius: 0.375rem;
}

.offcanvas {
    /* Base offcanvas matches sidebar colors. Use !important to override
       library defaults where necessary so mobile panel visually matches.
    */
    background-color: var(--sidebar-bg) !important;
    color: var(--sidebar-text) !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Ensure the inner offcanvas body also inherits the same background and text
   colors (Bootstrap sometimes applies white to .offcanvas-body). */
.offcanvas .offcanvas-body {
    background-color: transparent !important;
    color: inherit !important;
}

/* Make sure nav links inside the offcanvas inherit the sidebar link colors */
.offcanvas .nav-link {
    color: var(--sidebar-text) !important;
}
.offcanvas .nav-link:hover {
    background-color: var(--sidebar-hover) !important;
    color: var(--sidebar-text) !important;
}
.offcanvas .nav-link.active {
    background-color: var(--sidebar-active) !important;
    color: var(--sidebar-text) !important;
}

/* Improve tap target size and smooth transitions for offcanvas links */
.offcanvas .nav-link {
    padding: 0.75rem 1rem !important;
    border-radius: 0.375rem !important;
    transition: background-color 180ms ease, color 180ms ease, transform 160ms ease;
}
.offcanvas .nav-link:active {
    transform: translateY(1px);
}

/* Logo and Header Styles */
.sidebar-header {
    padding: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    color: white;
}

.sidebar-logo {
    height: 50px;
    width: auto;
    background-color: white;
    padding: 2px;
    border-radius: 50px;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.sidebar-header span {
    font-size: 1.3rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.sidebar-header small {
    display: block;
    color: white;
    text-align: start;
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    margin-top: 4px;
    /* Logo width + margin */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar-logo {
        height: 40px;
    }

    .sidebar-header span {
        font-size: 1.1rem;
    }

    .sidebar-header small {
        font-size: 0.8rem;
        padding-left: 52px;
        /* Adjusted for smaller logo */
    }
}

.nav-link {
    color: var(--sidebar-text);
    border-radius: 0.25rem;
    margin: 0.25rem 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.nav-link.active {
    background-color: var(--sidebar-active);
    color: white;
    font-weight: 500;
}

.nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* Main Content Styling */
.main-content {
    padding: 2rem;
    background-color: white;
    min-height: 100vh;
}

.table-wrapper {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
    }

    .sidebar h6 {
        font-size: 1rem;
        padding: 0.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    .nav-item {
        margin-bottom: 0.5rem;
    }
}

/* Header Styling */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e3e6f0;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

/* Welcome Section */
.welcome-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #4e73df 100%);
    color: white;
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.welcome-section h1 {
    font-weight: 700;
    margin-bottom: 1rem;
}

.welcome-section p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Manage Accounts modal tab styling */
.nav-tabs#accountTabs .nav-link {
    background-color: #f1f3f5; /* soft neutral for inactive */
    color: #273044; /* dark text for contrast */
    border: 1px solid rgba(39,48,68,0.08);
    margin-right: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
}

.nav-tabs#accountTabs .nav-link.active {
    background: linear-gradient(90deg, var(--primary-color), #4e73df);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
}

.nav-tabs#accountTabs {
    border-bottom: none;
}

/* Ensure tab content has a subtle card look */
.tab-content > .tab-pane {
    background-color: #ffffff;
    border: 1px solid rgba(39,48,68,0.06);
    padding: 1rem;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* Accessibility: focus styles */
.nav-tabs#accountTabs .nav-link:focus {
    outline: 3px solid rgba(13,110,253,0.25);
    outline-offset: 2px;
}

/* Quick stat cards for dashboard overview */
.quick-stat {
    border-radius: 0.6rem;
    overflow: hidden;
}

.quick-stat .card-body {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem;
}

.icon-wrapper {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(50,50,93,0.06);
}

.quick-stat h4 {
    font-size: 1.1rem;
    margin: 0;
}

/* Hover subtle lift */
.quick-stat:hover {
    transform: translateY(-4px);
    transition: transform 200ms ease;
    box-shadow: 0 12px 35px rgba(22, 45, 110, 0.2);
}

/* Table improvements */
.table-responsive table thead th{
    font-weight: 600;
    color: #344055;
}

.table-responsive tbody tr:hover{
    background: rgba(13,110,253,0.03);
}

/* Chart container */
.chart-card {
    min-height: 180px;
    height: 220px;
    position: relative;
}

/* Responsive tweaks for small screens */
@media (max-width: 576px) {
    .icon-wrapper { width: 48px; height: 48px; }
    .quick-stat h4 { font-size: 1rem; }
    .page-header h1 { font-size: 1.25rem; }
}

/* Subtle utility */
.text-muted.small { font-size: 0.75rem; }

/* Topbar and breadcrumb */
.topbar {
    border-bottom: 1px solid rgba(34,41,47,0.06);
    background-color: #fff;
    padding-left: 1rem;
    padding-right: 1rem;
    gap: 0.5rem;
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    min-height: 64px;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0.25rem;
}

.breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: rgba(52,64,84,0.45);
}

.topbar .form-control-sm {
    border-radius: 0.375rem;
}

/* Topbar search and user styles */
.topbar .input-group .form-control {
    border-radius: 0.375rem 0 0 0.375rem;
}
.topbar .input-group .btn {
    border-radius: 0 0.375rem 0.375rem 0;
}
.user-avatar{
    width: 38px;
    height: 38px;
    object-fit: cover;
    border: 2px solid rgba(0,0,0,0.06);
    box-shadow: 0 2px 8px rgba(22,45,110,0.06);
}

/* Breadcrumb and page title adjustments */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0.25rem;
}
.breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: rgba(52,64,84,0.45);
}

/* Mobile: ensure topbar items wrap nicely */
@media (max-width: 768px){
    .topbar { padding-left: 0.75rem; padding-right: 0.75rem; }
    .topbar .user-avatar{ width:34px; height:34px; }
}

/* Small screens: search toggle behavior (JS may show a modal or expand an input) */
.d-md-none #mobileSearchToggle{ border-radius:0.375rem; }

/* Topbar control normalization: make notification and account buttons consistent */
.topbar .controls-wrapper { display:flex; gap:0.5rem; align-items:center; }
.topbar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 40px;
    padding: 0.35rem 0.6rem;
    gap: 0.4rem;
}

/* Notification button: keep icon centered and square */
.topbar #notifBtn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 0.5rem !important; /* override rounded-circle */
}
.topbar #notifBtn .bi { font-size: 1.05rem; }

/* Accounts button: allow text on md+, keep same height */
.topbar #accountsBtn { padding-left: 0.6rem; padding-right: 0.6rem; }
.topbar #accountsBtn .bi { font-size: 1rem; }

/* accounts icon/preview sizing (JS injects image inside #accountsIcon) */
#accountsIcon img, #accountsIcon i {
    width: 28px;
    height: 28px;
    display: inline-block;
    object-fit: cover;
    border-radius: 50%;
}

/* Badge alignment tweak */
#notifBadge {
    font-size: 0.65rem;
    padding: 0.28rem 0.45rem;
    transform: translate(35%, -35%);
}

/* Ensure dropdown menus align nicely with buttons */
.topbar .dropdown-menu { min-width: 10rem; }

@media (max-width: 576px) {
    .topbar #accountsLabel { display: none !important; }
    .topbar .btn { height: 36px; min-width: 36px; padding: 0.25rem 0.45rem; }
    #accountsIcon img, #accountsIcon i { width: 24px; height: 24px; }
}

/* Notification dropdown small adjustments */
.dropdown-menu p { margin: 0; }

/* Ensure main content has comfortable padding on small screens */
@media (max-width: 768px){
    .main-content { padding: 1rem; }
}

/* Realtime notifications modal and list styles */
.notification-list .list-group-item {
    padding: 0.9rem 1rem;
    border-left: 4px solid transparent;
}
.notification-list .list-group-item:nth-child(1) { border-left-color: #0d6efd; }
.notification-list .list-group-item:nth-child(2) { border-left-color: #198754; }
.notification-list .list-group-item .fw-semibold { font-size: 0.95rem; }
.notification-list .small { font-size: 0.78rem; }

@media (max-width: 576px){
    .modal-dialog { margin: 0 0.5rem; }
    .modal-content { border-radius: 0.5rem; }
    .notification-list { max-height: 60vh; }
}

/* Unread notification emphasis */
.notification-list .unread-notification {
    background-color: rgba(13,110,253,0.04);
    border-left-color: #0d6efd !important;
    font-weight: 600;
}

/* Bell badge styling */
#notifBadge {
    font-size: 0.65rem;
    padding: 0.28rem 0.45rem;
    transform: translate(30%, -30%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.dropdown-notif-item:hover { background: rgba(13,110,253,0.03); }