/* Modern Modal/Overlay System */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    animation: slideUp 0.3s ease;
}

.modal.active {
    display: block;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--background) 0%, var(--surface) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: var(--text-primary);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    color: var(--text-primary);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--background);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Success Modal */
.modal.success .modal-header {
    background: linear-gradient(135deg, var(--success-color) 0%, #229954 100%);
    color: white;
}

.modal.success .modal-header h2 {
    color: white;
}

/* Error Modal */
.modal.error .modal-header {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c0392b 100%);
    color: white;
}

.modal.error .modal-header h2 {
    color: white;
}

/* Warning Modal */
.modal.warning .modal-header {
    background: linear-gradient(135deg, var(--warning-color) 0%, #e67e22 100%);
    color: white;
}

.modal.warning .modal-header h2 {
    color: white;
}

/* Info Modal */
.modal.info .modal-header {
    background: linear-gradient(135deg, var(--accent-color) 0%, #2980b9 100%);
    color: white;
}

.modal.info .modal-header h2 {
    color: white;
}

/* Responsive modal sizing */
@media (min-width: 768px) {
    .modal {
        min-width: 500px;
    }
}

@media (min-width: 1200px) {
    .modal {
        min-width: 600px;
    }
}
