/**
 * Custom CSS Fixes
 * General fixes and improvements for the application
 */

/* Fix for modal z-index issues */
.modal {
    z-index: 1050;
}

.modal-backdrop {
    z-index: 1040;
}

/* Fix for select2 dropdown in modals */
.select2-container {
    z-index: 1060;
}

.select2-dropdown {
    z-index: 1061;
}

/* Fix for datepicker in modals */
.datepicker {
    z-index: 1060;
}

/* Fix for summernote editor in modals */
.note-editor {
    z-index: 1050;
}

.note-popover {
    z-index: 1060;
}

/* Fix for floating elements */
.floating-element {
    position: fixed;
    z-index: 1030;
}

/* Fix for sticky headers */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Fix for table responsiveness */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 100%;
}

/* Fix for form validation states */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Fix for button loading states */
.btn.loading {
    position: relative;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fix for card shadows */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Fix for alert positioning */
.alert-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1070;
    min-width: 300px;
    max-width: 500px;
}

/* Fix for breadcrumb styling */
.breadcrumb {
    background-color: transparent;
    padding: 0.75rem 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: #6c757d;
}

/* Fix for pagination */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border-radius: 0.25rem;
    margin: 0 2px;
}

.page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
}

/* Fix for form groups spacing */
.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* Fix for input group styling */
.input-group-text {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.input-group .form-control:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .form-control:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Fix for navbar toggler */
.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Fix for dropdown menus */
.dropdown-menu {
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #f8f9fa;
}

/* Fix for progress bars */
.progress {
    height: 1rem;
    background-color: #e9ecef;
    border-radius: 0.25rem;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* Fix for badges */
.badge {
    font-size: 0.75em;
    font-weight: 700;
}

/* Fix for list groups */
.list-group-item {
    border-color: rgba(0, 0, 0, 0.125);
}

.list-group-item:hover {
    background-color: #f8f9fa;
}

/* Fix for tooltips */
.tooltip {
    z-index: 1070;
}

/* Fix for popovers */
.popover {
    z-index: 1060;
}

/* Fix for carousel controls */
.carousel-control-prev,
.carousel-control-next {
    width: 5%;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 20px;
    height: 20px;
}

/* Fix for accordion */
.accordion .card {
    border-radius: 0;
}

.accordion .card:first-child {
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
}

.accordion .card:last-child {
    border-bottom-left-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

/* Fix for tabs */
.nav-tabs .nav-link {
    border: 1px solid transparent;
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
}

.nav-tabs .nav-link.active {
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
}

/* Fix for pills */
.nav-pills .nav-link {
    border-radius: 0.25rem;
}

.nav-pills .nav-link.active {
    background-color: #007bff;
}

/* Fix for jumbotron */
.jumbotron {
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    background-color: #e9ecef;
    border-radius: 0.3rem;
}

/* Fix for media objects */
.media {
    display: flex;
    align-items: flex-start;
}

.media-object {
    flex-shrink: 0;
}

.media-body {
    flex: 1;
}

/* Fix for close button */
.close {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.5;
}

.close:hover {
    opacity: 0.75;
}

/* Fix for spinners */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

.spinner-grow {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    background-color: currentColor;
    border-radius: 50%;
    opacity: 0;
    animation: spinner-grow 0.75s linear infinite;
}

@keyframes spinner-grow {
    0% {
        transform: scale(0);
    }
    50% {
        opacity: 1;
    }
}

/* Fix for stretched links */
.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    pointer-events: auto;
    content: "";
    background-color: rgba(0, 0, 0, 0);
}

/* Fix for text truncation */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Fix for responsive images */
.img-responsive {
    max-width: 100%;
    height: auto;
}

/* Fix for clearfix */
.clearfix::after {
    display: block;
    clear: both;
    content: "";
}

/* Fix for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Fix for focus states */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Fix for disabled states */
.disabled,
[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Fix for print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
}

/* Fix for dark mode compatibility */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background-color: #343a40;
        color: #fff;
    }
    
    .auto-dark .card {
        background-color: #495057;
        border-color: #6c757d;
    }
    
    .auto-dark .form-control {
        background-color: #495057;
        border-color: #6c757d;
        color: #fff;
    }
}

/* Fix for high contrast mode */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }
    
    .form-control {
        border-width: 2px;
    }
    
    .card {
        border-width: 2px;
    }
}

/* Fix for reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}/* Enh
anced Budget Template Styles */
.budget-template-section {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.template-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #007bff;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.template-info h5 {
    color: #007bff;
    margin-bottom: 10px;
}

.budget-item-total {
    font-weight: 600;
    color: #28a745;
}

.btn-edit-budget-item {
    padding: 2px 6px;
    font-size: 12px;
}

.btn-save-budget-draft, .btn-review-application {
    min-width: 150px;
    padding: 10px 20px;
}

/* Form validation styles */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Attachment row styling */
.attachment-row {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.attachment-row:hover {
    background-color: #e9ecef;
}

/* Budget summary card */
.card.bg-light {
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Enhanced SasaPay phone input validation */
.sasapay-phone-input.is-valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 1.44 1.44L7.4 4.5l.94.94-3.63 3.63L2.3 6.73z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.sasapay-phone-input.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.4.4.4-.4M6 5v2.5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Responsive table improvements */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-edit-budget-item {
        padding: 1px 4px;
        font-size: 10px;
    }
    
    .template-info {
        padding: 10px;
    }
    
    .budget-template-section {
        padding: 15px;
    }
    
    .budget-template-section .table-sm th,
    .budget-template-section .table-sm td {
        padding: 0.3rem;
        font-size: 0.8rem;
    }
}

/* Loading states for forms */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error message animations */
.alert-animated {
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Project status badges */
.badge-pending {
    background-color: #ffc107;
    color: #212529;
}

.badge-approved {
    background-color: #28a745;
    color: white;
}

.badge-rejected {
    background-color: #dc3545;
    color: white;
}

.badge-draft {
    background-color: #6c757d;
    color: white;
}/
* Multi-step form progress indicator */
.progress-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.progress-step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin: 0 10px;
    position: relative;
    transition: all 0.3s ease;
}

.progress-step.active {
    background-color: #007bff;
    color: white;
}

.progress-step.completed {
    background-color: #28a745;
    color: white;
}

.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    width: 20px;
    height: 2px;
    background-color: #e9ecef;
    transform: translateY(-50%);
}

.progress-step.completed:not(:last-child)::after {
    background-color: #28a745;
}

/* Step containers */
.step-container {
    min-height: 400px;
}

/* Application summary styling */
.application-summary {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.summary-section {
    padding: 15px 0;
    border-bottom: 1px solid #dee2e6;
}

.summary-section:last-child {
    border-bottom: none;
}

.summary-section h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 10px;
}

/* Budget template styling */
.budget-template-section {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background-color: #fff;
}

.template-info {
    background-color: #e3f2fd;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #2196f3;
}

.template-total-budget {
    font-size: 1.2em;
    font-weight: bold;
    color: #28a745;
}

/* Form enhancements */
.form-group label {
    font-weight: 500;
    color: #495057;
}

.alert {
    border-radius: 8px;
}

.alert h6 {
    margin-bottom: 8px;
    font-weight: 600;
}

/* Button styling */
.btn-next-step, .btn-prev-step {
    min-width: 120px;
}

.btn-save-budget {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-save-budget:hover {
    background-color: #138496;
    border-color: #117a8b;
    color: white;
}

/* Responsive design */
@media (max-width: 768px) {
    .progress-indicator {
        flex-wrap: wrap;
    }
    
    .progress-step {
        margin: 5px;
    }
    
    .progress-step:not(:last-child)::after {
        display: none;
    }
    
    .btn-next-step, .btn-prev-step {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced table styling for budget templates */
.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
}

.controlled-td-th-width {
    width: 120px;
}

.small-controlled-td-th-width {
    width: 50px;
}

.controlled-width {
    width: 100px;
}

/* Modal enhancements */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    color: #495057;
    font-weight: 600;
}

/* Success/Error message styling */
.text-success {
    color: #28a745 !important;
    font-weight: 500;
}

.text-danger {
    color: #dc3545 !important;
    font-weight: 500;
}

#create-user-business-project-budget-response {
    padding: 10px;
    margin: 15px 0;
    border-radius: 6px;
    font-size: 14px;
}

#create-user-business-project-budget-response.text-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

#create-user-business-project-budget-response.text-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}/* Loa
n Agreement and Terms & Conditions Styling */
.agreement-content, .terms-content {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #007bff;
}

.modal-body .agreement-content, .modal-body .terms-content {
    background-color: #fff;
    border: 1px solid #dee2e6;
}

/* Radio button styling for agreement type selection */
.radio-inline {
    margin-right: 20px;
    font-weight: 500;
}

.radio-inline input[type="radio"] {
    margin-right: 8px;
}

.radio-inline i {
    margin-right: 5px;
    color: #6c757d;
}

/* File upload styling */
input[type="file"] {
    padding: 8px;
    border: 2px dashed #dee2e6;
    border-radius: 5px;
    background-color: #f8f9fa;
}

input[type="file"]:hover {
    border-color: #007bff;
    background-color: #e3f2fd;
}

/* Download button styling */
.btn-outline-primary {
    border-width: 2px;
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,123,255,0.2);
}

/* Success message styling for accepted terms */
.alert-success {
    border-left: 4px solid #28a745;
}

/* Form check styling improvements */
.form-check {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.form-check:hover {
    background-color: #e9ecef;
}

.form-check-input:checked ~ .form-check-label {
    color: #28a745;
    font-weight: 600;
}

/* Modal improvements */
.modal-lg {
    max-width: 900px;
}

.modal-header {
    background-color: #007bff;
    color: white;
}

.modal-header .close {
    color: white;
    opacity: 0.8;
}

.modal-header .close:hover {
    opacity: 1;
}

/* Budget template form improvements */
#loan_agreement_file_section, #terms_conditions_file_section {
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    background-color: #f8f9fa;
}

#loan_agreement_text_section, #terms_conditions_text_section {
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .radio-inline {
        display: block;
        margin-bottom: 10px;
        margin-right: 0;
    }
    
    .modal-dialog {
        margin: 10px;
    }
    
    .btn-group .btn {
        margin-bottom: 5px;
    }
}/* Form 
validation improvements */
.form-control:invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control:valid {
    border-color: #28a745;
}

/* Hidden field validation fix */
.yes-outstanding-loan {
    transition: all 0.3s ease;
}

.yes-outstanding-loan.show {
    display: block !important;
}

/* Submit button improvements */
.btn-create-user-business-project-budget {
    position: relative;
    min-width: 200px;
}

.btn-create-user-business-project-budget:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-create-user-business-project-budget .fa-spinner {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

/* Step validation feedback */
.step-validation-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}

.step-validation-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}

/* Form progress improvements */
.progress-step.error {
    background-color: #dc3545;
    color: white;
}

.progress-step.warning {
    background-color: #ffc107;
    color: #212529;
}

/* Better button spacing */
.btn-group .btn {
    margin-right: 10px;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* Loading state improvements */
.form-loading {
    pointer-events: none;
    opacity: 0.7;
}

.form-loading .btn {
    cursor: not-allowed;
}

/* Outstanding loan field animation */
.yes-outstanding-loan {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

.yes-outstanding-loan.show {
    max-height: 200px;
    padding: 15px 0;
}

/* Better error message styling */
.help-block.with-errors {
    font-size: 12px;
    margin-top: 5px;
}

.help-block.with-errors.text-danger {
    color: #dc3545 !important;
    font-weight: 500;
}

/* Form section improvements */
.step-container {
    padding: 20px 0;
}

.step-container .alert {
    margin-bottom: 20px;
}

/* Button icon spacing */
.btn i {
    margin-right: 5px;
}

.btn i:last-child {
    margin-right: 0;
    margin-left: 5px;
}