/* modals.css - Kompaktes schlichtes Design in Weiß, Schwarz und Grau */

/* Modal Base */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 4px;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: modalFadeIn 0.3s ease;
    border: 1px solid #ddd;
}

/* Dokumenten-Modal speziell schmaler */
#documentsModal .modal-content {
    max-width: 800px;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    background: #333;
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 4px 4px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    order: 1;
}

.close {
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    order: 3;
}

.close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 0.75rem;
}

.modal-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #ddd;
    background: #f5f5f5;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.btn-close {
    padding: 0.5rem 1.5rem;
    background: #666;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

.btn-close:hover {
    background: #555;
}

/* Login Modal */
.login-modal-content {
    max-width: 400px;
    width: 90%;
}

.login-modal-content .modal-body {
    padding: 1.5rem;
}

.login-modal-content .form-group {
    margin-bottom: 1.2rem;
}

.login-modal-content .form-buttons {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.6rem;
    justify-content: center;
}

.login-modal-content input {
    width: 100%;
}

.login-modal-content .remember-me {
    margin-bottom: 0.5rem;
}

.login-modal-content .remember-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    color: var(--text-color);
}

.login-modal-content .remember-label input[type="checkbox"] {
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.login-modal-content .remember-label input[type="checkbox"]:focus,
.login-modal-content .remember-label input[type="checkbox"]:focus-visible {
    outline: none;
    border: none;
    box-shadow: none;
}

.pw-field {
    position: relative;
    display: flex;
    align-items: center;
}

.pw-field input {
    width: 100%;
    padding-right: 2.5rem;
}

.pw-toggle {
    position: absolute;
    right: 0.6rem;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.3rem;
}

.pw-toggle:hover {
    color: #333;
}

/* Map Modal */
.map-modal-content {
    width: 90%;
    max-width: 1000px;
    height: 95vh;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.map-modal-body {
    padding: 0;
    flex: 1;
    position: relative;
    min-height: 0;
}

.map-container {
    width: 100%;
    height: 100%;
    border-radius: 0 0 4px 4px;
}

/* Basemap-Switcher Control */
.basemap-switcher {
    display: flex !important;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.basemap-switcher .basemap-btn {
    width: auto;
    min-width: 110px;
    height: auto;
    padding: 0.4rem 0.7rem;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.basemap-switcher .basemap-btn:last-child {
    border-bottom: none;
}

.basemap-switcher .basemap-btn:hover {
    background: var(--hover-color);
}

.basemap-switcher .basemap-btn.active {
    background: var(--primary-color);
    color: white;
}

.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 10;
}

.map-loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

.map-popup h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1rem;
}

.map-popup p {
    margin: 0.3rem 0;
    font-size: 0.85rem;
}

/* Tab System - Kompakt */
.tab-navigation {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 0.5rem;
    background: #f5f5f5;
    border-radius: 3px 3px 0 0;
    padding: 0.3rem 0.3rem 0 0.3rem;
    gap: 0.2rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab-button {
    background: none;
    border: none;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    border-radius: 3px 3px 0 0;
    transition: all 0.2s ease;
    color: #666;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    min-width: fit-content;
    position: relative;
    margin-bottom: -1px;
}

.tab-button:hover {
    background: #e8e8e8;
    color: #333;
}

.tab-button.active {
    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-bottom: 1px solid white;
    font-weight: 600;
    box-shadow: 0 -1px 3px rgba(0,0,0,0.05);
}

.tab-button i {
    font-size: 0.75rem;
}

.tab-content {
    min-height: 200px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Einheitliche Section Headers - Kompakt */
.section-header {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px 3px 0 0;
    padding: 0.3rem 0.5rem;
    margin-bottom: 0;
}

.section-header h3 {
    color: #333;
    font-weight: 600;
    font-size: 0.8rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.section-header h3 i {
    color: #666;
    font-size: 0.75rem;
}

/* Kompakte Info Sections */
.info-section {
    margin-bottom: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.info-section .info-grid,
.area-section-content,
.procedure-section,
.notes-content,
.internal-notes-section .notes-content {
    background: white;
    padding: 0.5rem;
    margin: 0;
}

.info-grid,
.area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.4rem;
}

.info-item,
.area-item {
    background: #fafafa;
    padding: 0.4rem 0.5rem;
    border-radius: 2px;
    border-left: 2px solid #333;
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 0.4rem;
    align-items: start;
}

.area-item {
    border-left: 2px solid #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label,
.area-label {
    font-weight: 600;
    color: #333;
    font-size: 0.75rem;
    line-height: 1.2;
}

.info-value,
.area-value {
    color: #444;
    font-size: 0.75rem;
    word-break: break-word;
    line-height: 1.2;
}

.area-value {
    font-weight: normal;
    text-align: right;
    min-width: 60px;
}

.total-area {
    text-align: center;
    padding: 0.5rem;
    background: #f5f5f5;
    color: #333;
    margin-bottom: 0.5rem;
    border-radius: 2px;
    border: 1px solid #ddd;
}

.total-area h4 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

/* Kompakte Tabellen */
.procedure-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
    border-radius: 0 0 3px 3px;
    overflow: hidden;
    box-shadow: none;
    border: 1px solid #ddd;
    border-top: none;
}

.procedure-table th {
    background: #f5f5f5;
    color: #333;
    padding: 0.3rem 0.4rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
    line-height: 1.2;
}

.procedure-table td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid #eee;
    font-size: 0.75rem;
    vertical-align: top;
    line-height: 1.2;
}

.procedure-table tr:hover {
    background: #fafafa;
}

.procedure-table tr:last-child td {
    border-bottom: none;
}

.procedure-table td:first-child {
    font-weight: 600;
    color: #333;
    min-width: 140px;
}

/* Vorlage Links */
.vorlage-link {
    color: #c52643;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    transition: all 0.2s ease;
    background: rgba(197, 38, 67, 0.05);
    border: 1px solid rgba(197, 38, 67, 0.1);
    font-size: 0.75rem;
}

.vorlage-link:hover {
    color: #a01f36;
    background: rgba(197, 38, 67, 0.1);
    border-color: rgba(197, 38, 67, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.vorlage-link i {
    font-size: 0.7rem;
}

/* Einheitliche Notes Sections */
.notes-section,
.internal-notes-section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.notes-content {
    color: #444;
    line-height: 1.3;
    font-size: 0.75rem;
}

/* No Data */
.no-data {
    padding: 1rem;
    text-align: center;
    color: #999;
    font-style: italic;
    font-size: 0.8rem;
}

/* Responsive Design - Optimiert */
@media (max-width: 768px) {
    .modal-header {
        padding: 0.5rem 0.8rem;
    }

    .modal-title {
        font-size: 0.9rem;
    }

    .modal-body {
        padding: 0.5rem;
    }

    .tab-navigation {
        padding: 0.2rem;
        gap: 0.1rem;
    }

    .tab-button {
        padding: 0.3rem 0.4rem;
        font-size: 0.7rem;
        flex-direction: column;
        gap: 0.2rem;
        min-width: 55px;
    }

    .tab-button span {
        font-size: 0.65rem;
        text-align: center;
        line-height: 1;
    }

    .tab-button i {
        font-size: 0.75rem;
    }

    .info-grid,
    .area-grid {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .info-item,
    .area-item {
        grid-template-columns: 1fr;
        gap: 0.2rem;
        padding: 0.3rem 0.4rem;
    }

    .area-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .info-label,
    .area-label {
        border-bottom: 1px solid #eee;
        padding-bottom: 0.1rem;
        font-size: 0.7rem;
    }

    .info-value,
    .area-value {
        font-size: 0.7rem;
        text-align: left;
    }

    .procedure-table {
        font-size: 0.65rem;
    }

    .procedure-table th,
    .procedure-table td {
        padding: 0.25rem 0.3rem;
        font-size: 0.65rem;
    }

    .section-header {
        padding: 0.25rem 0.4rem;
    }

    .section-header h3 {
        font-size: 0.7rem;
    }

    .total-area {
        padding: 0.3rem;
        margin-bottom: 0.3rem;
    }

    .total-area h4 {
        font-size: 0.75rem;
        flex-direction: column;
        gap: 0.1rem;
    }
}

@media (max-width: 480px) {
    .tab-content {
        min-height: 150px;
    }

    .procedure-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .procedure-table th,
    .procedure-table td {
        min-width: 75px;
    }

    .modal-content {
        width: 98%;
        margin: 1% auto;
    }

    .login-modal-content {
        width: 95%;
        margin: 5% auto;
    }
}
