/* ══════════════════════════════════════════════════════
   PBG Gallery – Frontend Styles
   ══════════════════════════════════════════════════════ */

:root {
  --pbg-bg:       #0e0e0e;
  --pbg-surface:  #181818;
  --pbg-border:   #2a2a2a;
  --pbg-text:     #f0f0f0;
  --pbg-text2:    #888;
  --pbg-text3:    #444;
  --pbg-accent:   #e63946;
  --pbg-wa:       #25d366;
  --pbg-radius:   10px;
}

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

#pbg {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--pbg-bg);
  color: var(--pbg-text);
  min-height: 100vh;
  position: relative;
}

.pbg-screen { width: 100%; }

/* ── CODE-EINGABE ─────────────────────────────────────────────────── */
#pbg-code-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.pbg-code-card {
  background: var(--pbg-surface);
  border: 1px solid var(--pbg-border);
  border-radius: 18px;
  padding: 48px 40px;
  max-width: 400px; width: 100%;
  text-align: center;
}

.pbg-code-logo { height: 52px; width: auto; margin: 0 auto 24px; display: block; }
.pbg-code-logo-placeholder {
  width: 64px; height: 64px; background: var(--pbg-accent);
  border-radius: 14px; margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}

.pbg-code-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.pbg-code-desc  { font-size: 14px; color: var(--pbg-text2); line-height: 1.6; margin-bottom: 28px; }

.pbg-code-input {
  width: 100%; padding: 14px;
  font-size: 22px; font-weight: 700;
  letter-spacing: 5px; text-align: center; text-transform: uppercase;
  background: var(--pbg-bg); border: 2px solid var(--pbg-border);
  border-radius: 10px; color: var(--pbg-text); outline: none;
  transition: border-color .2s;
}
.pbg-code-input:focus  { border-color: var(--pbg-accent); }
.pbg-code-input.error  { border-color: var(--pbg-accent); }
.pbg-code-input::placeholder {
  letter-spacing: 2px; color: var(--pbg-text3); font-size: 15px; font-weight: 400;
}

.pbg-code-msg {
  margin-top: 10px; padding: 10px 14px;
  border-radius: 8px; font-size: 13px; text-align: left; line-height: 1.5;
}
.pbg-msg-error   { background: rgba(230,57,70,.1);   border: 1px solid rgba(230,57,70,.3);   color: var(--pbg-accent); }
.pbg-msg-blocked { background: rgba(233,196,106,.08); border: 1px solid rgba(233,196,106,.3); color: #e9c46a; }

.pbg-code-btn {
  margin-top: 14px; width: 100%; padding: 14px;
  background: var(--pbg-accent); border: none; border-radius: 10px;
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity .15s;
}
.pbg-code-btn:hover   { opacity: .87; }
.pbg-code-btn:disabled { opacity: .5; cursor: not-allowed; }

.pbg-code-hint { margin-top: 14px; font-size: 11px; color: var(--pbg-text3); }

/* ── GALERIE LAYOUT ───────────────────────────────────────────────── */
#pbg-gallery-screen {
  display: flex; flex-direction: column;
  height: 100vh;
}

/* Header */
.pbg-header {
  flex-shrink: 0;
  background: var(--pbg-surface); border-bottom: 1px solid var(--pbg-border);
  padding: 10px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.pbg-header-logo {
  display: flex; align-items: center; text-decoration: none;
}
.pbg-logo-img  { height: 36px; width: auto; }
.pbg-logo-text { font-size: 15px; font-weight: 700; color: var(--pbg-text); }

.pbg-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.pbg-event-info { font-size: 11px; color: var(--pbg-text2); }

.pbg-code-badge {
  font-size: 11px; padding: 3px 10px; border-radius: 12px;
  background: rgba(100,200,180,.1); border: 1px solid rgba(100,200,180,.3); color: #64c8b4;
}

/* Upload-Hinweis */
.pbg-upload-notice {
  flex-shrink: 0;
  background: var(--pbg-surface); border-bottom: 1px solid var(--pbg-border);
  padding: 8px 18px; display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--pbg-text2);
}
.pbg-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--pbg-border); border-top-color: #e9c46a;
  animation: pbg-spin .8s linear infinite; flex-shrink: 0;
}
@keyframes pbg-spin { to { transform: rotate(360deg); } }

/* CTA Banner */
.pbg-cta-banner {
  flex-shrink: 0;
  background: linear-gradient(135deg, #ff6b00, #e63946);
  padding: 9px 18px;
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex-wrap: wrap;
}
.pbg-cta-text { font-size: 13px; font-weight: 600; color: #fff; }
.pbg-cta-btn  {
  background: #fff; color: var(--pbg-accent);
  padding: 6px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 700; text-decoration: none;
  white-space: nowrap; transition: opacity .15s;
}
.pbg-cta-btn:hover { opacity: .88; }

/* Viewer */
.pbg-viewer {
  flex: 1; min-height: 0;
  position: relative; display: flex;
  align-items: center; justify-content: center;
  background: var(--pbg-bg);
  user-select: none; touch-action: pan-y;
}

.pbg-photo-wrap {
  max-width: calc(100% - 100px);
  max-height: 100%;
  display: flex; align-items: center; justify-content: center;
}

.pbg-photo {
  border-radius: 6px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--pbg-border);
}
.pbg-photo img, .pbg-photo video {
  max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
  border-radius: 6px;
}
.pbg-photo.landscape { width: min(700px, calc(100% - 100px)); aspect-ratio: 3/2; }
.pbg-photo.portrait  { height: min(90%, 100%); aspect-ratio: 1/2.6; width: auto; }
.pbg-photo.square    { width: min(500px, calc(100% - 100px)); aspect-ratio: 1/1; }

/* Pfeile */
.pbg-arr {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: var(--pbg-text); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px); transition: background .15s; z-index: 5;
}
.pbg-arr:hover { background: rgba(255,255,255,.18); }
.pbg-arr-l { left: 14px; }
.pbg-arr-r { right: 14px; }

/* Viewer-Bar */
.pbg-viewer-bar {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 5;
}
.pbg-counter {
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  border-radius: 20px; padding: 5px 14px; font-size: 12px; color: #ccc;
}
.pbg-all-btn {
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.15); border-radius: 20px;
  padding: 5px 14px; font-size: 12px; color: #ccc; cursor: pointer;
  transition: background .15s;
}
.pbg-all-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

/* Aktionsleiste */
.pbg-actions {
  flex-shrink: 0;
  background: var(--pbg-surface); border-top: 1px solid var(--pbg-border);
  padding: 10px 18px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pbg-actions-right { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.pbg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: all .15s; border: 1px solid var(--pbg-border);
}
.pbg-btn-wa {
  background: var(--pbg-wa); border-color: var(--pbg-wa); color: #fff;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 3px 10px rgba(37,211,102,.35);
}
.pbg-btn-wa:hover { opacity: .88; }
.pbg-btn-sec {
  background: var(--pbg-bg); color: var(--pbg-text2); border: none;
}
.pbg-btn-sec:hover { color: var(--pbg-text); background: var(--pbg-border); }

/* ── GRID-OVERLAY ─────────────────────────────────────────────────── */
.pbg-grid-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--pbg-bg);
  display: flex; flex-direction: column;
}

.pbg-grid-header {
  flex-shrink: 0;
  padding: 12px 18px;
  background: var(--pbg-surface); border-bottom: 1px solid var(--pbg-border);
  display: flex; align-items: center; justify-content: space-between;
}
.pbg-grid-title { font-size: 14px; font-weight: 700; }
.pbg-grid-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--pbg-border); border: none;
  color: var(--pbg-text); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pbg-grid-close:hover { background: var(--pbg-text3); }

.pbg-grid-scroll { flex: 1; overflow-y: auto; padding: 14px; }

.pbg-grid-inner { columns: 4; column-gap: 8px; }
@media (max-width: 800px) { .pbg-grid-inner { columns: 3; } }
@media (max-width: 500px) { .pbg-grid-inner { columns: 2; } }

.pbg-gi {
  break-inside: avoid; margin-bottom: 8px;
  border-radius: 8px; overflow: hidden;
  cursor: pointer; border: 2px solid transparent;
  position: relative; opacity: .75;
  transition: border-color .15s, opacity .15s, transform .15s;
}
.pbg-gi:hover        { opacity: 1; transform: translateY(-1px); border-color: rgba(255,255,255,.2); }
.pbg-gi.active       { opacity: 1; border-color: var(--pbg-accent); }
.pbg-gi img, .pbg-gi video { width: 100%; display: block; }
.pbg-gi .pbg-gi-img  { width: 100%; background: var(--pbg-border); }
.pbg-gi .pbg-gi-img.land { aspect-ratio: 3/2; }
.pbg-gi .pbg-gi-img.port { aspect-ratio: 1/2.6; }

.pbg-gi-tag {
  position: absolute; bottom: 5px; left: 5px;
  background: rgba(0,0,0,.65); border-radius: 4px;
  padding: 2px 6px; font-size: 9px; font-weight: 700;
}
.pbg-gi-tag.gif { color: #64c8b4; }
.pbg-gi-tag.mp4 { color: #e9c46a; }

/* ── FLOATING BUTTON ──────────────────────────────────────────────── */
.pbg-float-btn {
  position: fixed; bottom: 80px; right: 18px; z-index: 150;
  display: flex; align-items: center; gap: 8px;
  padding: 13px 20px; border-radius: 50px;
  background: linear-gradient(135deg, #ff6b00, #e63946);
  box-shadow: 0 6px 24px rgba(230,57,70,.5);
  color: #fff; font-size: 14px; font-weight: 700;
  text-decoration: none; transition: transform .15s, box-shadow .15s;
  white-space: nowrap;
}
.pbg-float-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(230,57,70,.65); }

/* ── PLAY ICON ────────────────────────────────────────────────────── */
.pbg-play-icon {
  position: absolute; font-size: 40px; opacity: .8;
  pointer-events: none; z-index: 1;
}

/* ── LOADING ──────────────────────────────────────────────────────── */
.pbg-loading {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-height: 200px;
  color: var(--pbg-text2); font-size: 14px; gap: 10px;
}

/* ── RESPONSIVE ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .pbg-code-card   { padding: 32px 22px; }
  .pbg-code-input  { font-size: 18px; }
  .pbg-arr         { width: 32px; height: 32px; font-size: 15px; }
  .pbg-arr-l       { left: 6px; }
  .pbg-arr-r       { right: 6px; }
  .pbg-photo-wrap  { max-width: calc(100% - 80px); }
  .pbg-actions     { padding: 8px 12px; gap: 6px; }
  .pbg-btn-wa      { font-size: 13px; padding: 9px 12px; }
  .pbg-actions-right { margin-left: 0; width: 100%; justify-content: flex-end; }
  .pbg-float-btn   { bottom: 70px; right: 12px; padding: 11px 16px; font-size: 13px; }
}
