.modal-backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
}

.modal-dialog {
    max-width: 600px;
    margin: 2rem auto;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal.fade .modal-dialog {
    transform: scale(0.9) translateY(-50px);
    opacity: 0;
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal Size Variations */
.modal-dialog.modal-sm {
    max-width: 400px;
}

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

.modal-dialog.modal-xl {
    max-width: 1140px;
}

.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: visible;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 3.5rem);
}

.modal-header {
    background: linear-gradient(135deg, var(--second-main-color) 0%, #dc3545 100%);
    color: #ffffff;
    padding: 1.5rem 2rem;
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    position: relative;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-title i {
    font-size: 1.75rem;
}

/* Modal Close Button Enhancement */
.modal-header .close {
    color: #ffffff;
    opacity: 0.9;
    font-size: 1.75rem;
    font-weight: 300;
    text-shadow: none;
    margin: -1rem -1rem -1rem auto;
    padding: 1rem;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
}

.modal-header .close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-header .close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* Modal Body Enhancement */
.modal-body {
    padding: 2rem;
    color: #333;
    line-height: 1.6;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

/* Custom Scrollbar for Modal Body */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--second-main-color);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #dc3545;
}

/* Modal Footer Enhancement */
.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #f8f9fa;
    border-radius: 0 0 16px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-footer > * {
    margin: 0 !important;
}

/* Button Enhancements */
.modal-footer .btn {
    padding: 0.625rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.modal-footer .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.modal-footer .btn:hover::before {
    width: 300px;
    height: 300px;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, var(--second-main-color) 0%, #dc3545 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.modal-footer .btn-secondary {
    background: #6c757d;
    color: #ffffff;
}

.modal-footer .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Special Modal Classes */
.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3rem);
}

.modal-dialog-centered .modal-content {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 3rem);
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-header {
        padding: 1.25rem 1.5rem;
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        padding: 1.25rem 1.5rem;
        flex-wrap: wrap;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1.125rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Animation Enhancements */
@keyframes modalSlideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal.show .modal-dialog {
    animation: modalSlideDown 0.3s ease-out;
}

/* Loading State */
.modal-body .loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

/* Success/Error Modal Styles */
.modal-header.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.modal-header.error {
    background: linear-gradient(135deg, var(--second-main-color) 0%, #dc3545 100%);
}

.modal-header.warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
}

.modal-header.info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}
