/* edit-form.css - Optimiertes kompaktes Styling für Bearbeitungsformular */

/* ========================================
   Fehlermarkierungen
   ======================================== */
.form-input.error,
.form-textarea.error {
    border: 2px solid #dc3545 !important;
    background-color: #ffe6e6 !important;
    animation: shake 0.3s ease;
}

.form-input.error:focus,
.form-textarea.error:focus {
    border-color: #c82333 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2) !important;
}

.tab-button.has-errors {
    position: relative;
}

.tab-button.has-errors::after {
    content: '!';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* ========================================
   Bearbeitungs-Button im Modal-Header
   ======================================== */
.btn-edit-toggle {
    padding: 0.4rem 0.8rem;
    background-color: #c52643;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-edit-toggle:hover {
    background-color: #a01f36;
    box-shadow: 0 1px 4px rgba(197, 38, 67, 0.3);
}

.btn-edit-toggle i {
    font-size: 0.9rem;
}

/* Löschen-Button im Modal-Header */
.btn-delete {
    padding: 0.4rem 0.8rem;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-delete:hover {
    background-color: #b71c1c;
    box-shadow: 0 1px 4px rgba(211, 47, 47, 0.3);
}

.btn-delete i {
    font-size: 0.9rem;
}

/* ========================================
   Info Section - Kompakt
   ======================================== */
.info-section {
    background: white;
    padding: 0.5rem;
    border-radius: 3px;
    margin-bottom: 0.75rem;
    border: 1px solid #e0e0e0;
}

.info-section .section-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e0e0e0;
}

.info-section .section-header h3 {
    font-size: 0.95rem;
    margin: 0;
    color: #333;
    font-weight: 600;
}

.info-section .section-header h3 i {
    font-size: 0.9rem;
    color: #666;
    margin-right: 0.3rem;
}

/* ========================================
   Bearbeitungs-Tabelle - Kompakt
   ======================================== */
.edit-table-container {
    width: 100%;
    overflow-x: auto;
    margin: 0.3rem 0;
}

.edit-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #ddd;
    font-size: 0.8rem;
}

.edit-table thead {
    background: #f5f5f5;
}

.edit-table thead th {
    padding: 0.3rem 0.4rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #ddd;
    font-size: 0.8rem;
    line-height: 1.2;
}

.edit-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.edit-table tbody tr:hover {
    background-color: #fafafa;
}

.edit-table tbody tr:last-child {
    border-bottom: none;
}

.edit-table tbody td {
    padding: 0.3rem 0.4rem;
    vertical-align: middle;
    line-height: 1.2;
}

.edit-label {
    font-weight: 500;
    color: #444;
    font-size: 0.8rem;
}

.edit-value {
    width: 100%;
}

/* Procedure name styling */
.procedure-name {
    background: #f0f0f0 !important;
    font-weight: 600;
    padding: 0.3rem 0.4rem !important;
    text-align: left;
    color: #333;
    font-size: 0.8rem;
}

/* Spezial-Styling für Verfahrenstabellen - Kompakt */
.procedure-edit-table {
    font-size: 0.75rem;
}

.procedure-edit-table thead th {
    font-size: 0.75rem;
    padding: 0.3rem 0.4rem;
}

.procedure-edit-table tbody td {
    padding: 0.25rem 0.35rem;
}

.procedure-edit-table tbody td:first-child {
    min-width: 140px;
}

/* ========================================
   Formular-Elemente - Kompakt
   ======================================== */
.form-input {
    width: 100%;
    padding: 0.3rem 0.4rem;
    border: 1px solid #ccc;
    border-radius: 2px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    font-family: inherit;
    background-color: white;
    line-height: 1.2;
}

.form-input:focus {
    outline: none;
    border-color: #666;
    box-shadow: 0 0 0 1px rgba(102, 102, 102, 0.2);
}

.form-input:hover {
    border-color: #999;
}

.form-input[type="date"] {
    min-width: 110px;
}

.form-input[readonly] {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
    border-color: #ddd;
}

.form-textarea {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ccc;
    border-radius: 2px;
    font-size: 0.8rem;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
    transition: all 0.2s ease;
    background-color: white;
    line-height: 1.3;
}

.form-textarea:focus {
    outline: none;
    border-color: #666;
    box-shadow: 0 0 0 1px rgba(102, 102, 102, 0.2);
}

.form-textarea:hover {
    border-color: #999;
}

/* Interne Hinweise: nutzt die volle verfügbare Modal-Höhe,
   damit nicht in einem winzigen Textfeld gescrollt werden muss. */
.form-textarea.notes-fullheight {
    /* Modal ist max 90vh hoch — abzüglich Header/Tab-Nav/Section-Header/Save-Buttons */
    height: calc(90vh - 260px);
    min-height: 350px;
    max-height: 1500px;
    font-size: 0.9rem;
    line-height: 1.45;
    padding: 0.6rem;
}

.info-section-notes {
    /* Section-Container nicht künstlich begrenzen */
    margin-bottom: 0.5rem;
}

/* Checkbox-Styling */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.8rem;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #333;
}

/* ========================================
   Info-Items in Grid-Layout - Kompakt
   ======================================== */
.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.info-item label.edit-label {
    font-weight: 600;
    color: #444;
    font-size: 0.8rem;
}

/* ========================================
   Formular-Aktionen (Speichern/Abbrechen) - Kompakt
   ======================================== */
.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #ddd;
    position: sticky;
    bottom: 0;
    background: white;
    padding-bottom: 0.5rem;
    z-index: 10;
}

.btn-save {
    padding: 0.5rem 1rem;
    background-color: #c52643;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-save:hover {
    background-color: #a01f36;
    box-shadow: 0 2px 6px rgba(197, 38, 67, 0.3);
}

.btn-cancel {
    padding: 0.5rem 1rem;
    background-color: #999;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-cancel:hover {
    background-color: #666;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ========================================
   Area-Section spezifisches Styling - Kompakt
   ======================================== */
.area-section-content {
    padding: 0.5rem;
}

.total-area {
    background: #f5f5f5;
    padding: 0.5rem;
    border-radius: 3px;
    margin-bottom: 0.5rem;
    border-left: 3px solid #333;
}

.total-area h4 {
    margin: 0;
    color: #333;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.area-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.area-label {
    font-weight: 600;
    color: #444;
    font-size: 0.8rem;
}

/* ========================================
   Responsive Design - Optimiert
   ======================================== */
@media (max-width: 1200px) {
    .procedure-edit-table {
        font-size: 0.7rem;
    }

    .procedure-edit-table .form-input {
        font-size: 0.75rem;
        padding: 0.25rem 0.35rem;
    }

    .edit-table thead th {
        padding: 0.25rem 0.35rem;
        font-size: 0.75rem;
    }

    .edit-table tbody td {
        padding: 0.25rem 0.35rem;
    }
}

@media (max-width: 768px) {
    .info-section {
        padding: 0.4rem;
        margin-bottom: 0.5rem;
    }

    .info-section .section-header h3 {
        font-size: 0.85rem;
    }

    .form-actions {
        gap: 0.4rem;
    }

    .btn-save,
    .btn-cancel {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .btn-edit-toggle {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    /* Kompaktere Tabellen */
    .edit-table {
        font-size: 0.75rem;
    }

    .edit-table thead th {
        padding: 0.25rem 0.3rem;
        font-size: 0.7rem;
    }

    .edit-table tbody td {
        padding: 0.25rem 0.3rem;
    }

    .form-input {
        padding: 0.25rem 0.35rem;
        font-size: 0.75rem;
    }

    .form-textarea {
        padding: 0.3rem;
        font-size: 0.75rem;
        min-height: 40px;
    }
}

/* ========================================
   Accessibility
   ======================================== */
.form-input:focus-visible,
.form-textarea:focus-visible {
    outline: 2px solid #333;
    outline-offset: 1px;
}

/* Loading Spinner im Formular */
.form-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: #333;
    font-size: 0.95rem;
}

.form-loading i {
    animation: spin 1s linear infinite;
    margin-right: 0.4rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   Notification Modal - Kompakt
   ======================================== */
.notification-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

.notification-content {
    background: white;
    border-radius: 4px;
    padding: 1.5rem;
    max-width: 350px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: notificationFadeIn 0.3s ease;
    text-align: center;
}

@keyframes notificationFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.notification-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.notification-icon.success {
    color: #333;
}

.notification-icon.error {
    color: #dc3545;
}

.notification-icon.info {
    color: #666;
}

.notification-message {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.notification-close {
    padding: 0.5rem 1.5rem;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background-color: #000;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
