/* CSS für die Autoren-Bildergalerie */

/* Upload-Formular Styling */
.peteitcms-gallery-upload {
    border: 1px solid #e0e0e0;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 5px;
}

.upload-preview-container {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
    position: relative;
    overflow: hidden;
    border-radius: 5px;
    border: 2px dashed #ccc;
    cursor: pointer;
}

.upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: #777;
}

.upload-preview i {
    font-size: 2rem;
    margin-bottom: 10px;
}

#image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.hidden {
    display: none;
}

.gallery-upload-form .form-group {
    margin-bottom: 15px;
}

.gallery-upload-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.gallery-upload-form input[type="file"] {
    display: none;
}

.gallery-upload-form input[type="text"],
.gallery-upload-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.gallery-upload-form textarea {
    min-height: 100px;
}

.form-actions {
    display: flex;
    align-items: center;
}

.upload-status, .edit-status {
    margin-left: 15px;
}

.success-message {
    color: #4caf50;
}

.error-message {
    color: #f44336;
}

/* Galerie-Grid Styling */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Genau 4 Bilder pro Reihe */
    grid-gap: 20px;
    margin-top: 20px;
}

.gallery-item {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    padding: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.gallery-image {
    position: relative;
    height: 230px; /* Erhöhte Höhe für größere Bilder */
    overflow: hidden;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-image-actions {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    border-bottom-left-radius: 5px;
    display: none;
}

.gallery-item:hover .gallery-image-actions {
    display: flex;
}

.gallery-image-actions button {
    background: none;
    border: none;
    color: white;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 14px;
}

.edit-image-btn:hover {
    color: #2196f3;
}

.delete-image-btn:hover {
    color: #f44336;
}

.gallery-item-info {
    padding: 10px;
}

.gallery-item-info h4 {
    margin: 0 0 5px;
    font-size: 16px;
    color: #333;
}

.gallery-item-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.no-images-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #777;
    border-radius: 5px;
}

/* Modal Styling */
.gallery-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
}

.gallery-modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border-radius: 5px;
    width: 80%;
    max-width: 500px;
}

.gallery-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.gallery-modal-close:hover,
.gallery-modal-close:focus {
    color: black;
    text-decoration: none;
}

/* Pagination Styling */
.gallery-pagination-container {
    width: 100%;
    clear: both;
    display: block;
    margin-top: 30px;
    text-align: center;
    grid-column: 1 / -1; /* Volle Breite im Grid nehmen */
}

.gallery-pagination {
    margin-top: 30px;
    text-align: center;
    width: 100%;
    grid-column: 1 / -1; /* Volle Breite im Grid nehmen */
    clear: both; /* Verhindert das Floating neben anderen Elementen */
}

.pagination {
    display: inline-block;
}

.pagination a {
    color: #333;
    float: left;
    padding: 8px 16px;
    text-decoration: none;
    border: 1px solid #ddd;
    margin: 0 2px;
    border-radius: 4px;
}

.pagination a.current {
    background-color: #4CAF50;
    color: white;
    border: 1px solid #4CAF50;
}

.pagination a:hover:not(.current) {
    background-color: #f1f1f1;
}

.pagination .ellipsis {
    float: left;
    padding: 8px 16px;
}

/* Lightbox Styling */
.gallery-lightbox {
    display: none;
    position: fixed;
    z-index: 1100;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 80%;
    max-height: 80vh;
    margin: 0 auto;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    margin: 0 auto;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1101;
}

.lightbox-info {
    text-align: center;
    color: #fff;
    padding: 10px 0;
    margin-top: 10px;
}

.lightbox-info h4 {
    margin: 0 0 5px;
    font-size: 18px;
}

.lightbox-info p {
    margin: 0;
    font-size: 14px;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 30px;
    color: #fff;
    cursor: pointer;
    background: rgba(0,0,0,0.5);
    padding: 10px 15px;
    border-radius: 50%;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0,0,0,0.8);
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        grid-gap: 10px;
    }
    
    .gallery-image {
        height: 150px;
    }
    
    .gallery-modal-content {
        width: 95%;
        margin: 20% auto;
    }
    
    .lightbox-content {
        max-width: 95%;
    }
}

/* Button für Profillinks in Posts */
.profile-button {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(90deg, #000 0%, #c19be9 50%, #000 100%) !important;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
    border: none;
    transition: all 0.3s ease;
}

.profile-button:hover {
    opacity: 0.9;
    transform: scale(1.03);
    color: #fff !important;
    text-decoration: none !important;
}

/* Benutzerdefinierte Pagination */
.peteitcms-gallery-pagination {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
    clear: both;
}

/* Mobile Anpassungen */
@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .gallery-image {
        height: 120px;
    }
    
    .gallery-item-info h4 {
        font-size: 14px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        font-size: 20px;
        padding: 8px 12px;
    }
}
