/* ── Consenso Privacy ─────────────────────────────────────── */

#consent-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #0d0d0d;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.consent-box {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 480px;
  margin: auto;
}

.consent-logo {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #d4a843;
  text-align: center;
  margin-bottom: 20px;
}

.consent-title {
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  color: #f0f0f0;
}

.consent-subtitle {
  font-size: 0.88rem;
  color: #888;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field-group label {
  font-size: 0.82rem;
  color: #aaa;
  font-weight: 500;
}

.field-group input {
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 11px 14px;
  color: #f0f0f0;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
  width: 100%;
}

.field-group input:focus { border-color: #d4a843; }
.field-group input::placeholder { color: #555; }

.consent-check-wrap {
  margin: 20px 0;
}

.check-label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}

.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  accent-color: #d4a843;
  cursor: pointer;
}

.check-text {
  font-size: 0.82rem;
  color: #999;
  line-height: 1.55;
}

.privacy-anchor {
  color: #d4a843;
  text-decoration: underline;
}

.consent-error {
  background: rgba(220,80,80,0.15);
  border: 1px solid rgba(220,80,80,0.3);
  color: #e08080;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.consent-btn {
  width: 100%;
  padding: 14px;
  background: #d4a843;
  color: #000;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: opacity 0.2s;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.consent-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.consent-btn:not(:disabled):hover { opacity: 0.85; }

/* ── Privacy Policy Modal ─────────────────────────────────── */

.privacy-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.privacy-modal.hidden { display: none; }

.privacy-box {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 32px 28px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.privacy-box h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: #d4a843;
}

.privacy-box p {
  font-size: 0.85rem;
  color: #aaa;
  line-height: 1.6;
  margin-bottom: 12px;
}

.privacy-box a { color: #d4a843; }

.privacy-close {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #888;
  font-size: 1.1rem;
  padding: 4px 8px;
  transition: color 0.2s;
}

.privacy-close:hover { color: #fff; }

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0d0d0d;
  --surface:      #1a1a1a;
  --surface-hover:#222;
  --border:       #2a2a2a;
  --accent:       #d4a843;
  --accent-dim:   #a87d28;
  --text:         #f0f0f0;
  --text-muted:   #888;
  --radius:       10px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
a      { color: inherit; text-decoration: none; }
img    { display: block; max-width: 100%; }

/* ── Layout ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ── Site header ──────────────────────────────────────────── */
.site-header {
  text-align: center;
  padding: 60px 20px 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.logo {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.tagline {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

/* ── Gallery header ───────────────────────────────────────── */
.gallery-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.back-btn {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s;
  white-space: nowrap;
}
.back-btn:hover { color: var(--text); }

.gallery-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ── Regalo card ──────────────────────────────────────────── */
.regalo-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(135deg, #1e1800 0%, #1a1a1a 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 28px;
  transition: background 0.2s, transform 0.15s;
}
.regalo-card:hover {
  background: linear-gradient(135deg, #2a2000 0%, #222 100%);
  transform: translateY(-2px);
}

.regalo-icon  { font-size: 2rem; flex-shrink: 0; }
.regalo-info  { flex: 1; }

.regalo-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.regalo-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.regalo-arrow {
  font-size: 2rem;
  color: var(--accent);
  opacity: 0.6;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Date grid ────────────────────────────────────────────── */
.date-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.date-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.date-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.date-card-label {
  font-size: 1.2rem;
  font-weight: 600;
}

.date-card-sections {
  display: flex;
  gap: 8px;
}

.tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 20px;
}
.tag.sunset { background: rgba(212,168,67,0.15); color: var(--accent); }
.tag.night  { background: rgba(100,120,200,0.15); color: #8899dd; }

/* ── Photo section ────────────────────────────────────────── */
.photo-section { margin-bottom: 52px; }

.section-heading {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sunset-heading { color: var(--accent); }
.night-heading  { color: #8899dd; }

.empty-section { color: var(--text-muted); font-size: 0.9rem; }

/* ── Thumbnail grid ───────────────────────────────────────── */
.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
@media (min-width: 600px) {
  .thumbnail-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (min-width: 900px) {
  .thumbnail-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

.thumb-btn {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
  transition: opacity 0.15s, transform 0.15s;
}
.thumb-btn:hover { opacity: 0.85; transform: scale(1.02); }

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-touch-callout: none;
}

/* ── Lightbox ─────────────────────────────────────────────── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
}
.lightbox-overlay.hidden { display: none; }

.lb-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(0,0,0,0.85);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  height: 60px;
}
#lb-filename {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#lb-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
#lb-close {
  font-size: 1.2rem;
  color: var(--text-muted);
  padding: 4px 8px;
  transition: color 0.2s;
}
#lb-close:hover { color: var(--text); }

.lb-scroll {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 80px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.lb-slide {
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lb-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.lb-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: rgba(255,255,255,0.45);
  padding: 10px 18px;
  transition: color 0.2s, background 0.2s;
  border-radius: 4px;
  line-height: 1;
  z-index: 1010;
}
.lb-arrow:hover { color: #fff; background: rgba(255,255,255,0.1); }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }

.lb-download-bottom {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 48px;
  border-radius: 10px;
  white-space: nowrap;
  z-index: 20;
  transition: opacity 0.2s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.lb-download-bottom:hover { opacity: 0.85; }

/* ── States ───────────────────────────────────────────────── */
.state-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.error-box { color: #e06060; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Popup istruzione salvataggio ─────────────────────────── */
.save-hint-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.save-hint-overlay.hidden { display: none; }

.save-hint-card {
  background: #1a1a1a;
  border: 1px solid var(--accent);
  border-radius: 18px;
  padding: 36px 28px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.save-hint-card h3 {
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

.save-hint-card p {
  color: #aaa;
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

.save-hint-btn {
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 32px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}
.save-hint-btn:hover { opacity: 0.85; }
.save-hint-btn.hidden { display: none; }

.dl-progress-wrap {
  width: 100%;
  margin: 12px 0 4px;
  text-align: center;
}
.dl-progress-wrap.hidden { display: none; }
.dl-progress-bar {
  height: 6px;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
  margin-bottom: 6px;
}
#dl-progress-pct {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 700;
}

/* ── Mobile: nascondi frecce ──────────────────────────────── */
@media (pointer: coarse) {
  .lb-arrow { display: none; }
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .logo          { font-size: 1.8rem; }
  .gallery-title { font-size: 1.2rem; }
}

/* ── Admin: PIN overlay ───────────────────────────────────── */
#pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#pin-overlay.hidden { display: none; }

.pin-box {
  background: #1a1a1a;
  border: 1.5px solid var(--accent);
  border-radius: 18px;
  padding: 36px 28px;
  width: 280px;
  text-align: center;
}
.pin-icon  { font-size: 2rem; margin-bottom: 12px; }
.pin-title { color: var(--accent); font-weight: 700; font-size: 1.1rem; margin-bottom: 20px; letter-spacing: 0.05em; }
.pin-input {
  width: 100%;
  padding: 14px;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #fff;
  border-radius: 10px;
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: 6px;
  margin-bottom: 8px;
}
.pin-error  { color: #e05050; font-size: 13px; margin-bottom: 8px; }
.pin-error.hidden { display: none; }
.pin-confirm {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 10px;
  margin-top: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.pin-confirm:hover { opacity: 0.85; }
.pin-cancel {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: #666;
  font-size: 0.9rem;
  margin-top: 6px;
  cursor: pointer;
}

/* ── Admin: indicatore attivo ─────────────────────────────── */
#admin-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  z-index: 1500;
  letter-spacing: 0.05em;
  pointer-events: none;
}
#admin-indicator.hidden { display: none; }

/* ── Admin: foto selezionata ──────────────────────────────── */
.thumb-btn.admin-selected { outline: 3px solid var(--accent); }
.thumb-btn.admin-selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 22px;
}
.thumb-btn { position: relative; }

/* ── Admin: barra selezione ───────────────────────────────── */
#selection-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1200;
  gap: 12px;
}
#selection-bar.hidden { display: none; }
#selection-count { color: #000; font-weight: 700; font-size: 0.95rem; }
#generate-preview-btn {
  background: #000;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
#generate-preview-btn:hover { opacity: 0.85; }

/* ── Preview lightbox (canvas) ────────────────────────────── */
#preview-lightbox {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#preview-lightbox.hidden { display: none; }
#preview-lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #fff;
  font-size: 1.5rem;
  background: rgba(255,255,255,0.15);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  line-height: 40px;
  text-align: center;
  z-index: 10;
  cursor: pointer;
}
#preview-lb-canvas {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
}
.preview-lb-label {
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
  margin-top: 12px;
  text-align: center;
  padding: 0 20px;
}

/* ── Preview gallery ──────────────────────────────────────── */
.preview-header-sub {
  font-size: 0.78rem;
  color: #e05050;
  margin-top: 4px;
}
.preview-canvas-thumb {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 8px;
  cursor: pointer;
}
