:root {
  --bg: #F9F9F9;
  --text: #222;
  --muted: #6b7280;
  --primary: #A9B1B9;
  --primary-dark: #8f98a2;
  --outline: #cfd6dd;
  --danger: #d9534f;
  --success: #22c55e;
  --success-dark: #16a34a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }

.app-header { display: flex; justify-content: center; align-items: center; padding: 24px 16px; }
.logo-bv { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 28px; color: var(--primary-dark); letter-spacing: 2px; }
.logo-bv span { color: var(--muted); }

main { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }
.title { font-family: 'Playfair Display', serif; font-weight: 600; text-align: center; line-height: 1.3; }
.subtitle { font-family: 'Playfair Display', serif; font-weight: 600; }
.muted { color: var(--muted); }

.cta { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: none; border-radius: 10px; padding: 12px 16px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--outline); color: var(--text); }
.btn-outline:hover { background: #fff; }
.btn-text { background: transparent; color: var(--muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-heart { background: #fff; border: 1px solid var(--outline); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); }

/* Inputs de arquivo: ocultos visualmente, mas clicáveis via label */
.file-input-hidden {
  position: absolute;
  left: -9999px;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
}

.section-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.section-toolbar .btn { padding: 8px 12px; }

.view { display: none; }
.view.active { display: block; }

.card { background: #fff; border: 1px solid var(--outline); border-radius: 12px; padding: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 14px; }
.field input[type="text"], .field input[type="password"] { border: 1px solid var(--outline); border-radius: 10px; padding: 10px; font-size: 16px; }

/* Upload UI */
.upload-form { display: grid; gap: 12px; }
.dropzone { border: 2px dashed var(--outline); border-radius: 12px; padding: 16px; background: #fafafa; display: grid; gap: 10px; justify-items: center; text-align: center; }
.dropzone.dragover { background: #f0f0f0; border-color: var(--primary); }
.dz-text { color: var(--muted); font-size: 14px; }
.dz-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.upload-preview { display: grid; gap: 8px; }
.upload-preview-header { display: flex; justify-content: space-between; align-items: center; }
.upload-actions { display: flex; gap: 8px; }
/* Oculta botão manual de enviar (upload agora é automático) */
#start-upload { display: none !important; }
.upload-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (max-width: 600px) { .upload-preview-grid { grid-template-columns: repeat(2, 1fr); } }
.preview-item { position: relative; background: #fff; border: 1px solid var(--outline); border-radius: 8px; overflow: hidden; }
.preview-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.preview-meta { display: flex; justify-content: space-between; align-items: center; padding: 6px; font-size: 12px; }
.preview-remove { position: absolute; top: 6px; right: 6px; background: rgba(255,255,255,0.95); border: 1px solid var(--outline); border-radius: 999px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.preview-progress { height: 4px; background: #eee; }
.preview-progress > div { height: 100%; width: 0%; background: var(--primary); transition: width 0.25s ease; }

.upload-result { display: grid; gap: 8px; }
.uploaded-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (max-width: 600px) { .uploaded-grid { grid-template-columns: repeat(2, 1fr); } }
.uploaded-item { position: relative; background: #fff; border: 1px solid var(--outline); border-radius: 8px; overflow: hidden; }
.uploaded-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; animation: fadeIn 0.4s ease; }
.uploaded-actions { position: absolute; bottom: 6px; right: 6px; display: flex; gap: 6px; }
.uploaded-actions .btn { padding: 6px 10px; font-size: 12px; }

.gallery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (max-width: 480px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
.gallery-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; background: #eee; }
.gallery-tile { position: relative; }
.gallery-like { position: absolute; bottom: 6px; right: 6px; background: rgba(255,255,255,0.9); border-radius: 999px; padding: 4px 8px; font-size: 12px; }

.gallery-pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 8px; }
.gallery-pagination .btn { padding: 8px 12px; }
.page-indicator { color: var(--muted); }
.page-chip { background: #fff; border: 1px solid var(--outline); border-radius: 999px; padding: 6px 10px; font-size: 12px; }

.load-more { text-align: center; color: var(--muted); padding: 12px; }

.viewer { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: grid; place-items: center; }
.viewer[hidden] { display: none !important; }
.viewer-inner { background: #fff; border-radius: 12px; max-width: 90vw; max-height: 90vh; display: grid; grid-template-rows: auto auto; overflow: hidden; }
.viewer-inner img { width: 90vw; max-height: 70vh; object-fit: contain; background: #000; }
.viewer-meta { padding: 10px; display: grid; gap: 8px; }
.viewer-actions { display: flex; gap: 8px; }

.admin-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.moderation-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.moderation-item { background: #fff; border: 1px solid var(--outline); border-radius: 8px; padding: 8px; display: grid; gap: 6px; }
.moderation-item img { width: 100%; border-radius: 6px; }

.app-footer { text-align: center; padding: 16px; }

/* Animações sutis para experiência do casamento */
@keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.35); } 100% { box-shadow: 0 0 0 12px rgba(34,197,94,0); } }
@keyframes floatHeart { 0% { transform: translateY(20px) scale(0.6); opacity: 0; } 100% { transform: translateY(-120px) scale(1.2); opacity: 1; } }

.app-enter { animation: fadeIn 0.6s ease; }
.dropzone.dragover { animation: pulseGlow 1.2s ease-out infinite; }
.uploading-chip { animation: pulseGlow 1.2s ease-out infinite; }

/* Celebração ao enviar fotos */
.celebration { position: fixed; inset: 0; pointer-events: none; display: grid; place-items: center; }
.celebration[hidden] { display: none; }
.celebration .heart { width: 24px; height: 24px; color: #e11d48; }
.celebration .heart { animation: floatHeart 1.8s ease forwards; position: absolute; }

/* Separadores da galeria (ocupam todas as colunas da grid) */
.section-divider { grid-column: 1 / -1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0; }
.section-chip { background: #fff; border: 1px solid var(--outline); color: var(--muted); border-radius: 999px; padding: 6px 10px; font-size: 12px; }