/* FIX: Theme Header Überlappung (Repariert den fehlenden z-index im Theme) */
.site-header {
    z-index: 1000 !important;
}

/* --- BluGallery Admin Styles --- */
.blugallery-admin-wrapper {
    font-family: inherit;
    color: #333;
}
.blugallery-panel {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ddd;
}
.blugallery-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    margin-top: 20px;
}
.blugallery-admin-item {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    cursor: grab;
    transition: box-shadow 0.2s;
}
.blugallery-admin-item:active {
    cursor: grabbing;
}
.blugallery-admin-item.dragging {
    opacity: 0.5;
    border: 2px dashed #007bff;
    z-index: 999 !important; 
}
.blugallery-drag-handle {
    background: #eee;
    text-align: center;
    padding: 5px;
    font-size: 12px;
    color: #666;
    border-bottom: 1px solid #ccc;
}
.blugallery-img-preview {
    height: 150px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 1px solid #eee;
}
.blugallery-item-inputs {
    padding: 10px;
}
.blugallery-item-inputs input {
    width: 100%;
    padding: 5px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    box-sizing: border-box;
}
.blugallery-item-inputs .btn-delete-img {
    width: 100%;
    font-size: 12px;
}
.blugallery-table th, .blugallery-table td {
    vertical-align: middle !important;
}

/* --- BluGallery Frontend Styles --- */
.blugallery-frontend-wrapper {
    margin: 20px 0;
    position: relative;
}
.blugallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--bg-cols, 3), 1fr);
    gap: 15px;
    position: relative;
}
.blugallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #f4f4f4;
    z-index: 1;
}
.blugallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.blugallery-item:hover img {
    transform: scale(1.05);
}
.blugallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 10px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
    font-size: 14px;
    z-index: 2;
}
.blugallery-item:hover .blugallery-overlay {
    opacity: 1;
}

/* Responsive Grid */
@media (max-width: 900px) {
    .blugallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    .blugallery-grid { grid-template-columns: 1fr; }
}

/* --- Built-in Lightbox --- */
.blugallery-lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.blugallery-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}
.blugallery-lightbox-img {
    max-width: 90%;
    max-height: 80vh;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border-radius: 4px;
}
.blugallery-lightbox-caption {
    color: #fff;
    margin-top: 15px;
    font-size: 16px;
    text-align: center;
    min-height: 24px;
}
.blugallery-lightbox-close,
.blugallery-lightbox-prev,
.blugallery-lightbox-next {
    position: absolute;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 20px;
    z-index: 10;
}
.blugallery-lightbox-close:hover,
.blugallery-lightbox-prev:hover,
.blugallery-lightbox-next:hover {
    opacity: 1;
}
.blugallery-lightbox-close { top: 10px; right: 20px; }
.blugallery-lightbox-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.blugallery-lightbox-next { right: 10px; top: 50%; transform: translateY(-50%); }

@media (max-width: 600px) {
    .blugallery-lightbox-prev, .blugallery-lightbox-next {
        font-size: 30px; padding: 10px;
    }
}