.modal {
    display: none; /* Modal ist standardmäßig versteckt */
    position: fixed;
    z-index: 1; /* über dem restlichen Inhalt angezeigt */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparenter Hintergrund */
    animation: fadeIn 0.3s ease-out; /* Fade-In-Effekt */
}

.modal-content-wrapper {
    display: flex;
    justify-content: center; 
    align-items: center; 
    width: 100%;
    height: 100%;
}

/* Modal Inhalt */
.modal-content,
.error-modal-content {
    /* Position und Größe */
    display: inline-block; 
    margin: 10% auto;
    padding: 30px;
    width: auto;
    max-width: 40rem;
    min-width: 150px;
    box-sizing: border-box;
    height: auto;
    max-height: 80vh; 
    overflow-y: auto; 
    overflow-x: hidden;

    /* Erscheinungsbild und Animationen */
    background-color: var(--modal-primary-color);
    border: 1px solid var(--modal-primary-color-contrast);
    color: var(--modal-primary-color-contrast);
    border-radius: 15px; 
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); 
    animation: slideUp 0.5s ease-out; 
    position: relative; 
}

.error-modal-content {
    background-color: var(--error-modal-background);
    border: 4px solid var(--error-modal-border-color);
}

/* Hintergrunddimmer */
.modal:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: -1;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Schließen-Button */
.close {
    color: var(--modal-primary-color-medium);
    font-size: 30px;
    font-weight: bold;
    /* Absolute Position innerhalb modal-content */
    position: absolute; 
    top: 10px;
    right: 20px;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease; 
    z-index: 10; 
}
.close:hover,
.close:focus {
    color: var(--alert-color); 
    transform: scale(1.2); 
}

/* Modal-Text */
.modal-content h1,
.error-modal-content h1 {
    font-size: 1.5rem;
    text-align: left;
    margin-top: 1em;
}
.modal-content h1 {
    color: var(--primary-color);
}
.error-modal-content h1 {
    color: var(--error-modal-headline-color);
}
.modal-content p {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--modal-primary-color-contrast);
    text-align: left;
}


/* Buttons */

.modal-buttons {
    display: flex;
    justify-content: space-evenly;
    margin-top: 1.2em;
    gap: 1.5em;
}
.modal-buttons button {
    min-width: 150px;
    width: 50%;
}
.modal button {
    padding: 0.8em 1.4em;
    /* margin: 10px; */
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: var(--primary-color); 
    color: var(--primary-color-contrast);
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    line-height: 1; 
    box-sizing: border-box;
}

.modal button:hover {
    background-color: var(--primary-color-highlight);
    color: var(--primary-color-highlight-contrast);
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--primary-color-glow);
}
.modal button:active {
    transform: scale(0.98);
}
.modal button:disabled {
    background-color: #aaa; 
    color: #666; 
    cursor: not-allowed; 
    transform: none; 
    box-shadow: none; 
}

/* rot/grün leuchtende buttons */
.modal .confirmbutton:hover{
    background-color: var(--confirm-color-highlight);
    box-shadow: 0 0 20px var(--confirm-color-glow);
}
.modal .abortbutton:hover{
    background-color: var(--alert-color-highlight);
    box-shadow: 0 0 20px var(--alert-color-glow);
}




@media (max-width: 1024px) {
    .modal-content,
    .error-modal-content { 
        width: 90%;
    }   
    .modal-buttons button {
        min-width: 100px;
    }
}

