/* ed-flock Fotobox - Gaeste-Galerie (dark, foto-fokussiert, mobile-first) */

:root {
    --primary: #0066FF;
    --primary-soft: #4d94ff;
    --bg: #0b0c10;
    --bg-card: #16181f;
    --bg-chip: #1d2029;
    --text: #f4f5f7;
    --text-dim: #9aa1ad;
    --border: rgba(255,255,255,0.09);
    --radius: 14px;
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

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

[hidden] { display: none !important; }

html { -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.gal-glow {
    position: fixed;
    top: -240px;
    left: 50%;
    width: 720px;
    height: 480px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(0,102,255,0.22), rgba(118,75,162,0.10) 55%, transparent 75%);
    pointer-events: none;
    z-index: 0;
}

/* ---------- Header ---------- */
.gal-header {
    position: relative;
    z-index: 1;
    padding: calc(14px + env(safe-area-inset-top)) 18px 6px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.gal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gal-brand {
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
}

.brand-ed { color: var(--primary); }
.brand-flock { color: var(--text); }

.brand-sub {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.gal-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s var(--transition);
}

.gal-share-btn:hover { background: rgba(255,255,255,0.12); }

.gal-hero {
    text-align: center;
    padding: 26px 0 10px;
}

.gal-hero h1 {
    font-size: clamp(30px, 8vw, 46px);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(120deg, #ffffff 30%, #b9cdf5 70%, var(--primary-soft));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.gal-meta {
    margin-top: 6px;
    color: var(--text-dim);
    font-size: 14px;
}

.meta-dot { margin: 0 6px; opacity: 0.6; }

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(80, 220, 130, 0.35);
    background: rgba(60, 200, 110, 0.10);
    color: #7fe3a4;
    font-size: 12.5px;
    font-weight: 600;
}

.live-badge em { font-style: normal; font-weight: 400; color: var(--text-dim); }

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: livePulse 1.6s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); opacity: 1; }
    50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); opacity: 0.65; }
}

/* ---------- Main / Loading / Fehler ---------- */
.gal-main {
    position: relative;
    z-index: 1;
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 6px 14px 40px;
}

.gal-loading {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-dim);
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
    margin-bottom: 14px;
}

.spinner.small { width: 18px; height: 18px; border-width: 2px; margin: 0; flex: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.gal-error { padding: 60px 10px; display: flex; justify-content: center; }

.error-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 42px 28px;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.error-icon { font-size: 40px; display: block; margin-bottom: 14px; }
.error-card h1 { font-size: 21px; margin-bottom: 10px; }
.error-card p { color: var(--text-dim); font-size: 14.5px; }

.error-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--primary-soft);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.error-link:hover { text-decoration: underline; }

.gal-pending {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0 16px;
    padding: 13px 16px;
    border-radius: var(--radius);
    border: 1px solid rgba(0,102,255,0.35);
    background: rgba(0,102,255,0.10);
    font-size: 14px;
}

/* Kein Warten mehr, sondern eine Auskunft, deshalb ohne das Blau der Live-Meldung. */
.gal-pending--note {
    border-color: var(--border);
    background: var(--bg-chip);
    color: var(--text-dim);
}

/* ---------- Filter-Chips ---------- */
.gal-filters { margin: 8px 0 18px; }

.chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: none;
}

.chip-row::-webkit-scrollbar { display: none; }

.chip {
    flex: none;
    padding: 8px 15px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-chip);
    color: var(--text-dim);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--transition);
    white-space: nowrap;
}

.chip .chip-count { font-weight: 400; opacity: 0.75; margin-left: 4px; }

.chip[aria-pressed="true"] {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.chip[aria-pressed="true"] .chip-count { opacity: 0.9; }

.face-block { margin-top: 8px; }

.face-hint {
    font-size: 12.5px;
    color: var(--text-dim);
    margin: 2px 2px 8px;
}

.face-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    scrollbar-width: none;
}

.face-row::-webkit-scrollbar { display: none; }

.face-chip {
    flex: none;
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border);
    padding: 0;
    background: var(--bg-chip);
    cursor: pointer;
    transition: transform 0.15s var(--transition), border-color 0.2s var(--transition);
}

.face-chip img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.face-chip:active { transform: scale(0.94); }

.face-chip[aria-pressed="true"] {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,102,255,0.35);
}

.face-count {
    position: absolute;
    bottom: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 18px;
}

.face-chip[aria-pressed="true"] .face-count {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---------- Grid ---------- */
.gal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    grid-auto-flow: dense;
    gap: 6px;
}

.tile {
    position: relative;
    border: none;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    aspect-ratio: 1;
    animation: tileIn 0.35s var(--transition) both;
}

@keyframes tileIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s var(--transition);
}

.tile:hover img { transform: scale(1.05); }

.tile.featured { grid-column: span 2; grid-row: span 2; }

.tile.thumb-missing {
    background: linear-gradient(140deg, #1b1e27, #232a3d 60%, #1c2334);
}

.tile.thumb-missing::before {
    content: '▶';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: rgba(255,255,255,0.55);
}

.tile-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.gal-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 50px 20px;
    font-size: 15px;
}

/* ---------- Footer ---------- */
.gal-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 26px 20px calc(30px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 13px;
}

.gal-footer a { color: var(--text); text-decoration: none; font-weight: 600; }
.gal-footer a:hover { text-decoration: underline; }

.footer-privacy { margin-top: 6px; font-size: 12px; opacity: 0.8; }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 9, 0.94);
    backdrop-filter: blur(8px);
}

.lb-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    background: linear-gradient(rgba(0,0,0,0.55), transparent);
}

.lb-counter { font-size: 13.5px; font-weight: 600; color: rgba(255,255,255,0.85); }

.lb-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    transition: background 0.2s var(--transition);
}

.lb-close:hover { background: rgba(255,255,255,0.24); }

.lb-stage {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px 8px 96px;
    touch-action: pan-y;
}

.lb-stage img,
.lb-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    user-select: none;
    -webkit-user-drag: none;
}

.lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.10);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s var(--transition);
    display: none;
}

.lb-arrow:hover { background: rgba(255,255,255,0.22); }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

.lb-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
}

.lb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.10);
    backdrop-filter: blur(10px);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s var(--transition);
}

.lb-btn:hover { background: rgba(255,255,255,0.22); }
.lb-btn:first-child { background: var(--primary); border-color: var(--primary); }
.lb-btn:first-child:hover { background: var(--primary-soft); }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: calc(28px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    background: #fff;
    color: #111;
    padding: 11px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 12px 40px rgba(0,0,0,0.45);
    animation: toastIn 0.25s var(--transition);
    max-width: calc(100vw - 40px);
    text-align: center;
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Breakpoints ---------- */
@media (min-width: 600px) {
    .gal-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
    .lb-arrow { display: block; }
}

@media (min-width: 960px) {
    .gal-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
    .gal-main { padding-left: 24px; padding-right: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .tile, .toast { animation: none; }
    .live-dot { animation: none; }
    .tile:hover img { transform: none; }
}

/* Passwort-Gate */
.gal-lock {
    display: flex;
    justify-content: center;
    padding: 48px 20px;
}
.lock-card {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 32px 26px;
    text-align: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.lock-icon { font-size: 2rem; }
.lock-card h2 { margin: 0; font-size: 1.25rem; }
.lock-card p { margin: 0; font-size: 0.9rem; opacity: 0.75; line-height: 1.5; }
.lock-card input {
    width: 100%;
    padding: 13px 16px;
    font: inherit;
    font-size: 1rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    outline: none;
}
.lock-card input:focus { border-color: rgba(255, 255, 255, 0.55); }
.lock-submit {
    width: 100%;
    padding: 13px 16px;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #0b0c10;
    background: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.lock-submit:hover { opacity: 0.9; }
.lock-submit:disabled { opacity: 0.55; cursor: default; }
.lock-error { color: #ff9b9b; font-size: 0.85rem; margin: 0; }

/* Einzelfoto-Vorschau im Lightbox (Print-Collage) */
.lb-singles {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 82px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    pointer-events: none;
}
.lb-singles[hidden] { display: none; }
.lb-singles-title {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}
.lb-singles-strip {
    display: flex;
    gap: 8px;
    max-width: 100%;
    overflow-x: auto;
    padding: 4px;
    pointer-events: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.lb-singles-strip::-webkit-scrollbar { height: 6px; }
.lb-singles-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }
.lb-singles-chip {
    position: relative;
    flex: 0 0 auto;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: border-color 0.2s var(--transition), transform 0.2s var(--transition);
}
.lb-singles-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-singles-chip:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.6); }
.lb-singles-chip.is-active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.35); }
.lb-singles-chip .chip-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 0;
    text-align: center;
}
/* Bild Platz machen, damit der Strip nicht überlappt */
.lightbox.has-singles .lb-stage { padding-bottom: 200px; }

/* Begrüßungstext vom Veranstalter unter dem Titel */
.gal-message {
    margin: 10px auto 0;
    max-width: 600px;
    font-size: 15px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.82);
    white-space: pre-line;
}

/* Gäste-Upload */
.gal-upload {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0 auto 18px;
    padding: 0 16px;
    max-width: 1100px;
}
.gal-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #0b0c10;
    background: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.gal-upload-btn:hover { opacity: 0.9; }
.gal-upload-btn:disabled { opacity: 0.55; cursor: default; }
.gal-upload-status { font-size: 13px; color: rgba(255,255,255,0.75); }

/* ---------- Sprachgrüße (Aufnehmen & Anhören) ---------- */
.gal-audio {
    margin: 0 0 18px;
    padding: 20px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.gal-audio-title { font-size: 19px; font-weight: 700; margin-bottom: 4px; }

.gal-audio-hint {
    font-size: 13.5px;
    color: var(--text-dim);
    margin-bottom: 14px;
}

/* Liste der freigegebenen Nachrichten (audio-messages-ui.js) */
.gal-audio .audio-msg-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gal-audio .audio-msg {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.gal-audio .audio-msg audio { width: 100%; min-width: 0; }
.gal-audio .audio-msg-meta { font-size: 12.5px; color: var(--text-dim); }
.gal-audio .audio-msg-empty { font-size: 13.5px; color: var(--text-dim); }

@media (min-width: 600px) {
    .gal-audio { padding: 24px 22px; }
}
