/* Digital Guestbook - Birthday style */
:root {
  --color-primary: #c45c3e;
  --color-primary-hover: #a84a30;
  --color-primary-rgb: 196, 92, 62;
  --color-bg: #fef8f3;
  --color-card: #fffef9;
  --color-gold: #d4a84b;
  --color-gold-light: #f5e6c8;
  --color-text: #2d2a26;
  --color-text-muted: #6b6560;
  --color-border: #e8e4e0;
  /* Semantic colors - always fixed for clear action/status meaning */
  --color-semantic-success: #2d7d46;
  --color-semantic-success-hover: #248a3d;
  --color-semantic-warning: #c9a227;
  --color-semantic-warning-hover: #b08a1f;
  --color-semantic-danger: #c53030;
  --color-semantic-danger-hover: #9b2525;
  --color-status-pending-bg: #fef3c7;
  --color-status-pending: #92400e;
  --color-status-approved-bg: #d1fae5;
  --color-status-approved: #065f46;
  --color-status-hidden-bg: #e5e7eb;
  --color-status-hidden: #4b5563;
  --font-sans: 'Quicksand', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

body.birthday-theme {
  background: linear-gradient(180deg, var(--color-bg-tint-1, #fdf5f0) 0%, var(--color-bg-tint-2, #fef8f3) 25%, var(--color-bg-tint-3, #fdf0e6) 60%, var(--color-bg-tint-2, #fef8f3) 100%);
  background-attachment: fixed;
  position: relative;
}

/* Decorations - fissate al viewport, sempre visibili durante lo scroll */
.decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/* Contenuto sopra le decorazioni */
.content-layer {
  position: relative;
  z-index: 1;
}

.confetti {
  position: absolute;
  inset: 0;
}

.confetti span {
  position: absolute;
  top: -60vh;
  animation: confetti-fall linear infinite;
  opacity: 0.8;
}

.confetti span.round {
  border-radius: 50%;
}

.confetti span.square {
  border-radius: 2px;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0.8; }
  100% { transform: translateY(170vh) rotate(720deg); opacity: 0; }
}

/* Floating balloons & ribbons */
.balloons {
  position: absolute;
  inset: 0;
}

.balloons .balloon {
  position: absolute;
  font-size: 1.5rem;
  animation: balloon-float 8s ease-in-out infinite;
  opacity: 0.6;
}

.balloons .balloon:nth-child(1) { left: 8%; top: 20%; animation-delay: 0s; }
.balloons .balloon:nth-child(2) { left: 25%; top: 60%; animation-delay: 1.5s; }
.balloons .balloon:nth-child(3) { left: 85%; top: 30%; animation-delay: 0.5s; }
.balloons .balloon:nth-child(4) { left: 15%; top: 75%; animation-delay: 2s; }
.balloons .balloon:nth-child(5) { left: 70%; top: 15%; animation-delay: 1s; }
.balloons .balloon:nth-child(6) { left: 50%; top: 85%; animation-delay: 2.5s; }
.balloons .balloon:nth-child(7) { left: 92%; top: 70%; animation-delay: 0.8s; }

@keyframes balloon-float {
  0%, 100% { transform: translateY(0) translateX(0); }
  25% { transform: translateY(-15px) translateX(10px); }
  50% { transform: translateY(-5px) translateX(-8px); }
  75% { transform: translateY(-20px) translateX(5px); }
}

/* Header - integrato nel gradiente di pagina, senza stacco */
.header {
  background: transparent;
  color: var(--color-text);
  padding: 2rem 1rem;
  text-align: center;
  min-height: 180px;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.header-birthday {
  position: relative;
}

.header-profile-pic-link {
  display: inline-block;
  cursor: pointer;
  margin-bottom: 1rem;
  padding: 5px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #f093fb, #f5576c, #4facfe, #00f2fe, #43e97b, #38f9d7, #fa709a, #fee140, #f093fb);
  box-shadow: var(--shadow);
}
.header-profile-pic-link:hover .header-profile-pic {
  opacity: 0.9;
}
.header-profile-pic {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0;
  transition: opacity 0.2s;
}

.header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--color-primary);
}

.header .description {
  margin: 0 0 1.5rem;
  color: var(--color-text-muted);
  font-size: 1rem;
}

.lang-switcher {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.lang-switcher .lang-link {
  color: var(--color-text-muted);
  text-decoration: none;
}
.lang-switcher .lang-link:hover { color: var(--color-primary); }
.lang-switcher .lang-link.active { color: var(--color-primary); font-weight: 600; }
.lang-switcher .lang-sep { color: var(--color-border); margin: 0 0.25rem; }

.header-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.header-small .header-actions { display: none; }

.back-link {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.back-link:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: white;
  color: var(--color-primary);
}

.btn-primary:hover {
  background: rgba(255,255,255,0.95);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.5);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.3);
}

.btn-success {
  background: var(--color-semantic-success) !important;
  color: white !important;
  pointer-events: none;
}

.btn-slideshow {
  background: var(--color-primary);
  color: white;
}

.btn-slideshow:hover {
  background: var(--color-primary-hover);
}

.btn-lg {
  padding: 0.9rem 2rem;
  font-size: 1.1rem;
}

.btn:disabled {
  opacity: 0.6;
}

/* Loading state - spinner */
.btn-loading {
  pointer-events: none;
  position: relative;
}
.btn .btn-spinner {
  display: none;
  margin-right: 0.5em;
  vertical-align: middle;
}
.btn-loading .btn-spinner {
  display: inline-block;
}
  cursor: not-allowed;
}

/* Main */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  position: relative;
  z-index: 1;
}

.main-form {
  max-width: 500px;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
}

.search-input,
.filter-select,
.sort-select,
.toolbar .btn-slideshow,
.toolbar .btn-share {
  height: 2.5rem;
  box-sizing: border-box;
}

.search-input {
  flex: 1;
  min-width: 120px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.95rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.filter-select,
.sort-select {
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.95rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6560' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.filter-select:focus,
.sort-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.filter-switcher {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  height: 2.5rem;
  padding: 0 0.85rem;
  box-sizing: border-box;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-card);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.filter-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.filter-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.filter-btn.active:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

@media (min-width: 600px) {
  .filter-switcher { display: flex; }
  .filter-select-mobile { display: none !important; }
}

.toolbar .btn-slideshow {
  padding: 0 1.2rem;
}

.toolbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.share-dropdown {
  position: relative;
}

.share-dropdown .btn-share {
  padding: 0 1rem;
}

.share-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.35rem;
  background: var(--color-card);
  border-radius: 8px;
  box-shadow: var(--shadow-hover);
  padding: 0.35rem;
  min-width: 160px;
  z-index: 50;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--color-text);
  font-family: inherit;
}

.share-option:hover {
  background: var(--color-bg);
}

.share-menu a.share-option {
  text-decoration: none;
  color: inherit;
}

/* Posts grid - masonry layout */
.posts-grid {
  column-gap: 1.25rem;
  column-count: 1;
}

.post-card {
  break-inside: avoid;
  margin-bottom: 1.25rem;
  background: var(--color-card);
  border-radius: 0;
  padding: 1.25rem 1.25rem 1.75rem;
  box-shadow: 2px 4px 8px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s, transform 0.2s;
}

.post-card:hover {
  box-shadow: 3px 6px 12px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.post-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.post-from {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.post-name {
  font-size: 1.1rem;
}

.post-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.post-message {
  margin: 0 0 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Audio-only card: stesso respiro di single-media */
.post-card--audio-only .post-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
}

.post-card--audio-only .post-message {
  margin-bottom: 1rem;
}

.post-card--audio-only .post-media {
  margin-top: 0.5rem;
}

.post-media {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Single media (audio or video): layout compatto ma con respiro */
.post-card--single-media .post-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
}

.post-card--single-media .post-message {
  margin-bottom: 1rem;
}

.post-card--single-media .post-media {
  margin-top: 0.5rem;
}

.post-card--single-media .post-media .media-item {
  line-height: 0;
}

/* Player singolo audio: altezza compatta (override default browser ~150px) */
.post-media--count-1 .media-item audio {
  height: 54px !important;
  min-height: 54px !important;
  max-height: none !important;
  display: block;
}

/* Video singolo: mantieni proporzioni, non schiacciare */
.post-media--count-1 .media-item video {
  width: 100%;
  min-height: 180px;
  max-height: 360px;
  object-fit: contain;
  display: block;
}

/* Audio-only: player full width, compact spacing */
.post-media--audio-only {
  grid-template-columns: 1fr;
  grid-auto-rows: min-content;
  gap: 0;
}

.post-media--audio-only .media-item,
.post-media--audio-only .media-item.media-audio {
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

/* Same compact layout for single video (e.g. audio saved as webm) */
.post-media--count-1 .media-item {
  min-height: 0;
  padding: 0;
}

.post-media--count-1 {
  gap: 0;
}

.post-media--audio-only audio {
  width: 100% !important;
  max-width: 100%;
  margin: 0;
  display: block;
}

/* Multiple media: ordered grid layout */
.post-media--count-1:not(.post-media--audio-only) {
  grid-template-columns: 1fr;
}

.post-media--count-2 {
  grid-template-columns: repeat(2, 1fr);
}

.post-media--count-3,
.post-media--count-4,
.post-media--count-5,
.post-media--count-6,
.post-media--count-7,
.post-media--count-8,
.post-media--count-9,
.post-media--count-10,
.post-media--count-11,
.post-media--count-12 {
  grid-template-columns: repeat(2, 1fr);
}

.media-item {
  border-radius: 8px;
  overflow: hidden;
}

.media-item .media-link {
  display: block;
  height: 100%;
}

.media-item img {
  width: 100%;
  height: 100%;
  min-height: 120px;
  max-height: 220px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* Video min-height solo per griglie con più media (immagini/video) */
.post-media--count-2 .media-item video,
.post-media--count-3 .media-item video,
.post-media--count-4 .media-item video,
.post-media--count-5 .media-item video,
.post-media--count-6 .media-item video,
.post-media--count-7 .media-item video,
.post-media--count-8 .media-item video,
.post-media--count-9 .media-item video,
.post-media--count-10 .media-item video,
.post-media--count-11 .media-item video,
.post-media--count-12 .media-item video {
  width: 100%;
  height: 100%;
  min-height: 120px;
  max-height: 220px;
  object-fit: cover;
}

.media-item video {
  width: 100%;
  display: block;
  background: var(--color-bg-tint-1, #e5e5e5);
}

.media-item audio {
  width: 100%;
  min-width: 0;
  display: block;
}

/* WebM non supportato su Safari iOS: messaggio al posto del video per evitare crash */
.video-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  text-align: center;
  color: var(--color-text-muted);
  min-height: 120px;
}
.video-unsupported i {
  font-size: 1.5rem;
  opacity: 0.7;
}
.video-unsupported p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}
.slide-video-unsupported {
  min-height: 200px;
  max-width: 90%;
  margin: 0 auto;
}

.empty-state-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 1rem;
}

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 3rem 1rem;
  margin: 0;
}

.empty-state-wrap .empty-state {
  padding: 0;
}

.empty-state a {
  color: var(--color-primary);
}


.admin-main .btn-refresh {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  transition: background 0.2s;
}

.admin-main .btn-refresh:hover {
  background: var(--color-primary-hover);
}

/* Add form */
.add-form .form-group {
  margin-bottom: 1.25rem;
  overflow-x: hidden;
}

.add-form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.add-form input[type="text"],
.add-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

.add-form input[type="text"]:focus,
.add-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.add-form textarea {
  resize: vertical;
  min-height: 100px;
}

.add-form .form-privacy {
  margin-bottom: 1rem;
}

.add-form .privacy-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.add-form .privacy-check input {
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.add-form .privacy-check a {
  color: var(--color-primary);
  text-decoration: underline;
}

.add-form .privacy-check a:hover {
  text-decoration: none;
}

.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb, 196, 92, 62), 0.05);
}

.upload-hint {
  margin: 0 0 0.5rem;
  color: var(--color-text-muted);
}

.upload-browse {
  color: var(--color-primary);
  font-weight: 600;
}

.upload-record {
  margin: 0.75rem 0 0.5rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-record {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: rgba(var(--color-primary-rgb, 196, 92, 62), 0.15);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  cursor: pointer;
}

.btn-record:hover {
  background: rgba(var(--color-primary-rgb, 196, 92, 62), 0.25);
}

.btn-record.recording {
  background: var(--color-semantic-danger);
  color: white;
  border-color: var(--color-semantic-danger);
  animation: pulse-rec 1.5s infinite;
}

@keyframes pulse-rec {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.record-preview {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--color-bg);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.record-preview #recordPreviewContent {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.record-preview video,
.record-preview audio {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.record-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.record-actions + .record-actions {
  margin-top: 0.75rem;
}

.record-ready-hint {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: baseline;
  gap: 0.35em;
}

.btn-start-rec {
  background: var(--color-semantic-success);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-start-rec:hover {
  background: var(--color-semantic-success-hover);
}

.btn-stop {
  background: var(--color-semantic-danger);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-use {
  background: var(--color-semantic-success);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-use:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-discard {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-discard:hover {
  background: var(--color-bg);
}

.upload-limits {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.upload-hint-reliable {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.file-list {
  margin-top: 0.75rem;
}

.file-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--color-bg);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
}

.file-item--done {
  border-color: var(--color-semantic-success, #22c55e);
  background: rgba(34, 197, 94, 0.06);
}

.file-item--saving {
  border-color: var(--color-primary);
  animation: file-saving-pulse 1.5s ease-in-out infinite;
}

@keyframes file-saving-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.file-item-icon {
  color: var(--color-primary);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.file-item--done .file-item-icon {
  color: var(--color-semantic-success, #22c55e);
}

.file-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.file-item .file-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item .file-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.file-item-progress {
  flex: 1 1 100%;
  min-width: 0;
}

.file-item .progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.file-item .progress-fill {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.2s;
}

.file-item--done .progress-fill {
  background: var(--color-semantic-success, #22c55e);
}

.file-item .remove-file {
  background: none;
  border: none;
  color: var(--color-semantic-danger);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.file-item .remove-file:hover {
  background: rgba(239, 68, 68, 0.1);
}

.form-actions {
  margin-top: 1.5rem;
}

.success-message {
  text-align: center;
  padding: 2rem;
}

.success-message h2 {
  color: var(--color-semantic-success);
  margin-bottom: 0.5rem;
}

/* Slideshow */
.slideshow-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, var(--color-slideshow-1, #2d1f1f) 0%, var(--color-slideshow-2, #3d2a2a) 40%, var(--color-slideshow-3, #2d1a1a) 100%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slideshow-overlay[hidden] {
  display: none !important;
}

.slideshow-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.slideshow-close:hover {
  background: rgba(255,255,255,0.3);
}

.slideshow-prev,
.slideshow-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.slideshow-prev { left: 0.5rem; }
.slideshow-next { right: 0.5rem; }

.slideshow-prev:hover,
.slideshow-next:hover {
  background: rgba(255,255,255,0.3);
}

@media (max-width: 600px) {
  .slideshow-close {
    width: 36px;
    height: 36px;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.1rem;
  }

  .slideshow-prev,
  .slideshow-next {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    background: rgba(255,255,255,0.15);
  }

  .slideshow-prev { left: 0.25rem; }
  .slideshow-next { right: 0.25rem; }

  .slideshow-playpause {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .slideshow-content .slide-media-prev,
  .slideshow-content .slide-media-next {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  /* Più padding laterale su mobile: le frecce non si sovrappongono al contenuto */
  .slideshow-content {
    padding: 3rem 3.25rem 3rem;
  }
}

.slideshow-content {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4rem 1rem 4rem;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.slideshow-content::-webkit-scrollbar {
  width: 6px;
}

.slideshow-content::-webkit-scrollbar-track {
  background: transparent;
}

.slideshow-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
}

.slideshow-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.4);
}

.slideshow-content img {
  max-width: 100%;
  max-height: 45vh;
  object-fit: contain;
  flex-shrink: 0;
}

.slideshow-content video {
  max-width: 100%;
  max-height: 45vh;
  flex-shrink: 0;
}

.slideshow-content audio {
  width: 100%;
  max-width: 400px;
  flex-shrink: 0;
}

.slideshow-content .slide-media-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.25rem 0 1.75rem;
  flex-shrink: 0;
}

.slideshow-content .slide-media-prev,
.slideshow-content .slide-media-next {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.25);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.slideshow-content .slide-media-prev:hover,
.slideshow-content .slide-media-next:hover {
  background: rgba(255,255,255,0.4);
}

.slideshow-content .slide-media-prev:disabled,
.slideshow-content .slide-media-next:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.slideshow-content .slide-media-counter {
  font-size: 0.95rem;
  color: white;
  opacity: 0.95;
  min-width: 3.5em;
  text-align: center;
}

.slideshow-content .slide-name {
  color: white;
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
  flex-shrink: 0;
  max-width: 90%;
  align-self: center;
  text-align: center;
}

.slideshow-content.slide-single-media .slide-name {
  margin-top: 1.5rem;
}

.slideshow-content .slide-message {
  color: rgba(255,255,255,0.92);
  font-size: 1rem;
  margin: 0;
  line-height: 1.6;
  max-width: 90%;
  align-self: center;
  text-align: center;
}

.slideshow-controls {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.slideshow-playpause {
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.25);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.slideshow-playpause:hover {
  background: rgba(255,255,255,0.4);
}

.slideshow-playpause.paused {
  background: rgba(255,255,255,0.5);
}

.slideshow-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255,255,255,0.2);
}

.slideshow-progress .fill {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.1s linear;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.35);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,255,255,0.35);
}

.lightbox-counter {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 0.95rem;
  opacity: 0.9;
  z-index: 10;
}

.lightbox-img-container {
  display: contents;
}

.lightbox-img-container.lightbox-profile-pic-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox img.lightbox-profile-pic {
  border-radius: 50%;
  max-width: min(90vw, 400px);
  max-height: min(90vh, 400px);
  width: min(90vw, 400px);
  height: min(90vw, 400px);
  object-fit: cover;
  display: block;
  border: 4px solid rgba(255,255,255,0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.media-link-video {
  cursor: pointer;
  display: block;
}

/* Admin */
.admin-body {
  background: var(--color-admin-bg, #f0edeb);
}

.admin-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 50%, var(--color-primary-dark) 100%);
  color: white;
  padding: 1.5rem 0;
}

.admin-header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

.admin-header h1 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-family: var(--font-display);
}

.admin-header .btn-copy:hover {
  background: white;
  color: var(--color-primary);
}

.admin-header .btn-secondary:hover {
  background: white;
  color: var(--color-primary);
  border-color: white;
}

.admin-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 600px) {
  .admin-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
  }

  .admin-links .link-box {
    flex: 1;
    min-width: 280px;
  }
}

.link-box label {
  display: block;
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
}

.link-row {
  display: flex;
  gap: 0.5rem;
}

.link-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.link-row input:focus {
  outline: none;
  border-color: white;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.btn-copy {
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-copy:hover {
  background: var(--color-primary-hover);
}

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.admin-tabs .tab {
  padding: 0.5rem 1rem;
  background: white;
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
}

.admin-tabs .tab:hover {
  background: var(--color-bg);
}

.admin-tabs .tab.active {
  background: var(--color-primary);
  color: white;
}

.admin-posts.posts-grid {
  display: block;
}

.status-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.status-pending { background: var(--color-status-pending-bg); color: var(--color-status-pending); }
.status-approved { background: var(--color-status-approved-bg); color: var(--color-status-approved); }
.status-hidden { background: var(--color-status-hidden-bg); color: var(--color-status-hidden); }
.status-pinned { background: rgba(255, 193, 7, 0.3); color: #b45309; }
.status-pinned i { font-size: 0.9em; }

.admin-post .post-header {
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  border-bottom: 1px solid rgba(45, 42, 38, 0.2);
}

.admin-post .post-date {
  margin-left: auto;
}

.admin-post .post-message {
  margin-bottom: 1rem;
}

.admin-post .post-media {
  margin-top: 0.5rem;
}

.admin-post-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(45, 42, 38, 0.2);
}

.btn-approve {
  background: var(--color-semantic-success) !important;
  color: white !important;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-approve:hover {
  background: var(--color-semantic-success-hover) !important;
}

.btn-hide {
  background: var(--color-semantic-warning) !important;
  color: white !important;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-hide:hover {
  background: var(--color-semantic-warning-hover) !important;
}

.btn-delete {
  background: var(--color-semantic-danger) !important;
  color: white !important;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-delete:hover {
  background: var(--color-semantic-danger-hover) !important;
}

.btn-pin {
  background: #b45309 !important;
  color: white !important;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-pin:hover {
  background: #92400e !important;
}

.admin-post-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.admin-post-actions .btn i {
  font-size: 0.85em;
}

.admin-denied {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Settings form */
.settings-form {
  max-width: 500px;
}

.settings-form .form-group {
  margin-bottom: 1.25rem;
}

.settings-form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.settings-form input[type="text"],
.settings-form input[type="email"],
.settings-form select,
.settings-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

.settings-form select {
  appearance: auto;
  cursor: pointer;
}

.settings-form input:focus,
.settings-form select:focus,
.settings-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.settings-form textarea {
  resize: vertical;
  min-height: 80px;
}

.settings-form .form-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.settings-form .form-hint code {
  background: var(--color-border);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

.color-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.color-row input[type="color"] {
  width: 48px;
  height: 48px;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
}

.color-row input[type="text"] {
  width: 120px;
}

.header-image-preview {
  margin-bottom: 0.5rem;
  min-height: 80px;
}

.header-image-preview img {
  max-width: 120px;
  max-height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.header-placeholder {
  width: 120px;
  height: 80px;
  background: var(--color-bg);
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.settings-form .header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
}

/* Upload/Replace image - azioni standard, colore neutro fisso */
.settings-form .header-actions .btn {
  background: #6b7280;
  color: white;
  border: none;
}

.settings-form .header-actions .btn:hover {
  background: #4b5563;
}

/* Remove image - azione distruttiva, colore semantico fisso */
.settings-form .header-actions .btn-remove {
  background: var(--color-semantic-danger);
}

.settings-form .header-actions .btn-remove:hover {
  background: var(--color-semantic-danger-hover);
}

/* Toggle switch moderno */
.toggle-label {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500 !important;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-border);
  border-radius: 26px;
  transition: background 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.25s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle-text {
  user-select: none;
}

/* Lista email notifiche */
.email-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.email-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.email-row input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

.email-row input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.btn-remove-email {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  background: var(--color-border);
  color: var(--color-text-muted);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-remove-email:hover {
  background: var(--color-semantic-danger);
  color: white;
}

.btn-add-email {
  background: transparent;
  color: var(--color-primary);
  border: 1px dashed var(--color-primary);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.btn-add-email:hover {
  background: rgba(var(--color-primary-rgb, 196, 92, 62), 0.1);
}

.settings-form .demo-section {
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.settings-form .demo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.settings-form .demo-status {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.settings-form .demo-status--loaded {
  color: var(--color-semantic-success);
  font-weight: 500;
}

/* Demo buttons: visibili su sfondo chiaro (admin-main) */
.settings-form .demo-actions .btn:not(.btn-remove):not(:disabled) {
  background: #6b7280;
  color: white;
  border: none;
}

.settings-form .demo-actions .btn:not(.btn-remove):not(:disabled):hover {
  background: #4b5563;
}

.settings-form .demo-actions .btn:not(.btn-remove):disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #9ca3af;
  color: white;
  border: none;
}

.settings-form .demo-actions .btn-remove:not(:disabled) {
  background: var(--color-semantic-danger);
  color: white;
  border: none;
}

.settings-form .demo-actions .btn-remove:not(:disabled):hover {
  background: var(--color-semantic-danger-hover);
}

.settings-form .demo-actions .btn-remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #9ca3af;
  color: white;
  border: none;
}

.settings-form .form-actions {
  margin-top: 1.5rem;
}

/* Responsive */
@media (min-width: 600px) {
  .header h1 { font-size: 2rem; }
  .posts-grid { column-count: 2; }
}

@media (min-width: 900px) {
  .posts-grid { column-count: 3; }

  /* Slideshow: testo più stretto su desktop */
  .slideshow-content .slide-name,
  .slideshow-content .slide-message {
    max-width: 70%;
  }

  /* Immagini e video più alti su desktop (evita effetto schiacciato) */
  .media-item img,
  .post-media--count-2 .media-item video,
  .post-media--count-3 .media-item video,
  .post-media--count-4 .media-item video,
  .post-media--count-5 .media-item video,
  .post-media--count-6 .media-item video,
  .post-media--count-7 .media-item video,
  .post-media--count-8 .media-item video,
  .post-media--count-9 .media-item video,
  .post-media--count-10 .media-item video,
  .post-media--count-11 .media-item video,
  .post-media--count-12 .media-item video {
    min-height: 200px;
    max-height: 400px;
  }
}

@media (min-width: 1024px) {
  .main { max-width: 90vw; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
  .main-form { max-width: 480px; }
  .header.header-small { max-width: 480px; }
  .admin-main { max-width: 90vw; margin: 0 auto; }
  .admin-header-inner { max-width: 90vw; margin: 0 auto; }
}

@media (max-width: 600px) {
  .header { padding: 2rem 1.5rem; }
  .main { padding: 1.5rem 1.5rem 3rem; }

  .search-input,
  .filter-select,
  .sort-select,
  .toolbar .btn-slideshow {
    height: 2.75rem;
    min-height: 2.75rem;
  }
}

@media (max-width: 480px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-form { flex-direction: column; }

  .upload-zone {
    padding: 2rem 1rem;
  }

  .record-actions {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .record-actions .btn,
  .record-actions .btn-start-rec,
  .record-actions .btn-stop,
  .record-actions .btn-use,
  .record-actions .btn-discard {
    width: 100%;
    display: flex;
    justify-content: center;
  }
}
