/* =========================================================
   Immich Galerie – Stylesheet
   ========================================================= */

/* ----- Grid ----- */
.immich-gal-grid {
    columns: 3;
    column-gap: 1.5rem;
    margin-top: 1.5rem;
}
.immich-gal-cols-2 { columns: 2; }
.immich-gal-cols-3 { columns: 3; }
.immich-gal-cols-4 { columns: 4; }

@media (max-width: 900px) {
    .immich-gal-cols-3,
    .immich-gal-cols-4 { columns: 2; }
}
@media (max-width: 560px) {
    .immich-gal-cols-2,
    .immich-gal-cols-3,
    .immich-gal-cols-4 { columns: 1; }
}

/* ----- Einzelner Block ----- */
.immich-gal-block {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    transition: opacity 0.2s ease;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 1.5rem;
    display: inline-block; /* wichtig für Masonry */
    width: 100%;
}
.immich-gal-block.ig-hidden {
    display: none;
}

/* ----- Bild ----- */
.immich-gal-img-wrap {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
}
.immich-gal-thumb {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.25s ease;
    cursor: zoom-in;
}
.immich-gal-img-wrap:hover .immich-gal-thumb {
    transform: scale(1.03);
}

/* Zoom-Button oben rechts */
.immich-gal-zoom-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px 7px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    line-height: 1;
}
.immich-gal-img-wrap:hover .immich-gal-zoom-btn,
.immich-gal-zoom-btn:focus {
    opacity: 1;
}

/* ----- Textbereich unter dem Bild ----- */
.immich-gal-info {
    padding: 12px 14px 16px;
}

.immich-gal-nr {
    font-size: 11px;
    color: #888;
    font-family: monospace;
    margin: 0 0 5px;
}

.immich-gal-caption {
    font-size: 14px;
    line-height: 1.65;
    color: #222;
    margin: 0 0 10px;
}
.immich-gal-no-desc {
    color: #aaa;
    font-style: italic;
}

.immich-gal-badge.immich-gal-badge-red {
    background: #c0392b !important;
    color: #fff !important;
    border-color: #c0392b !important;
}
.immich-gal-badge.immich-gal-badge-archiv {
    background: #f5f0eb !important;
    color: #7a6652 !important;
    border-color: #d4c4b0 !important;
    font-style: italic;
}
.immich-gal-badge.immich-gal-badge-abgerissen {
    background: #eaf1fb !important;
    color: #1a56db !important;
    border-color: #b3cef5 !important;
    font-style: italic;
}
.immich-gal-ort-list {
    margin-bottom: 5px;
}
.immich-gal-ort-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #1a4fa0;
    margin-right: 4px;
}

/* ----- Schlagwort-Badges ----- */
.immich-gal-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}
.immich-gal-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8f0fc;
    color: #1a4fa0;
}

/* ----- Ausgegrauetes Dropdown (Epoche) ----- */
.immich-gal-ort-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}
.immich-gal-counter-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 4px;
}
.immich-gal-counter {
    font-size: 12px;
    color: #888;
    margin: 0;
    white-space: nowrap;
}

/* ----- Dropdown-Zeile (einzeilig auf Desktop) ----- */
.immich-gal-dropdown-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    align-items: flex-end;
    margin-bottom: 0.75rem;
}
.immich-gal-dropdown-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}
.immich-gal-dropdown-item .immich-gal-filter-label {
    margin: 0;
    white-space: nowrap;
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
/* Zähler rechtsbündig ans Ende schieben */
.immich-gal-counter-item {
    margin-left: auto;
    justify-content: flex-end;
    align-self: flex-end;
    padding-bottom: 6px;
}
.immich-gal-ort-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.5rem;
}
.immich-gal-ort-select {
    font-size: 13px;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
    min-width: 0;
    width: 100%;
}
.immich-gal-ort-select:focus {
    outline: none;
    border-color: #1a4fa0;
}
.immich-gal-filter {
    margin-bottom: 0.5rem;
}
.immich-gal-filter-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}
.immich-gal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.immich-gal-tag {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #444;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.immich-gal-tag:hover {
    background: #e0e0e0;
}
.immich-gal-tag.active,
.immich-gal-tag[aria-pressed="true"] {
    background: #1a4fa0;
    color: #fff;
    border-color: #1a4fa0;
}

/* ----- Info-Header: Dateiname + Download-Icon ----- */
.immich-gal-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
    min-height: 26px;
}
.immich-gal-info-header .immich-gal-nr {
    margin: 0;
    flex: 1;
}

/* ----- Download-Icon-Button ----- */
.immich-gal-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #555;
    text-decoration: none;
    flex-shrink: 0;
    margin-left: auto;
    transition: background 0.15s, color 0.15s;
}
.immich-gal-download-btn:hover {
    background: #1a4fa0;
    color: #fff;
    border-color: #1a4fa0;
}
.immich-gal-hinweis-btn {
    font-size: 12px;
    background: none;
    border: 1px solid #bbb;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    color: #555;
    transition: background 0.15s;
    width: 100%;
    text-align: left;
    margin-top: 4px;
}
.immich-gal-hinweis-btn:hover {
    background: #f0f0f0;
}

/* ----- Hinweis-Formular ----- */
.immich-gal-form-wrap {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}
.immich-gal-form label {
    display: block;
    font-size: 13px;
    color: #444;
    margin: 8px 0 3px;
}
.immich-gal-form input[type="text"],
.immich-gal-form input[type="email"],
.immich-gal-form textarea {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    color: #222;
    background: #fff;
}
.immich-gal-form input[readonly] {
    background: #f5f5f5;
    color: #888;
}
.immich-gal-form textarea {
    resize: vertical;
    min-height: 80px;
}
.immich-gal-form-footer {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.immich-gal-submit {
    font-size: 13px;
    padding: 7px 16px;
    background: #1a4fa0;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.immich-gal-submit:hover { background: #143d80; }
.immich-gal-submit:disabled { background: #aaa; cursor: default; }
.immich-gal-cancel {
    font-size: 13px;
    padding: 7px 12px;
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
}
.immich-gal-cancel:hover { background: #f0f0f0; }

.immich-gal-form-msg {
    margin-top: 8px;
    font-size: 13px;
    min-height: 1.4em;
}
.immich-gal-form-msg.success { color: #2a7a2a; }
.immich-gal-form-msg.error   { color: #b00; }

/* ----- Lightbox ----- */
.immich-gal-lb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    z-index: 9998;
}
.immich-gal-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.immich-gal-lb-img {
    max-width: 92vw;
    max-height: 80vh;
    border-radius: 5px;
    box-shadow: 0 4px 40px rgba(0,0,0,0.5);
    object-fit: contain;
}
.immich-gal-lb-caption {
    color: #eee;
    font-size: 14px;
    margin-top: 12px;
    max-width: 680px;
    text-align: center;
    line-height: 1.5;
}
.immich-gal-lb-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 10000;
}
.immich-gal-lb-close:hover { background: rgba(255,255,255,0.3); }

/* ----- Hinweis ----- */
.immich-gal-notice {
    padding: 12px 16px;
    background: #fff8e1;
    border-left: 4px solid #f5a623;
    font-size: 14px;
    color: #555;
}

/* ----- Nach-oben-Button ----- */
#immich-gal-back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    background: #1a4fa0;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    z-index: 9999;
    transition: opacity 0.2s;
}
#immich-gal-back-to-top:hover {
    background: #0d3278;
}

/* ----- Sterne-Bewertung ----- */
.immich-gal-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0;
}
.ig-stars {
    display: flex;
    gap: 2px;
}
.ig-star {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #ccc;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}
.ig-star:hover,
.ig-star.ig-hover,
.ig-star.ig-active {
    color: #f0a500;
}
.ig-star.ig-mine {
    color: #e67e00;
}
.ig-rating-info {
    font-size: 11px;
    color: #888;
}

/* Lazy-Loading: Platzhalter bis Bild geladen wird */
img.ig-lazy {
    background: #f0f0f0;
    min-height: 80px;
    display: block;
    width: 100%;
}
