/* Professional Modal System - Mobile Friendly */

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

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

/* Modal Container */
.modal-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Modal Body */
.modal-body {
    padding: 20px 24px;
    color: #4b5563;
    line-height: 1.6;
}

.modal-body p {
    margin: 0 0 16px 0;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid #e5e7eb;
}

/* Modal Buttons */
.modal-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    min-width: 80px;
    justify-content: center;
}

.modal-btn-primary {
    background: #3b82f6;
    color: white;
}

.modal-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.modal-btn-success {
    background: #10b981;
    color: white;
}

.modal-btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.modal-btn-danger {
    background: #ef4444;
    color: white;
}

.modal-btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.modal-btn-warning {
    background: #f59e0b;
    color: white;
}

.modal-btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.modal-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.modal-btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Modal Types */
.modal-success .modal-title {
    color: #059669;
}

.modal-warning .modal-title {
    color: #d97706;
}

.modal-danger .modal-title {
    color: #dc2626;
}

.modal-info .modal-title {
    color: #2563eb;
}

/* Modal Icons */
.modal-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Loading State */
.modal-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.modal-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .modal-overlay {
        padding: 16px;
        align-items: flex-end;
    }
    
    .modal-container {
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        width: 100%;
        transform: translateY(100%);
    }
    
    .modal-overlay.active .modal-container {
        transform: translateY(0);
    }
    
    .modal-header {
        padding: 20px 20px 12px;
    }
    
    .modal-body {
        padding: 16px 20px;
    }
    
    .modal-footer {
        padding: 12px 20px 20px;
        flex-direction: column-reverse;
    }
    
    .modal-btn {
        width: 100%;
        justify-content: center;
    }
    
    .modal-title {
        font-size: 1.125rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .modal-container {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .modal-header {
        border-bottom-color: #374151;
    }
    
    .modal-footer {
        border-top-color: #374151;
    }
    
    .modal-title {
        color: #f9fafb;
    }
    
    .modal-body {
        color: #d1d5db;
    }
    
    .modal-close {
        color: #9ca3af;
    }
    
    .modal-close:hover {
        background: #374151;
        color: #f3f4f6;
    }
    
    .modal-btn-secondary {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .modal-btn-secondary:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
}
