/* ══════════════════════════════════════════════════════
   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-gold:     #d4af37;
  --pbg-wa:       #25d366;
  --pbg-radius:   10px;
}

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

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

.pbg-screen { width: 100%; }

/* ── CODE-EINGABE ─────────────────────────────────────────────────── */
#pbg-code-screen {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  position: relative;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,102,0,.16), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(212,175,55,.13), transparent 35%),
    radial-gradient(circle at 50% 90%, rgba(255,102,0,.10), transparent 45%),
    var(--pbg-bg);
}

#pbg-code-screen .pbg-top-logo-chip {
  position: absolute; top: 20px; left: 24px;
  background: #fff; border-radius: 12px;
  padding: 9px 14px;
  display: flex; align-items: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
#pbg-code-screen .pbg-top-logo { height: 48px; display: block; }

#pbg-code-screen .pbg-code-content {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px 20px; width: 100%;
}
#pbg-code-screen .pbg-code-wrap { max-width: 520px; width: 100%; display: flex; flex-direction: column; align-items: center; }

#pbg-code-screen .pbg-code-card {
  background: var(--pbg-surface);
  border: 1px solid var(--pbg-border);
  border-top: 4px solid transparent;
  border-image: linear-gradient(90deg, var(--pbg-accent), var(--pbg-gold)) 1;
  border-radius: 18px;
  padding: 44px 36px 36px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

#pbg-code-screen .pbg-code-title { font-size: 22px; font-weight: 800; margin-bottom: 10px; line-height: 1.3; }
#pbg-code-screen .pbg-code-desc  { font-size: 14px; color: var(--pbg-text2); line-height: 1.6; margin-bottom: 26px; }

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

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

#pbg-code-screen .pbg-attempts-left { display: block; font-size: 11px; color: var(--pbg-text3); margin-top: 8px; }

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

/* Kurz-Erklärung unter der Karte */
#pbg-code-screen .pbg-code-features-wrap { margin-top: 28px; width: 100%; }
#pbg-code-screen .pbg-code-features { display: flex; flex-direction: row; gap: 10px; width: 100%; }
#pbg-code-screen .pbg-code-feature {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--pbg-text2); text-align: center;
  background: rgba(255,255,255,.03); border: 1px solid var(--pbg-border);
  border-radius: 10px; padding: 18px 14px;
}
#pbg-code-screen .pbg-feature-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pbg-accent), var(--pbg-gold));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
#pbg-code-screen .pbg-feature-icon svg { width: 20px; height: 20px; }
#pbg-code-screen .pbg-code-feature-hint { font-size: 12px; color: var(--pbg-text2); text-align: center; margin-top: 12px; width: 100%; }

#pbg-code-screen .pbg-code-rent-cta {
  display: block; margin-top: 70px; padding: 14px 18px;
  border-radius: 12px; text-decoration: none; text-align: center;
  background: linear-gradient(90deg, var(--pbg-accent), var(--pbg-gold));
  color: #fff; font-size: 16px;
  width: 100%;
  box-shadow: 0 8px 24px rgba(255,102,0,.25);
  transition: opacity .15s;
}
#pbg-code-screen .pbg-code-rent-cta:hover { opacity: .9; }
#pbg-code-screen .pbg-code-rent-cta strong { display: block; margin-top: 4px; font-size: 18px; }

/* Footer (Code-Screen) */
#pbg-code-screen .pbg-footer {
  width: 100%; max-width: 420px;
  margin-top: 40px; padding: 16px 10px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 12px; color: var(--pbg-text2);
}
#pbg-code-screen .pbg-footer-links a { color: var(--pbg-text2); text-decoration: none; }
#pbg-code-screen .pbg-footer-links a:hover { color: var(--pbg-text); }
#pbg-code-screen .pbg-footer-sep { margin: 0 5px; opacity: .5; }
#pbg-code-screen .pbg-footer-social { display: flex; gap: 12px; }
#pbg-code-screen .pbg-footer-social a {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  color: #fff; text-decoration: none;
  transition: transform .15s;
}
#pbg-code-screen .pbg-footer-social a:hover { transform: translateY(-2px); }
#pbg-code-screen .pbg-fs-ig { background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
#pbg-code-screen .pbg-fs-fb { background: #1877f2; }
#pbg-code-screen .pbg-fs-wa { background: #25d366; }
#pbg-code-screen .pbg-fs-ph { background: var(--pbg-accent); }
#pbg-code-screen .pbg-fs-tg { background: #229ED9; }
#pbg-code-screen .pbg-fs-em { background: #6b7280; }

/* ── GALERIE LAYOUT ───────────────────────────────────────────────── */
#pbg-gallery-screen {
  display: flex; flex-direction: column;
  position: fixed; inset: 0;
  overflow: hidden;
}

/* Header */
.pbg-header {
  flex-shrink: 0; height: 52px;
  background: #111; border-bottom: 1px solid #222;
  padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pbg-header-logo {
  display: flex; align-items: center; text-decoration: none; gap: 10px;
}
.pbg-logo-img  { height: 34px; width: auto; }
.pbg-logo-text { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -.2px; }

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

.pbg-upload-progress {
  font-size: 11px; padding: 3px 10px; border-radius: 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  color: var(--pbg-text2); white-space: nowrap;
}
.pbg-upload-progress.done {
  background: rgba(100,200,180,.1); border-color: rgba(100,200,180,.3); color: #64c8b4;
}

.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(90deg, var(--pbg-accent), var(--pbg-gold));
  padding: 10px 20px;
  display: flex; align-items: center; justify-content: center;
  gap: 16px; flex-wrap: wrap;
}
.pbg-cta-text { font-size: 14px; font-weight: 600; color: #fff; }
.pbg-cta-btn  {
  background: #fff; color: var(--pbg-accent);
  padding: 7px 18px; border-radius: 20px;
  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 {
  height: 100%;
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 10px 50px;
}

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

/* 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; }

/* WhatsApp-Leiste (Session-Code) */
.pbg-wa-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--pbg-wa); color: #fff;
  padding: 11px 18px; font-size: 14px; font-weight: 700;
  text-decoration: none; flex-shrink: 0;
  box-shadow: 0 -2px 8px rgba(37,211,102,.25);
}
.pbg-wa-bar:hover { opacity: .9; }

/* Aktionsleiste */
.pbg-actions {
  flex-shrink: 0;
  background: var(--pbg-surface); border-top: 1px solid var(--pbg-border);
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}

.pbg-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 24px; border-radius: 50px; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: all .15s; border: none; line-height: 1;
}
.pbg-btn-primary {
  background: linear-gradient(90deg, #ff6b00, #e63946); color: #fff;
  box-shadow: 0 3px 12px rgba(230,57,70,.5);
}
.pbg-btn-primary:hover { opacity: .88; }
.pbg-btn-sec {
  background: #252525; color: #ccc;
}
.pbg-btn-sec:hover { color: #fff; background: #333; }

/* ── 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 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 800px) { .pbg-grid-inner { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .pbg-grid-inner { grid-template-columns: repeat(2, 1fr); } }

.pbg-gi {
  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; object-fit: cover; }
.pbg-gi .pbg-gi-img.port { aspect-ratio: 3/4; object-fit: cover; }

.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: 72px; right: 20px; z-index: 300;
  display: flex; align-items: center; gap: 8px;
  padding: 13px 24px; border-radius: 50px;
  background: linear-gradient(90deg, var(--pbg-accent), var(--pbg-gold));
  box-shadow: 0 4px 20px rgba(230,57,70,.4);
  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 8px 28px rgba(230,57,70,.75); }

/* ── 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;
}

/* ── EMPTY STATE ──────────────────────────────────────────────────── */
.pbg-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  gap: 14px; padding: 40px 24px; text-align: center;
}
.pbg-empty-icon {
  font-size: 72px; opacity: .25; line-height: 1;
}
.pbg-empty-title {
  font-size: 22px; font-weight: 600; color: var(--pbg-text);
  opacity: .6;
}
.pbg-empty-sub {
  font-size: 14px; color: var(--pbg-text2); max-width: 360px; line-height: 1.6;
}
.pbg-empty-spinner {
  margin-top: 8px;
}

/* ── 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; }
}
@media (max-width: 768px) {
  .pbg-float-btn { display: none !important; }
}

/* ── ADMIN-MODUS ──────────────────────────────────────────────────── */
.pbg-admin-toolbar {
  display: flex; align-items: center; gap: 10px; flex: 1; justify-content: center;
}
.pbg-admin-sel-all-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--pbg-text3); cursor: pointer; user-select: none;
}
.pbg-admin-sel-all-label input { accent-color: var(--pbg-accent); cursor: pointer; }
.pbg-admin-count {
  font-size: 13px; color: var(--pbg-text3);
}
.pbg-admin-delete-btn {
  padding: 6px 14px; border-radius: 6px; border: none; cursor: pointer;
  background: #e63946; color: #fff; font-size: 13px; font-weight: 700;
  transition: background .15s, opacity .15s;
}
.pbg-admin-delete-btn:disabled { opacity: .4; cursor: not-allowed; }
.pbg-admin-delete-btn:not(:disabled):hover { background: #c1121f; }

.pbg-gi-label {
  display: block; cursor: pointer; position: relative;
}
.pbg-gi-label input[type="checkbox"] {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 18px; height: 18px; cursor: pointer;
  accent-color: var(--pbg-accent);
}
.pbg-gi.pbg-gi-checked {
  border-color: var(--pbg-accent); opacity: 1;
}
.pbg-gi.pbg-gi-admin:hover { border-color: rgba(255,255,255,.3); }
