
/* ===== MODAL BACKDROP & DIALOG ===== */

.modal-background {
    background-color: rgba(var(--main-color), 0.5) !important; 
}

.modal-content {
    border-radius: var(--radius-medium) !important;
}

/* ===== MODAL HEADER ===== */

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.5rem;
}

.modal-title {
    font-family: var(--heading-text);
    text-transform: uppercase;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
}

/* ===== MODAL BODY ===== */

.modal-body {
    padding: 1.5rem;
}

/* Modal-Image für Galerie-Modals */
.modal-image {
    max-height: 80vh;
}

/* ===== MODAL FOOTER ===== */

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1.5rem;
}

/* ===== GALERIE UND MODAL TRIGGER ===== */

.gallery-item {
    height: 300px;
    border-radius: var(--radius-medium);
    cursor: pointer;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.row.g-4 {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
}

/* ===== MODAL FORMULARE ===== */

/* Status-Nachrichten standardmäßig versteckt - aber JavaScript kann sie anzeigen */
[id$="-status"].d-none {
    display: none;
}

/* ===== HÖCHSTE PRIORITÄT FÜR MODAL-INPUT REGELN ===== */
/* Überschreibt Bootstrap's form-control Regeln durch höhere Spezifität */

/* Modal-Formular-Felder */
.form-control.modal-input {
    transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease !important;
    background-color: white !important;
    border-width: 1px !important; /* Dickere Umrandung für bessere Sichtbarkeit */
    color: #333 !important;
}

/* Initiale rote Umrandung für Pflichtfelder */
.form-control.modal-input[required] {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.1rem rgba(220, 53, 69, 0.25);
    background-color: white;
}

/* WICHTIG: Grünes Häkchen bei is-valid ENTFERNEN - MUSS SPEZIFISCHER SEIN */
.form-control.modal-input[required].is-valid,
.form-control.modal-input.is-valid {
    background-image: none !important; /* Entfernt das grüne Häkchen */
    border-color: #28a745 !important;
    background-color: rgba(40, 167, 69, 0.05) !important;
    box-shadow: 0 0 0 0.1rem rgba(40, 167, 69, 0.25) !important;
}

/* Entferne auch das rote X bei is-invalid falls vorhanden - MUSS SPEZIFISCHER SEIN */
.form-control.modal-input[required].is-invalid,
.form-control.modal-input.is-invalid {
    background-image: none !important;
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.1) !important;
    box-shadow: 0 0 0 0.1rem rgba(220, 53, 69, 0.25) !important;
}

/* Browser-Autofill deaktivieren/überschreiben */
.form-control.modal-input:-webkit-autofill,
.form-control.modal-input:-webkit-autofill:hover,
.form-control.modal-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px white inset !important;
    -webkit-text-fill-color: #333 !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

.form-control.modal-input:-moz-autofill {
    background-color: white !important;
}

.form-control.modal-input:autofill {
    background-color: white !important;
}

/* HÖCHSTE PRIORITÄT: Überschreibt Bootstrap's form-control:focus */
.form-control.modal-input:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15) !important;
    background-color: white !important;
}

.form-control.modal-input.field-empty {
    border-color: #ced4da !important;
    background-color: white !important;
}

.form-control.modal-input.field-valid {
    border-color: #198754 !important;
    background-color: #f0fff0 !important; /* Ganz helles Grün für validierte Felder - stärkere Priorität */
    box-shadow: 0 0 0 0.1rem rgba(25, 135, 84, 0.25) !important; /* Grüner Schatten für validierte Felder */
}

/* Grüner Hintergrund auch bei Browser-Autofill für validierte Felder */
.form-control.modal-input.field-valid:-webkit-autofill,
.form-control.modal-input.field-valid:-webkit-autofill:hover,
.form-control.modal-input.field-valid:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #f0fff0 inset !important;
    -webkit-text-fill-color: #333 !important;
    border-color: #198754 !important;
}

.form-control.modal-input.field-valid:-moz-autofill {
    background-color: #f0fff0 !important;
}

.form-control.modal-input.field-valid:autofill {
    background-color: #f0fff0 !important;
}

.form-control.modal-input.field-invalid {
    border-color: #dc3545 !important;
    background-color: white !important;
    box-shadow: 0 0 0 0.1rem rgba(220, 53, 69, 0.25) !important; /* Roter Schatten für ungültige Felder */
}

/* Placeholder-Text für bessere Lesbarkeit */
.form-control.modal-input::placeholder {
    color: #6c757d !important;
    opacity: 1 !important;
}

/* Submit-Button-Styling für alle Modal-Formulare */
[id$="-submit-btn"] {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 150px;
}

[id$="-submit-btn"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Validierungs-Feedback */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

/* Rotes Sternchen für erforderliche Felder */
.text-danger {
    font-size: 1em;
    font-weight: bold;
    color: #dc3545 !important;
}

/* Form-Text und Labels */
.form-text,
.form-check-label {
    font-size: 1rem !important;
}

/* ===== EINHEITLICHE LABEL-STYLES ===== */

/* Verstärkte Labels für bessere Sichtbarkeit */
.form-label.text-bold {
    font-family: var(--text-bold) !important;
    font-size: 1.1rem !important;
    color: #2c3e50 !important;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

/* ===== ALLE FORMULAR-INPUTS VERWENDEN MODAL-INPUT ===== */

/* Alle Formular-Templates verwenden einheitlich modal-input CSS-Klassen 
   Das eliminiert Redundanzen und sorgt für konsistente Darstellung */

/* Checkbox-Styling */
.form-check {
    padding-left: calc(var(--bs-gutter-x) * 0.5);
}

.form-check .form-check-input {
    margin-left: 0;
}

/* ===== RESPONSIVE MODAL-GRÖSSEN ===== */

@media (max-width: 768px) {
    .gallery-item {
        flex-basis: 100% !important;
    }
}

@media (max-width: 576px) {
    .modal-dialog,
    [id*="Modal"] .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* ===== MODAL-ANIMATION ===== */

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.modal.show .modal-dialog {
    transform: none;
}