/* ═══════════════════════════════════════════════════════════════
   Gallery — Public Photo Gallery
   Mobile-first, Instagram-inspired, photo-focused
═══════════════════════════════════════════════════════════════ */

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

:root {
  --bg: #0a0a0a;
  --bg-2: #111111;
  --bg-3: #1a1a1a;
  --bg-4: #222222;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.18);
  --text: #f0ede8;
  --text-2: #9a9690;
  --text-3: #5a5754;
  --accent: #e8c97e;
  --accent-dim: rgba(232,201,126,0.12);
  --red: #e85555;
  --green: #5cb85c;
  --font-body: 'DM Sans', sans-serif;
  --font-display: 'Playfair Display', serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  font-family: var(--font-body);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Gallery Header ── */
.gallery-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,10,10,0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
}
.gallery-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-dim); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.gallery-event-info { flex: 1; min-width: 0; }
.gallery-event-name {
  font-family: var(--font-display); font-size: 1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gallery-event-meta { font-size: 0.75rem; color: var(--text-2); margin-top: 1px; }
.gallery-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Event Hero ── */
.gallery-hero {
  text-align: center;
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.gallery-hero-logo {
  max-width: 200px;
  max-height: 100px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto 16px;
  object-fit: contain;
}
.gallery-hero-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.2;
}
.gallery-hero-location {
  font-size: 1rem;
  color: var(--text-2);
  margin: 0;
}

/* ── Photo count bar ── */
.gallery-count-bar {
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); font-size: 0.8rem; color: var(--text-3);
}
.gallery-live-dot {
  display: inline-flex; align-items: center; gap: 6px; color: var(--green);
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

/* ── Photo Grid ── */
.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
}
.gallery-grid::after {
  content: '';
  flex: 9999 0 0;
  height: 0;
}
.photo-thumb {
  flex-shrink: 1;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-3);
}
.photo-thumb img {
  display: block;
  width: 100%;
  transition: transform 0.3s ease;
}
.photo-thumb:hover img { transform: scale(1.04); }

/* Skeletons precisam de altura explícita pois não têm imagem */
.photo-thumb.skeleton-thumb { height: 200px; }

/* Overlay — always visible */
.photo-thumb-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 55%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 8px;
  pointer-events: none;
}
.photo-thumb-stats {
  display: flex; gap: 10px; align-items: center;
}
.thumb-stat {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.75rem; color: white; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Action buttons — always visible */
.photo-thumb-actions {
  position: absolute; top: 6px; right: 6px;
  display: flex; flex-direction: column; gap: 6px;
}
.thumb-action-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255,255,255,0.5);
  box-shadow: 0 1px 4px rgba(0,0,0,0.6);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  font-size: 15px;
}
.thumb-action-btn:active { background: rgba(255,255,255,0.2); }
.thumb-action-btn.liked { color: var(--red); border-color: var(--red); }
.thumb-action-btn.selected-print { color: var(--accent); border-color: var(--accent); }

/* Selection indicator */
.selected-indicator {
  position: absolute; top: 6px; left: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.5); transition: all var(--transition);
  font-size: 11px; color: #0a0a0a; font-weight: 700;
}
.photo-thumb.selected-for-print .selected-indicator { opacity: 1; transform: scale(1); }

/* ── Fullscreen Modal ── */
.photo-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.97);
  display: flex; flex-direction: column;
  animation: modal-in 0.25s ease;
}
.photo-modal.hidden { display: none; }
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }

.modal-top-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
}
.modal-counter { font-size: 0.82rem; color: rgba(255,255,255,0.6); }
.modal-close-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: none; color: white;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  font-size: 18px;
}
.modal-close-btn:hover { background: rgba(255,255,255,0.2); }

/* Main image area */
.modal-image-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.modal-img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  transition: opacity 0.15s ease;
}
.modal-img.loading { opacity: 0.3; }

/* Nav arrows */
.modal-nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.1); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15); color: white;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); font-size: 18px;
  z-index: 5;
}
.modal-nav-btn:hover { background: rgba(255,255,255,0.2); }
.modal-nav-prev { left: 8px; }
.modal-nav-next { right: 8px; }
@media (max-width: 480px) {
  .modal-nav-btn {
    width: 36px; height: 36px;
    font-size: 15px;
    background: rgba(0,0,0,0.45);
  }
}

/* Bottom panel */
.modal-bottom {
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 100%);
  padding: 16px;
}
.modal-actions {
  display: flex; gap: 12px; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.modal-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: white; border-radius: 12px; padding: 10px 18px; cursor: pointer;
  transition: all var(--transition); font-family: var(--font-body);
  min-width: 72px; text-decoration: none;
}
.modal-action-btn:hover { background: rgba(255,255,255,0.14); }
.modal-action-btn .btn-icon-lg { font-size: 1.2rem; }
.modal-action-btn .btn-label { font-size: 0.7rem; color: rgba(255,255,255,0.6); }
.modal-action-btn.liked .btn-icon-lg { color: var(--red); }
.modal-action-btn.selected-print { background: var(--accent-dim); border-color: var(--accent); }
.modal-action-btn.selected-print .btn-label { color: var(--accent); }

/* Comment section inside modal */
.modal-comments-section {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease;
}
.modal-comments-section.open { max-height: 340px; }
.comments-box {
  background: rgba(255,255,255,0.04); border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden; margin-top: 12px;
}
.comments-list {
  max-height: 180px; overflow-y: auto; padding: 12px;
}
.comment-item {
  display: flex; gap: 10px; margin-bottom: 10px;
}
.comment-item:last-child { margin-bottom: 0; }
.comment-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-4); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-2); flex-shrink: 0;
}
.comment-name { font-size: 0.75rem; font-weight: 600; color: #fff; }
.comment-text { font-size: 0.8rem; color: #fff; margin-top: 1px; }
.comment-time { font-size: 0.7rem; color: var(--text-3); }
.comment-input-row {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.comment-name-input, .comment-text-input {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; color: var(--text); padding: 8px 10px;
  font-family: var(--font-body); font-size: 0.82rem; outline: none;
  transition: border-color var(--transition);
}
.comment-name-input:focus, .comment-text-input:focus { border-color: var(--accent); }
.comment-name-input { width: 100px; flex-shrink: 0; }
.comment-text-input { flex: 1; }
.comment-send-btn {
  background: var(--accent); color: #0a0a0a; border: none; border-radius: 8px;
  width: 34px; flex-shrink: 0; cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.comment-send-btn:hover { background: #f0d68e; }

/* Empty states */
.gallery-empty {
  text-align: center; padding: 80px 24px; color: var(--text-2);
}
.gallery-empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.gallery-empty h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 8px; color: var(--text); }
.gallery-empty p { font-size: 0.875rem; }

/* Skeleton thumbs */
.photo-thumb.skeleton-thumb {
  flex-grow: 1.33;
  flex-basis: 266px;
  background: linear-gradient(90deg, #111 25%, #1a1a1a 50%, #111 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Print order modal */
.print-modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,0.85);
  animation: modal-in 0.25s ease;
}
.print-modal.hidden { display: none; }
.print-sheet {
  width: 100%; max-width: 500px;
  background: var(--bg-2); border-radius: 20px 20px 0 0;
  border: 1px solid var(--border); border-bottom: none;
  padding: 0 0 24px;
  animation: sheet-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
.print-sheet-handle {
  width: 36px; height: 4px; background: var(--bg-4); border-radius: 2px;
  margin: 12px auto 20px;
}
.print-sheet-header { padding: 0 24px 20px; border-bottom: 1px solid var(--border); }
.print-sheet-header h3 { font-family: var(--font-display); margin-bottom: 4px; }
.print-sheet-header p { font-size: 0.82rem; color: var(--text-2); }
.print-sheet-body { padding: 20px 24px; }
.print-selected-preview {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.print-preview-item {
  position: relative; flex-shrink: 0;
}
.print-preview-thumb {
  width: 60px; height: 60px; object-fit: cover; border-radius: 8px;
  border: 2px solid var(--accent); display: block;
}
.print-preview-remove {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); border: none; color: #fff;
  font-size: 9px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.print-selected-count { font-size: 0.82rem; color: var(--text-2); margin-bottom: 12px; }

/* Toast notification */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 24px; padding: 10px 20px;
  font-size: 0.82rem; color: var(--text); z-index: 500;
  transition: transform 0.3s ease; white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.toast-success { border-color: rgba(92,184,92,0.3); }
.toast.toast-error { border-color: rgba(232,85,85,0.3); }

/* Swipe hint */
.swipe-hint {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
  font-size: 0.72rem; color: rgba(255,255,255,0.25);
  animation: fade-hint 3s ease forwards;
  pointer-events: none;
}
@keyframes fade-hint { 0%,50% { opacity: 1; } 100% { opacity: 0; } }

/* Load more */
.load-more-area { padding: 24px; text-align: center; }

/* ── FABs base ── */
.face-fab,
.whatsapp-fab {
  position: fixed;
  bottom: 20px;
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 100;
  transition: transform var(--transition), box-shadow var(--transition);
}
.face-fab:hover,
.whatsapp-fab:hover { transform: scale(1.05); box-shadow: 0 6px 28px rgba(0,0,0,0.6); }

/* ── Face Recognition FAB — pílula vertical com label ── */
.face-fab {
  left: 20px;
  height: auto;
  width: auto;
  flex-direction: column;
  border-radius: 14px;
  padding: 10px 12px 9px;
  gap: 5px;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
  text-align: center;
}
.face-fab-label { pointer-events: none; }

/* ── WhatsApp FAB — círculo ── */
.whatsapp-fab {
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  text-decoration: none;
}

@media (max-width: 480px) {
  .face-fab, .whatsapp-fab {
    bottom: 16px;
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }
  .face-fab  { left: 16px; padding: 8px 10px 7px; gap: 4px; font-size: 0.65rem; }
  .whatsapp-fab { right: 16px; width: 46px; height: 46px; }
}

.face-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--accent-dim);
  border-bottom: 1px solid rgba(232,201,126,0.25);
  font-size: 0.82rem;
  color: var(--accent);
}
.face-filter-bar button {
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity var(--transition);
}
.face-filter-bar button:hover { opacity: 0.85; }

.face-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.face-modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 380px;
  overflow: hidden;
}
.face-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.face-modal-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0;
}
.face-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-3);
  border: none;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.face-camera-wrap {
  position: relative;
  background: #000;
  aspect-ratio: 4/3;
  overflow: hidden;
}
.face-camera-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.face-oval-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52%;
  aspect-ratio: 3/4;
  border: 2.5px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.4);
}
.face-status-text {
  text-align: center;
  padding: 12px 20px 4px;
  font-size: 0.8rem;
  color: var(--text-2);
  margin: 0;
  min-height: 38px;
}
.face-capture-btn {
  display: block;
  width: calc(100% - 40px);
  margin: 10px 20px 20px;
  padding: 13px;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity var(--transition);
}
.face-capture-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.face-progress-section {
  padding: 28px 24px 32px;
  gap: 14px;
}
.face-progress-bar-bg {
  height: 4px;
  background: var(--bg-4);
  border-radius: 2px;
  overflow: hidden;
}
.face-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.25s ease;
  width: 0%;
}
