* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&family=Oswald:wght@400;500;600;700&display=swap');

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #063F48;
    color: #ffffff;
    line-height: 1.6;
    font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Admin-Container: Erweiterte Breite mit Scroll-Funktion */
.admin .container {
    max-width: 90%;
    padding: 15px;
}

/* Für sehr große Bildschirme: Mehr Breite nutzen */
@media (min-width: 1600px) {
    .admin .container {
        max-width: 95%;
        padding: 20px;
    }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #B4A07F;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.admin-link {
    color: #B4A07F;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid #B4A07F;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.admin-link:hover {
    background-color: #B4A07F;
    color: #063F48;
}

.search-section {
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
    padding: 15px 20px;
    background: rgba(180, 160, 127, 0.08);
    border-radius: 6px;
    border: 1px solid rgba(180, 160, 127, 0.3);
}

.filter-actions::before {
    content: "Filter-Steuerung";
    font-size: 0.9rem;
    color: #B4A07F;
    font-weight: 600;
    margin-right: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Oswald', sans-serif;
}

.search-input {
    flex: 1;
    min-width: 300px;
    padding: 12px 16px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid #B4A07F;
    border-radius: 4px;
    color: #ffffff;
    font-size: 1rem;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
    outline: none;
    border-color: #B4A07F;
    background-color: rgba(255, 255, 255, 0.15);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Lato', sans-serif;
}

.btn-primary {
    background-color: #B4A07F;
    color: #063F48;
    border: 1px solid #B4A07F;
}

.btn-primary:hover {
    background-color: #c5b190;
}

.btn-secondary {
    background-color: transparent;
    color: #B4A07F;
    border: 1px solid #B4A07F;
}

.btn-secondary:hover {
    background-color: #B4A07F;
    color: #063F48;
}

.btn-danger {
    background-color: rgba(220, 53, 69, 0.8);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: rgba(220, 53, 69, 1);
}

.table-container {
    overflow-x: auto;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

/* Admin-Tabelle: Erweiterte Breite mit Scroll-Funktion */
.admin .data-table {
    min-width: 1200px;
    table-layout: auto;
    width: 100%;
}

/* Admin-Tabellen-Container: Vollbreite */
.admin .table-container {
    width: 100%;
    margin: 0;
}

/* Admin-Tabelle: Optimierte Spalten-Breiten für bessere Lesbarkeit */
.admin .data-table th:nth-child(1),
.admin .data-table td:nth-child(1) { min-width: 120px; } /* Inbetriebnahme */

.admin .data-table th:nth-child(2),
.admin .data-table td:nth-child(2) { min-width: 140px; } /* PLZ-Ort */

.admin .data-table th:nth-child(3),
.admin .data-table td:nth-child(3) { min-width: 200px; } /* Photovoltaikanlage */

.admin .data-table th:nth-child(4),
.admin .data-table td:nth-child(4) { min-width: 120px; } /* Gesamtleistung */

.admin .data-table th:nth-child(5),
.admin .data-table td:nth-child(5) { min-width: 180px; } /* Batteriespeichersystem */

.admin .data-table th:nth-child(6),
.admin .data-table td:nth-child(6) { min-width: 120px; } /* Nettokapazität */

.admin .data-table th:nth-child(7),
.admin .data-table td:nth-child(7) { min-width: 80px; } /* Bilder */

.admin .data-table th:nth-child(8),
.admin .data-table td:nth-child(8) { min-width: 100px; } /* Erstellt */

.admin .data-table th:nth-child(9),
.admin .data-table td:nth-child(9) { min-width: 100px; } /* Bearbeitet */

.admin .data-table th:nth-child(10),
.admin .data-table td:nth-child(10) { min-width: 150px; } /* Aktionen */

/* Admin-Tabelle: Normale Text-Darstellung mit Scroll */
.admin .data-table td {
    white-space: nowrap;
    overflow: visible;
}

.data-table thead {
    background: #063F48;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #B4A07F;
    background: rgba(180, 160, 127, 0.2);
    vertical-align: top;
}

.data-table th a {
    color: #ffffff;
    text-decoration: none;
    display: block;
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 600;
    padding: 8px 12px;
    background: rgba(180, 160, 127, 0.1);
    border-radius: 4px;
    transition: background-color 0.2s ease;
    border: 1px solid transparent;
}

.data-table th a:hover {
    color: #B4A07F;
    background: rgba(180, 160, 127, 0.2);
}

.column-filter {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(180, 160, 127, 0.3);
    border-radius: 4px;
    color: #ffffff;
    font-size: 0.9rem;
    margin-top: 8px;
    transition: border-color 0.2s ease;
    font-family: 'Lato', sans-serif;
}

.column-filter::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-style: normal;
    font-weight: 300;
}

.column-filter:focus {
    outline: none;
    border-color: #B4A07F;
    background: rgba(255, 255, 255, 0.08);
}

.column-filter:hover {
    border-color: rgba(180, 160, 127, 0.5);
}

.range-filter {
    display: flex;
    gap: 8px;
    flex-direction: column;
    margin-top: 8px;
    padding: 12px;
    background: rgba(180, 160, 127, 0.05);
    border-radius: 4px;
    border: 1px solid rgba(180, 160, 127, 0.2);
}

.range-filter::before {
    content: "Bereichsfilter";
    font-size: 0.75rem;
    color: #B4A07F;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Oswald', sans-serif;
}

.range-filter .column-filter {
    font-size: 0.85rem;
    padding: 8px 10px;
    margin-top: 0;
}

/* Spezielle Styles für verschiedene Input-Typen */
input[type="date"].column-filter {
    color-scheme: dark;
    position: relative;
}

input[type="date"].column-filter::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B4A07F' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") no-repeat center;
    background-size: 16px;
    width: 20px;
    height: 20px;
}

input[type="number"].column-filter {
    color-scheme: dark;
}

input[type="number"].column-filter::-webkit-outer-spin-button,
input[type="number"].column-filter::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"].column-filter {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* Filter-Container mit besseren visuellen Hinweisen */
.data-table th {
    position: relative;
}

/* Spezielle Styles für Text-Filter */
input[type="text"].column-filter {
    padding-left: 16px;
}

/* Spezielle Styles für Number-Filter */
input[type="number"].column-filter {
    padding-left: 16px;
    text-align: right;
}

/* Spezielle Styles für Date-Filter */
input[type="date"].column-filter {
    padding-left: 16px;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(180, 160, 127, 0.2);
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: rgba(180, 160, 127, 0.1);
}

.btn-image {
    background-color: #B4A07F;
    color: #063F48;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-image:hover {
    background-color: #c5b190;
}

.no-images {
    color: rgba(255, 255, 255, 0.5);
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
}

.page-info {
    color: #B4A07F;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    overflow: hidden; /* Verhindert, dass das Modal höher als die Viewport-Höhe wird */
}

.modal.active {
    display: block;
}

.modal-content {
    position: relative;
    margin: 2% auto;
    padding: 20px;
    width: 90%;
    max-width: 1200px;
    max-height: 40vh; /* weiter kompakter im Iframe */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* eigener Scroll-Flow innen */
}

.close {
    position: absolute;
    top: 10px;
    right: 25px;
    color: #B4A07F;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.close:hover {
    color: #ffffff;
}

.slideshow-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    flex: 1 1 auto; /* nimmt verfügbaren Platz ein */
    min-height: 0; /* erlaubt flex-kindern korrekt zu schrumpfen */
}

.slide-main {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    max-height: 28vh; /* Hauptbildbereich ~70% des 40vh-Containers */
}

.slide-main {
    position: relative;
    overflow: hidden;
    cursor: grab;
}

.slide-main:active {
    cursor: grabbing;
}

.slide-main img {
    max-width: 100%;
    max-height: 28vh; /* Bild selbst an neuen Hauptbereich anpassen */
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: grab;
    user-select: none;
    transform-origin: center center;
    will-change: transform;
    touch-action: none;
}

.slide-main img:active {
    cursor: grabbing;
}

.slide-main img.dragging {
    transition: none;
    cursor: grabbing;
}

.zoom-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(6, 63, 72, 0.9);
    color: #ffffff;
    border: 1px solid #B4A07F;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10;
    min-width: 50px;
    text-align: center;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background-color: #B4A07F;
    color: #063F48;
}

.slide-nav {
    background-color: rgba(180, 160, 127, 0.8);
    color: #063F48;
    border: none;
    padding: 20px 15px;
    cursor: pointer;
    font-size: 24px;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin: 0 10px;
}

.slide-nav:hover {
    background-color: #B4A07F;
}

.slideshow-controls {
    text-align: center;
    margin-bottom: 20px;
}

.thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    max-height: 8vh; /* kompakter für 40vh Gesamthöhe */
    overflow-y: auto;
}

.thumbnail {
    min-width: 100px;
    height: 80px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: all 0.3s ease;
    object-fit: cover;
}

.thumbnail:hover {
    border-color: #B4A07F;
    opacity: 0.8;
}

.thumbnail.active {
    border-color: #B4A07F;
}

.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid #B4A07F;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #B4A07F;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid #B4A07F;
    border-radius: 4px;
    color: #ffffff;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #B4A07F;
    background-color: rgba(255, 255, 255, 0.15);
}

.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.5);
    color: #ff6b7a;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.2);
    border: 1px solid rgba(40, 167, 69, 0.5);
    color: #5dff7c;
}

.admin-nav {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.image-upload-area {
    border: 2px dashed #B4A07F;
    border-radius: 4px;
    padding: 30px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-upload-area:hover {
    background-color: rgba(180, 160, 127, 0.1);
}

.image-preview {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.image-preview-item {
    position: relative;
    width: 150px;
    height: 150px;
    border: 1px solid #B4A07F;
    border-radius: 4px;
    overflow: hidden;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.image-preview-item .remove-image:hover {
    background-color: rgba(220, 53, 69, 1);
}

.existing-images {
    margin-top: 20px;
}

.existing-images h3 {
    margin-bottom: 15px;
    color: #B4A07F;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    h1 {
        font-size: 1.5rem;
    }

    .search-form {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
    }

    .filter-actions {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
    }

    .filter-actions::before {
        text-align: center;
        margin-bottom: 10px;
        margin-right: 0;
    }

    .table-container {
        font-size: 0.85rem;
        overflow-x: auto;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
        min-width: 120px;
    }


    .data-table th a {
        font-size: 0.9rem;
        padding: 6px 8px;
    }

    .column-filter {
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    .range-filter {
        padding: 8px;
        gap: 6px;
    }

    .range-filter .column-filter {
        font-size: 0.75rem;
        padding: 6px 8px;
    }


    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .modal-content {
        width: 95%;
        padding: 10px;
    }

    .slide-main {
        min-height: 300px;
    }

    .admin-nav {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .data-table th {
        padding: 6px 4px;
    }

    .data-table th a {
        font-size: 0.8rem;
        padding: 4px 6px;
        margin-bottom: 8px;
    }

    .column-filter {
        font-size: 0.75rem;
        padding: 6px 8px;
    }

    .range-filter {
        padding: 6px;
    }

    .range-filter .column-filter {
        font-size: 0.7rem;
        padding: 4px 6px;
    }

    .filter-actions {
        padding: 10px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}
