/* Custom Modal Styles */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.custom-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.custom-modal-overlay.show .custom-modal {
    transform: scale(1) translateY(0);
}

.custom-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    position: relative;
}

.custom-modal-icon.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.custom-modal-icon.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

.custom-modal-icon.warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

.custom-modal-icon.info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
}

/* Bootstrap Icons in modal */
.custom-modal-icon i {
    font-size: 24px;
}

.custom-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.custom-modal-body {
    padding: 16px 24px 24px;
}

.custom-modal-message {
    color: #6c757d;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
}

.custom-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.custom-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.custom-modal-btn.primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.custom-modal-btn.primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
}

.custom-modal-btn.secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.custom-modal-btn.secondary:hover {
    background: #e9ecef;
    color: #495057;
}

.custom-modal-btn.success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.custom-modal-btn.success:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%);
    transform: translateY(-1px);
}

.custom-modal-btn.danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.custom-modal-btn.danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-1px);
}

/* Animation for icons */
.custom-modal-icon i {
    animation: modalIconPop 0.5s ease 0.3s both;
}

@keyframes modalIconPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    80% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Loading state */
.custom-modal-loading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-modal-spinner {
    width: 20px;
    height: 20px;
    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); }
}

/* Button Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading .button-text {
    opacity: 0.7;
}

.button-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Loading states for different button types */
.btn.loading,
.custom-modal-btn.loading,
button.loading {
    cursor: not-allowed;
    opacity: 0.8;
}

.btn.loading .button-spinner,
.custom-modal-btn.loading .button-spinner,
button.loading .button-spinner {
    border-top-color: currentColor;
}

/* Specific styles for Bootstrap buttons */
.btn-primary.loading .button-spinner {
    border-top-color: white;
}

.btn-secondary.loading .button-spinner {
    border-top-color: #6c757d;
}

.btn-success.loading .button-spinner {
    border-top-color: white;
}

.btn-danger.loading .button-spinner {
    border-top-color: white;
}

.btn-warning.loading .button-spinner {
    border-top-color: #212529;
}

.btn-info.loading .button-spinner {
    border-top-color: white;
}

.btn-light.loading .button-spinner {
    border-top-color: #212529;
}

.btn-dark.loading .button-spinner {
    border-top-color: white;
}

/* Responsive design */
@media (max-width: 480px) {
    .custom-modal {
        width: 95%;
        margin: 20px;
    }
    
    .custom-modal-header {
        padding: 20px 20px 12px;
    }
    
    .custom-modal-body {
        padding: 12px 20px 20px;
    }
    
    .custom-modal-footer {
        padding: 12px 20px 20px;
        flex-direction: column;
    }
    
    .custom-modal-btn {
        width: 100%;
    }
}
