.stats-grid-wrapper {
    margin-bottom: 2.5rem; // Space between cards and main content
    
    @media (max-width: 767.98px) {
        margin-bottom: 1.5rem;
    }
}

.main-content-area {
    margin-top: 1.5rem; // Additional space above main content
    
    @media (max-width: 767.98px) {
        margin-top: 1rem;
    }
}

.card {
    position: relative;
    background: var(--bs-card-bg, #ffffff);
    border: none !important;
    border-radius: $border-radius-xl !important;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    
    // Subtle gradient border on hover
    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, 
            var(--bs-primary) 0%, 
            var(--bs-info) 50%, 
            var(--bs-primary) 100%);
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: 1;
    }
    
    &:hover {
        transform: translateY(-4px);
        box-shadow: $shadow-xl !important;
        
        &::before {
            opacity: 1;
        }
    }
    
    // Card Header Enhancement
    .card-header {
        background: transparent;
        border-bottom: 1px solid rgba(var(--bs-gray-300-rgb), 0.3);
        padding: 1.25rem 1.5rem;
        
        h5, h6 {
            font-weight: 700;
            margin-bottom: 0;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            
            i {
                font-size: 1.1em;
                background: linear-gradient(135deg, var(--bs-primary), var(--bs-info));
                -webkit-background-clip: text;
                background-clip: text;
                color: transparent;
            }
        }
        
        // Decorative element
        &::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 1.5rem;
            width: 40px;
            height: 3px;
            background: linear-gradient(90deg, var(--bs-primary), transparent);
            border-radius: $border-radius-pill;
        }
    }
    
    // Card Body Enhancement
    .card-body {
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        
        .stat-number {
            font-size: 2.5rem;
            font-weight: 800;
            line-height: 1.2;
            background: linear-gradient(135deg, var(--bs-dark), var(--bs-gray-700));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            margin-bottom: 0.25rem;
        }
        
        .stat-label {
            font-size: 0.875rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 600;
            color: var(--bs-gray-600);
            margin-bottom: 0;
        }
    }
    
    // Icon Circle Enhancement
    .icon-circle {
        width: 48px;
        height: 48px;
        border-radius: $border-radius-lg;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-shrink: 0;
        
        i {
            font-size: 1.5rem;
            transition: transform 0.2s ease;
        }
        
        &:hover i {
            transform: scale(1.1);
        }
        
        &.bg-white-10 {
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(5px);
            
            i {
                color: white;
                filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
            }
            
            &:hover {
                background: rgba(255, 255, 255, 0.25);
                animation: pulse 0.5s ease;
            }
        }
        
        @each $color in (primary, success, info, warning, danger) {
            &.bg-#{$color} {
                background: linear-gradient(135deg, 
                    rgba(var(--bs-#{$color}-rgb), 0.15), 
                    rgba(var(--bs-#{$color}-rgb), 0.05));
                border: 1px solid rgba(var(--bs-#{$color}-rgb), 0.2);
                
                i {
                    color: var(--bs-#{$color});
                    filter: drop-shadow(0 2px 4px rgba(var(--bs-#{$color}-rgb), 0.2));
                }
                
                &:hover {
                    animation: pulse 0.5s ease;
                }
            }
        }
    }
    
    // Stats Card Specific Enhancement
    &.stat-card {
        position: relative;
        overflow: hidden;
        
        &::after {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, 
                rgba(255,255,255,0.1) 0%, 
                transparent 70%);
            opacity: 0;
            transition: opacity 0.5s ease;
            pointer-events: none;
        }
        
        &:hover::after {
            opacity: 1;
        }
        
        .card-body {
            position: relative;
            z-index: 1;
        }
        
        &.bg-primary {
            background: linear-gradient(135deg, 
                var(--bs-primary) 0%, 
                var(--bs-primary-dark, #3a7bd5) 100%);
        }
        
        &.bg-success {
            background: linear-gradient(135deg, 
                var(--bs-success) 0%, 
                var(--bs-success-dark, #2e8b57) 100%);
        }
        
        &.bg-warning {
            background: linear-gradient(135deg, 
                var(--bs-warning) 0%, 
                var(--bs-warning-dark, #f39c12) 100%);
        }
        
        &.bg-info {
            background: linear-gradient(135deg, 
                var(--bs-info) 0%, 
                var(--bs-info-dark, #0dcaf0) 100%);
        }
        
        h4 {
            font-size: 2rem;
            font-weight: 800;
            color: white;
            text-shadow: 0 2px 4px rgba(0,0,0,0.1);
            margin-bottom: 0.25rem;
        }
        
        h6 {
            color: rgba(255,255,255,0.9);
            font-weight: 600;
            letter-spacing: 0.5px;
            margin-bottom: 0;
        }
        
        .badge {
            font-size: 0.7rem;
            padding: 0.25rem 0.5rem;
            font-weight: 500;
        }
    }
}

// Form Actions Styling
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    
    @media (max-width: 767.98px) {
        flex-direction: column;
        
        > div {
            width: 100%;
            display: flex;
            justify-content: center;
            gap: 0.5rem;
            
            &:first-child {
                flex-wrap: wrap;
            }
        }
    }
    
    .btn {
        min-width: 120px;
        
        @media (max-width: 767.98px) {
            flex: 1;
            min-width: auto;
        }
    }
}

// Summary Preview Styling
.summary-preview {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: $border-radius-lg;
    padding: 1.25rem;
    transition: all 0.3s ease;
    
    &:hover {
        box-shadow: $box-shadow;
        transform: translateY(-2px);
    }
    
    p {
        margin-bottom: 0.5rem;
        
        strong {
            color: #495057;
            min-width: 100px;
            display: inline-block;
        }
        
        span {
            color: #212529;
            font-weight: 500;
        }
    }
}

// Quick Amount Buttons
.quick-amount-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
    }
}

// Quick Notes
.quick-notes {
    margin-top: 0.5rem;
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
        transition: all 0.2s ease;
        
        &:hover {
            transform: translateY(-1px);
            background-color: var(--bs-primary);
            border-color: var(--bs-primary);
            color: white;
        }
    }
}

// Animations
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

// Responsive Breakpoints
@media (max-width: 1199.98px) {
    .card.stat-card {
        h4 {
            font-size: 1.75rem;
        }
        
        .icon-circle {
            width: 40px;
            height: 40px;
            
            i {
                font-size: 1.25rem;
            }
        }
    }
}

@media (max-width: 767.98px) {
    .stats-grid-wrapper {
        margin-bottom: 1.5rem;
    }
    
    .main-content-area {
        margin-top: 1rem;
    }
    
    .card.stat-card {
        .card-body {
            padding: 1rem;
        }
        
        h4 {
            font-size: 1.5rem;
        }
        
        h6 {
            font-size: 0.75rem;
        }
        
        small {
            font-size: 0.7rem;
        }
        
        .icon-circle {
            width: 36px;
            height: 36px;
            
            i {
                font-size: 1rem;
            }
        }
    }
    
    .summary-preview {
        padding: 1rem;
        
        .row > div {
            margin-bottom: 1rem;
            
            &:last-child {
                margin-bottom: 0;
            }
        }
    }
}

// Dark mode support
@media (prefers-color-scheme: dark) {
    .card {
        background: var(--bs-dark-card, #1e1e2a);
        
        .card-header {
            border-bottom-color: rgba(255, 255, 255, 0.05);
        }
        
        .stat-number {
            background: linear-gradient(135deg, #fff, #a0a0a0);
        }
    }
    
    .summary-preview {
        background: linear-gradient(135deg, #2d2d3a, #1e1e2a);
        border-color: rgba(255, 255, 255, 0.05);
        
        p strong {
            color: #adb5bd;
        }
        
        p span {
            color: #f8f9fa;
        }
    }
    
    .form-actions {
        border-top-color: rgba(255, 255, 255, 0.05);
    }
}