/**
 * Egységes Modal/Popup rendszer
 * Használat: Modal.alert(), Modal.confirm(), Modal.prompt(), Modal.custom()
 */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    animation: modalFadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
    z-index: 9999;
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.modal-icon.success {
    color: #10b981;
}

.modal-icon.error {
    color: #ef4444;
}

.modal-icon.warning {
    color: #f59e0b;
}

.modal-icon.info {
    color: #3b82f6;
}

.modal-icon.question {
    color: #8b5cf6;
}

.modal-body {
    padding: 24px;
    color: #374151;
    font-size: 15px;
    line-height: 1.6;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-top: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.modal-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.modal-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-btn-primary {
    background-color: #2563eb;
    color: white;
}

.modal-btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.modal-btn-success {
    background-color: #10b981;
    color: white;
}

.modal-btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.modal-btn-danger {
    background-color: #ef4444;
    color: white;
}

.modal-btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.modal-btn-warning {
    background-color: #f59e0b;
    color: white;
}

.modal-btn-warning:hover:not(:disabled) {
    background-color: #d97706;
}

.modal-btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.modal-btn-secondary:hover:not(:disabled) {
    background-color: #e5e7eb;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes modalSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

.modal-container.closing {
    animation: modalSlideOut 0.2s ease-in forwards;
}

/* Responsive */
@media (max-width: 600px) {
    .modal-container {
        margin: 0;
        border-radius: 12px 12px 0 0;
        max-height: 95vh;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-btn {
        width: 100%;
    }

    .modal-header h3 {
        font-size: 18px;
    }
}

/* SVG ikonok */
.modal-icon svg {
    width: 100%;
    height: 100%;
}
