.boxes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-column-gap: 15px;
    grid-row-gap: 15px;
    width: 100%;
    margin: auto;
    padding: 0 10px;
}

/* Desktop size (1441px and above) */
@media (min-width: 1441px) {
    .boxes {
        grid-template-columns: repeat(4, 1fr);
        grid-column-gap: 20px;
        grid-row-gap: 20px;
    }
    
    .box-card {
        height: 130px;
    }
    
    .box-card .icon-div img {
        width: 85px;
        top: 18px;
    }
    
    .box-card .details-div .active {
        font-size: 32px;
    }
    
    .box-card .details-div span {
        font-size: 16px;
    }
}

/* Laptop size (1024px - 1440px) */
@media (min-width: 1024px) and (max-width: 1440px) {
    .boxes {
        grid-template-columns: repeat(3, 1fr);
        grid-column-gap: 15px;
        grid-row-gap: 15px;
    }
    
    .box-card {
        height: 120px;
    }
    
    .box-card .icon-div img {
        width: 70px;
        top: 15px;
    }
    
    .box-card .details-div .active {
        font-size: 26px;
    }
    
    .box-card .details-div span {
        font-size: 13px;
    }
}

/* Tablet size */
@media (min-width: 768px) and (max-width: 1023px) {
    .boxes {
        grid-template-columns: repeat(2, 1fr);
        grid-column-gap: 15px;
        grid-row-gap: 15px;
    }
    
    .box-card {
        height: 110px;
    }
}

.boxes .div_link {
    text-decoration: none;
    list-style: none;
    color: #000;
    position: relative;
    display: block;
    height: 100%;
}

.box-card {
    box-sizing: border-box;
    width: 100%;
    height: 115px;
    border-radius: 10px;
    display: flex;
    border: 2px #5F53A4 solid;
    overflow: hidden;
    box-shadow: 3px 3px 7px #0009;
    margin: auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.box-card:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 12px #000c;
}

.box-card .icon-div {
    position: relative;
    width: 35%;
    background-color: #887ad9;
}

.box-card .icon-div img {
    width: 62px;
    top: 23px;
    position: absolute;
    left: 12px;
}

.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.box-card .details-div {
    width: 70%;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
}

.box-card .details-div span {
    font-size: 14px;
    text-align: center;
    margin-top: 5px;
    color: #333;
}

.box-card .details-div .active {
    font-size: 28px;
    color: #5F53A4;
    font-weight: bold;
    position: relative;
}

.active_inactive {
    display: flex;
    gap: 10px;
}

h3.active::after {
    content: "";
    position: absolute;
    top: -8px;
    right: -8px;
    width: 7px;
    height: 7px;
    background-color: green;
    border-radius: 50%;
}

.box-card .details-div .inactive {
    position: relative;
}

h3.inactive::after {
    content: "";
    position: absolute;
    top: -8px;
    right: -8px;
    width: 7px;
    height: 7px;
    background-color: #dd1515;
    border-radius: 50%;
}

.flex-center-row {
    display: flex;
    justify-content: center;
    flex-direction: row;
    gap: 35px;
    align-items: flex-start;
}

.flex-item {
    width: 50%;
}

.flex-item1 {
    width: 70%;
}

.flex-item1 .title {
    margin-bottom: 35px;
    text-align: left;
}

.flex-item2 {
    width: 30%;
}

/* Small tablets and large phones */
@media (min-width: 600px) and (max-width: 767px) {
    .boxes {
        grid-template-columns: repeat(2, 1fr);
        grid-column-gap: 10px;
        grid-row-gap: 10px;
    }
    
    .box-card {
        height: 105px;
    }
    
    .box-card .icon-div img {
        width: 65px;
        top: 18px;
    }
}

@media (max-width: 599px) {
    .boxes {
        grid-template-columns: 1fr;
        grid-column-gap: 10px;
        grid-row-gap: 10px;
    }
    
    .box-card {
        height: 95px;
    }
    
    .box-card .icon-div img {
        width: 60px;
        top: 22px;
        position: absolute;
        left: 20px;
    }
    
    .box-card .details-div .active {
        font-size: 24px;
    }
    
    .box-card .details-div span {
        font-size: 12px;
    }
    
    .active_inactive {
        padding-top: 8px;
    }
    
    .flex-center-row {
        flex-direction: column;
    }
    .flex-item {
        width: 100%;
    }
    .flex-item1 {
        width: 100%;
    }
    .flex-item2 {
        width: 100%;
    }
}

/* Service Provider Dashboard: force 3 cards per row on desktop */
@media (min-width: 1024px) {
    .sp-dashboard-boxes {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .sp-dashboard-boxes .box-card .icon-div img {
        width: 70px;
        right: 40px;
        top: 14px;
        left: auto;
        right: 25px;
    }
}

/* Chart Cards Styling */
.card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-title {
    color: #5F53A4;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 18px;
}

/* Chart Container Constraints */
.card-body {
    position: relative;
    overflow: visible;
}

/* Chart.js container wrapper */
.chart-container {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 300px !important;
    height: 300px !important;
    margin: 10px auto;
    overflow: visible;
    display: block;
}

.chart-container > div {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    position: relative;
    display: block;
    overflow: visible;
}

.chart-container canvas {
    max-width: 85% !important;
    max-height: 280px !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 10px auto !important;
    position: relative !important;
}

/* Ensure all chart elements are visible */
.chart-container * {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure chart wrapper divs respect container - only target chart containers */
.chart-container > div,
.chart-container > div > div {
    max-width: 100% !important;
    overflow: hidden;
}


/* Ensure header-sidebar is not affected by modal rules */
.header-sidebar,
.header-backdrop {
    max-width: none !important;
    overflow: visible !important;
    z-index: 1100 !important;
}

/* Fix modal backdrop issues - prevent freezing */
.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1040 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: #000 !important;
}

.modal-backdrop.fade {
    opacity: 0 !important;
}

.modal-backdrop.show {
    opacity: 0.5 !important;
}

/* Ensure body doesn't get stuck with modal-open class */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* Ensure modal dialogs can size properly */
.modal-dialog {
    width: auto !important;
    max-width: 500px !important;
}

.modal-dialog.modal-lg {
    max-width: 800px !important;
}

.modal-dialog.modal-xl {
    max-width: 1140px !important;
}
/* .card-body .table-responsive {
    overflow-x: auto !important;
    max-width: 100% !important;
} */

/* Responsive chart sizing */
@media (max-width: 768px) {
    .chart-container {
        min-height: 250px !important;
        height: auto !important;
    }
    
    .chart-container canvas {
        max-width: 100% !important;
        max-height: 250px !important;
        width: auto !important;
        height: auto !important;
    }
}

/* Chart Container Responsive */
@media (max-width: 768px) {
    .col-md-6 {
        margin-bottom: 20px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .card-title {
        font-size: 16px;
        margin-bottom: 15px;
    }
}

/* Income Page Stat Cards */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.stat-card.income {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-card.expense {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

.stat-card.net {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.9;
    background: rgba(255,255,255,0.2);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 500;
    margin: 0;
}

.stat-value {
    font-size: 2.8rem;
    font-weight: 700;
    margin: 0.5rem 0 0 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .stat-card {
        padding: 1.5rem;
    }
    
    .stat-icon {
        font-size: 2.5rem;
        width: 60px;
        height: 60px;
    }
    
    .stat-value {
        font-size: 2.2rem;
    }
}

/* Enhanced Notifications Dropdown */
.main-notification-list {
    min-width: 420px;
    max-width: 450px;
    max-height: 500px;
    overflow-y: auto;
    padding: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.notification-header {
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.notification-header h6 {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
}

.notification-empty {
    padding: 3rem 2rem;
    text-align: center;
    color: #6c757d;
}

.notification-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    border-bottom: none;
    border-top: 1px solid #f0f0f0;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    position: relative;
    width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.notification-item:first-child {
    border-top: none;
    margin-top: 0;
}

.notification-item:hover {
    background-color: #f8f9fa;
    transform: translateX(-2px);
}

.notification-item.unread {
    background-color: #f0f4ff;
    border-left: 3px solid #667eea;
    width: 100%;
}

.notification-item:last-child {
    margin-bottom: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.notification-message-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.notification-message-wrapper i {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1;
    display: inline-block;
}

.notification-message {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
    line-height: 1.4;
    word-wrap: break-word;
    flex: 1;
    margin: 0;
}

.notification-time {
    font-size: 0.75rem;
    color: #6c757d;
    margin-right: 1.75rem;
}

.notification-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Scrollbar styling for notifications */
.main-notification-list::-webkit-scrollbar {
    width: 6px;
}

.main-notification-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.main-notification-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.main-notification-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

@media (max-width: 576px) {
    .main-notification-list {
        min-width: 300px;
        max-width: 100%;
    }
}

/* Modern Profile Tabs */
.modern-profile-tabs {
    gap: 10px;
    padding: 0;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 0;
}

.modern-profile-tabs .nav-item {
    margin-bottom: -2px;
}

.modern-profile-tabs .nav-link {
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-profile-tabs .nav-link:hover {
    color: var(--bs-primary);
    background-color: rgba(95, 83, 164, 0.05);
    border-bottom-color: rgba(95, 83, 164, 0.3);
}

.modern-profile-tabs .nav-link.active {
    color: var(--bs-primary);
    background-color: rgba(95, 83, 164, 0.08);
    border-bottom-color: var(--bs-primary);
    font-weight: 600;
}

.modern-profile-tabs .nav-link i {
    font-size: 18px;
}

@media (max-width: 576px) {
    .modern-profile-tabs {
        flex-direction: column;
        gap: 5px;
        border-bottom: none;
    }
    
    .modern-profile-tabs .nav-link {
        border-radius: 8px;
        border-bottom: none;
        border-left: 3px solid transparent;
        padding: 10px 16px;
        text-align: right;
        justify-content: flex-end;
    }
    
    html[dir="ltr"] .modern-profile-tabs .nav-link {
        border-left: none;
        border-right: 3px solid transparent;
        text-align: left;
        justify-content: flex-start;
    }
    
    .modern-profile-tabs .nav-link.active {
        border-left-color: var(--bs-primary);
        border-bottom: none;
    }
    
    html[dir="ltr"] .modern-profile-tabs .nav-link.active {
        border-right-color: var(--bs-primary);
        border-left: none;
    }
    
    .modern-profile-tabs .nav-link:hover {
        border-bottom-color: transparent;
        border-left-color: rgba(95, 83, 164, 0.3);
    }
    
    html[dir="ltr"] .modern-profile-tabs .nav-link:hover {
        border-right-color: rgba(95, 83, 164, 0.3);
        border-left: none;
    }
    
    .modern-profile-tabs .nav-item {
        margin-bottom: 0;
    }
}