/* gallery.css - Spezifische Styles für das Client Tool */

.gallery-body {
    background-color: #0a0a0a;
}

/* Login Maske */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-box {
    text-align: center;
    max-width: 400px;
    padding: 40px;
    border: 1px solid rgba(255,255,255,0.1);
    background: #000;
}

.login-box input {
    width: 100%;
    padding: 15px;
    margin: 20px 0;
    background: transparent;
    border: 1px solid #333;
    color: #fff;
    font-family: var(--font-body);
}

.login-box input:focus {
    outline: none;
    border-color: #fff;
}

.login-box button {
    width: 100%;
    padding: 15px;
    background: #fff;
    color: #000;
    border: none;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.login-box button:hover {
    background: #ccc;
}

#logout-redirect a {
    transition: color 0.3s;
}

#logout-redirect a:hover {
    color: #fff !important;
}

.nav-links-wrapper {
    display: flex;
    align-items: center;
}

/* Header Anpassungen für Logo & Logout */
.navbar .logo a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s;
}

.navbar .logo a:hover {
    opacity: 0.7;
}

/* Gallery Header */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 40px 50px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    background: rgba(10,10,10,0.95);
    z-index: 100;
}

.header-info h1 {
    font-family: var(--font-heading);
    margin: 0 0 10px 0;
}

.header-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.header-legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.logout-btn {
    background: transparent;
    border: 1px solid #333;
    color: #fff;
    padding: 8px 15px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.logout-btn:hover {
    border-color: #fff;
}

/* Masonry Grid */
.masonry-grid {
    padding: 50px;
    column-count: 3;
    column-gap: 30px;
}

@media (max-width: 1200px) { .masonry-grid { column-count: 2; } }
@media (max-width: 768px) { .masonry-grid { column-count: 1; padding: 20px;} .gallery-header{ flex-direction: column; align-items: flex-start; gap: 20px;} }

/* Loading Spinner */
.gallery-loader-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 100px 0;
    width: 100%;
}
.gallery-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.gallery-item {
    break-inside: avoid;
    margin-bottom: 30px;
    position: relative;
    cursor: auto;
}

.image-wrapper {
    position: relative;
    user-select: none;
    -webkit-user-drag: none;
}
.image-wrapper::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
    pointer-events: auto; /* Catches right clicks and drag */
    background: transparent;
}
.gallery-item img {
    width: 100%;
    display: block;
    transition: opacity 0.3s;
    user-select: none;
    pointer-events: none; /* Let clicks pass through to wrapper */
}

/* State Modifiers */
.gallery-item.state-red img {
    opacity: 0.3;
    filter: grayscale(100%);
}

.gallery-item.state-blue {
    border: 2px solid var(--dot-blue);
    padding: 2px;
}

.gallery-item.state-green {
    border: 2px solid var(--dot-green);
    padding: 2px;
}

.gallery-item.state-yellow {
    border: 2px solid var(--dot-yellow);
    padding: 2px;
}

/* 🔥 Matches Glow Effect (Dauerhaft) */
body.match-view .gallery-item.state-green.state-admin {
    border: 2px solid rgba(255, 215, 0, 0.9);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), 0 0 8px rgba(255, 255, 255, 0.15), inset 0 0 10px rgba(255, 215, 0, 0.3);
    border-radius: 2px;
    transition: box-shadow 0.5s ease-in-out, border-color 0.5s ease-in-out;
}

/* Color Controls */
.color-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
    z-index: 20; /* Keep above the protection layer */
}

.gallery-item:hover .color-controls, .color-controls.active {
    opacity: 1;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-block;
    transition: transform 0.2s;
    border: 2px solid transparent;
}

.dot:hover {
    transform: scale(1.3);
}

.dot.green { background-color: var(--dot-green); }
.dot.yellow { background-color: var(--dot-yellow); }
.dot.red { background-color: var(--dot-red); }
.dot.blue { background-color: var(--dot-blue); cursor: default; } /* Blue is set by photographer usually */

/* Selected dot indicator */
.dot.selected {
    border-color: #fff;
    transform: scale(1.2);
}

/* Delete Icon overlay for red state */
.delete-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255,255,255,0.5);
    display: none;
    pointer-events: none;
}
.gallery-item.state-red .delete-icon {
    display: block;
}

/* Fotografen Auswahl Badge (Stern oben links) */
.admin-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0,0,0,0.6);
    color: rgba(255,255,255,0.4);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 25;
    backdrop-filter: blur(5px);
}

/* Sichtbar beim Darüberfahren ODER wenn permanent ausgewählt */
.gallery-item:hover .admin-badge, .admin-badge.selected {
    opacity: 1;
}

/* Fotografen-Hover */
.admin-badge:hover {
    color: #fff;
    transform: scale(1.1);
}

/* Leuchtet Gold, wenn ausgewählt */
.admin-badge.selected {
    color: #ffd700; 
    background: rgba(0,0,0,0.9);
}

/* Zoom Button auf dem Bild */
.zoom-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.6);
    color: rgba(255,255,255,0.7);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 25;
    backdrop-filter: blur(5px);
}
.gallery-item:hover .zoom-btn {
    opacity: 1;
}
.zoom-btn:hover {
    color: #fff;
    transform: scale(1.1);
    background: rgba(0,0,0,0.8);
}

/* Comment Button (Neben Zoom) */
.comment-btn {
    position: absolute;
    top: 15px;
    right: 55px; /* Links neben Zoom */
    background: rgba(0,0,0,0.6);
    color: rgba(255,255,255,0.7);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 25;
    backdrop-filter: blur(5px);
}
.gallery-item:hover .comment-btn {
    opacity: 1;
}
.comment-btn:hover {
    color: #fff;
    transform: scale(1.1);
    background: rgba(0,0,0,0.8);
}
.comment-btn.has-comment {
    color: #ffd700;
    opacity: 1; /* Immer sichtbar wenn kommentiert */
}

/* Comment Overlay */
.comment-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
    z-index: 30;
    display: flex; /* wird via js getoggelt */
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
    border-radius: 8px; /* Gleich wie Bild */
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.comment-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.comment-close-btn:hover { opacity: 1; }

.comment-textarea {
    flex: 1;
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    border-radius: 5px;
    padding: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}
.comment-textarea:focus {
    border-color: #ffd700;
}
.comment-textarea:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.comment-status {
    height: 20px;
    font-size: 0.8rem;
    margin-top: 10px;
    text-align: right;
    font-weight: bold;
}

/* Read-Only Kommentar-Anzeige für den Fotografen (Admin) im Overlay */
.admin-readonly-comment {
    flex: 1;
    width: 100%;
    color: #ffd700; /* Gold */
    font-size: 1.2rem;
    line-height: 1.6;
    padding: 20px 10px;
    box-sizing: border-box;
    text-align: center;
    overflow-y: auto;
    font-weight: 300;
}

/* --- Lightbox / Fullscreen Cinematic --- */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(4, 4, 4, 0.98); /* Deep cinematic background */
    z-index: 5000;
    
    /* Using visibility instead of display to allow CSS transitions! */
    display: flex;
    visibility: hidden;
    pointer-events: none;
    
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(15px); /* Stronger premium blur */
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0s 0.4s;
}

.lightbox-overlay.active {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0s 0s;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: #fff;
    font-size: 4rem;
    font-weight: 100; /* Hairline X */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1;
    cursor: pointer;
    z-index: 5001;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lightbox-close:hover {
    opacity: 1;
    transform: scale(1.1);
    color: #fff; /* Keep it clean white */
}

.lightbox-content-wrapper {
    width: 100vw; /* Randlos */
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Hide scrollbars during zoom */
}

.lightbox-content-wrapper img {
    width: auto;
    height: auto;
    max-width: 90vw; /* Etwas Luft zum Rand im normalen Status */
    max-height: 90vh;
    display: block;
    
    /* Leichter weißer Rahmen wie gewünscht */
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 4px; /* Minimal rund für Eleganz */
    box-shadow: 0 15px 40px rgba(0,0,0,0.8); /* Edler Schlagschatten passend zum Border */
    
    cursor: zoom-in;
    /* Basis-Zustand: Unsichtbar und leicht verkleinert ("ausgeatmet") */
    opacity: 0;
    transform: scale(0.95);
    /* Die Transition für das Erscheinen (Atmen) und das Zoomen */
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.6s ease;
}

/* Wenn das Bild voll geladen und sichtbar sein soll (einatmen) */
.lightbox-overlay.active .lightbox-content-wrapper img {
    opacity: 1;
    transform: scale(1);
}

/* Lightbox Comment Notiz (unten unter dem Bild) */
#lightbox-comment-display {
    color: #ffd700;
    background: rgba(0, 0, 0, 0.75);
    padding: 15px 25px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
    max-width: 800px;
    font-size: 1.1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease 0.3s; /* Erscheint minimal verzögert nach dem Bild */
}

.lightbox-overlay.active #lightbox-comment-display {
    opacity: 1;
    transform: translateY(0);
}

/* Klick auf das Bild -> Zoom */
.lightbox-overlay.active .lightbox-content-wrapper img.zoomed {
    cursor: zoom-out;
    transform: scale(2.5);
    /* Zoom darf minimal schneller sein als das erste Erscheinen */
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* --- Session Locking & Animations --- */

/* Verstecke die Farb-Punkte, wenn die Galerie gesperrt ist (außer für Admins) */
body.session-locked:not(.admin-view) .color-controls {
    display: none !important; 
}

/* Sperr-Symbol (Schloss) das dauerhaft angezeigt wird */
.locked-icon {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    z-index: 20;
    backdrop-filter: blur(5px);
    display: none; /* Erstmal versteckt */
}

/* Zeige das Schloss, wenn die Session gesperrt ist */
body.session-locked .locked-icon {
    display: flex;
}

/* Animation: Bilder fliegen davon */
@keyframes flyAway {
    0% {
        transform: translateY(0) scale(1) rotate(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-200vh) scale(0.5) rotate(15deg);
        opacity: 0;
    }
}

.gallery-item.fly-away {
    animation: flyAway 1.2s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

/* Screen Flash Effect (Siegel-Effekt) */
.screen-flash {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #fff;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
}
.animate-flash {
    animation: flash-anim 0.8s ease-out forwards;
}
@keyframes flash-anim {
    0% { opacity: 0; }
    15% { opacity: 0.6; } /* Kurzes Aufleuchten wie Blitz/Siegel */
    100% { opacity: 0; }
}

/* Weiches Auftauchen der Galerie (Softer Übergang) */
.fade-in-slow {
    animation: fadeInSlow 1.2s ease-out forwards;
}
@keyframes fadeInSlow {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

