/* Modal Fix CSS - Enhanced */
.modal {
    z-index: 9999 !important;
}

.modal-backdrop {
    z-index: 9998 !important;
}

/* Enhanced close button styling */
.btn-close {
    background: none !important;
    border: none !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    margin: -0.5rem -0.5rem -0.5rem auto !important;
    color: #6c757d !important;
    transition: all 0.3s ease !important;
}

.btn-close:hover {
    opacity: 0.8 !important;
    color: #dc3545 !important;
    transform: scale(1.1) !important;
}

/* Text-based close button styling */
.modal-close-text {
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    color: #6c757d !important;
    padding: 0.5rem 1rem !important;
    border-radius: 6px !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.modal-close-text:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
    color: #495057 !important;
    text-decoration: none !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.modal-close-text:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

/* Fix modal close button positioning */
.modal-header .btn-close {
    padding: 0.5rem !important;
    margin: -0.5rem -0.5rem -0.5rem auto !important;
}

/* Text close button in modal header - removed since we only use footer buttons */
.modal-header .modal-close-text {
    display: none !important;
}

/* Ensure modal can be closed */
.modal.show {
    display: flex !important;
}

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out !important;
}

/* Modal backdrop click to close */
.modal-backdrop {
    cursor: pointer !important;
}

/* Enhanced modal styling */
.modal-content {
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
}

.modal-header {
    border-bottom: 1px solid #dee2e6 !important;
    border-radius: 12px 12px 0 0 !important;
    background: #f8f9fa !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

.modal-header.bg-danger {
    background: #dc3545 !important;
    color: #ffffff !important;
}

.modal-footer {
    border-top: 1px solid #dee2e6 !important;
    border-radius: 0 0 12px 12px !important;
    background: #f8f9fa !important;
}

/* Close button in danger modals */
.modal-header.bg-danger .btn-close,
.modal-header.bg-danger .modal-close-text {
    color: #ffffff !important;
}

.modal-header.bg-danger .modal-close-text:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Responsive modal close buttons */
@media (max-width: 576px) {
    .modal-close-text {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.85rem !important;
    }
    
    .btn-close {
        font-size: 1.25rem !important;
        padding: 0.4rem !important;
    }
}
