/* =============================================================
   CHARTE GRAPHIQUE OFFICIELLE : ANNE-MARIE & MARC-ANDRÉ
   Source : https://mariage-amma.com/
   ============================================================= */

:root {
  --primary: #526342;          /* Le vert olive/sauge du faire-part */
  --primary-hover: #3f4d33;
  --primary-soft: rgba(82, 99, 66, 0.08);
  --primary-subtle: rgba(82, 99, 66, 0.15);
  --text: #38462b;             /* Vert très foncé pour le texte */
  --text-muted: rgba(56, 70, 43, 0.7);
  --bg: #f6f5ef;               /* Le beau crème de fond papeterie */
  --card-bg: #faf9f4;
  --border: rgba(82, 99, 66, 0.35);
  --border-light: rgba(82, 99, 66, 0.2);
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 4px;
  --radius-md: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: 50px;
}

/* =============================================================
   EN-TÊTE DU SITE (STYLE MARIAGE-AMMA.COM)
   ============================================================= */
.header {
  text-align: center;
  padding: 30px 10px 20px;
}

.floral-symbol {
  font-size: 1.6rem;
  color: var(--primary);
  opacity: 0.85;
  margin-bottom: 8px;
  display: inline-block;
}

.header h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 6vw, 2.8rem);
  font-weight: 400;
  color: var(--primary);
  line-height: 1.15;
  margin-bottom: 6px;
}

.header .wedding-date {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--primary);
  opacity: 0.9;
}

.thin-divider {
  width: 45px;
  height: 1px;
  background: var(--primary);
  margin: 18px auto;
  opacity: 0.5;
}

.header .subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text);
  opacity: 0.9;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

/* =============================================================
   NAVIGATION PAR ONGLETS (3 MODES)
   ============================================================= */
.tabs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: rgba(82, 99, 66, 0.06);
  padding: 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 4px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.tab-btn span.tab-icon {
  font-size: 1.1rem;
}

.tab-btn.active {
  background: var(--primary);
  color: var(--bg);
  box-shadow: 0 2px 6px rgba(82, 99, 66, 0.2);
}

/* =============================================================
   CARTES DE STYLE PAPETERIE (RSVP STYLE)
   ============================================================= */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 30px 24px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  position: relative;
  box-shadow: 0 4px 16px rgba(82, 99, 66, 0.04);
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* =============================================================
   CHAMPS DE FORMULAIRE STYLE "LIGNE SUR PAPIER"
   ============================================================= */
.form-group {
  margin-bottom: 22px;
  text-align: left;
}

label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
}

input[type="text"],
select,
textarea {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text);
  border-radius: 0;
  transition: border-bottom-color 0.2s;
  outline: none;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  border-bottom: 2px solid var(--primary);
}

input::placeholder,
textarea::placeholder {
  color: rgba(56, 70, 43, 0.4);
  font-style: italic;
  font-family: var(--font-serif);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

/* =============================================================
   BOUTONS DE SELECTION & ACTIONS
   ============================================================= */
.upload-triggers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  background: transparent;
  border: 1px dashed var(--primary);
  border-radius: var(--radius-sm);
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-trigger:hover,
.btn-trigger:active {
  background: var(--primary-soft);
}

.btn-trigger svg {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
}

.btn-trigger span {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
}

/* Boutons principaux */
.btn-submit {
  width: 100%;
  padding: 18px 24px;
  background: var(--primary);
  color: var(--bg);
  border: 1px solid var(--primary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius-sm);
}

.btn-submit:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-submit:disabled {
  background: rgba(82, 99, 66, 0.3);
  border-color: transparent;
  color: rgba(246, 245, 239, 0.7);
  cursor: not-allowed;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.25s ease;
  text-decoration: none;
  margin-top: 10px;
}

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

/* =============================================================
   GRILLE DE PRÉVISUALISATION
   ============================================================= */
.preview-section {
  margin-bottom: 22px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  font-weight: 700;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.preview-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: #edece5;
}

.preview-item img,
.preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(56, 70, 43, 0.8);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
}

.preview-item .video-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--primary);
  color: var(--bg);
  font-size: 9px;
  padding: 2px 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 2px;
  font-weight: 700;
}

/* =============================================================
   MODE 2 : MESSAGE VIDÉO (SELFIE AUX MARIÉS)
   ============================================================= */
.video-mode-card {
  text-align: center;
}

.mode-intro {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.5;
}

.btn-record-selfie {
  width: 100%;
  padding: 24px 16px;
  background: transparent;
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-sm);
  color: var(--primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all 0.25s;
  margin-bottom: 20px;
}

.btn-record-selfie:hover {
  background: var(--primary-soft);
}

.btn-record-selfie svg {
  width: 36px;
  height: 36px;
}

.btn-record-selfie strong {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn-record-selfie small {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.video-preview-wrapper {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 20px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.video-preview-wrapper video {
  width: 100%;
  display: block;
}

/* =============================================================
   MODE 3 : DÉFI DES VERRES 🍸
   ============================================================= */
.defi-card {
  text-align: center;
}

.defi-banner {
  background: var(--primary-soft);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.defi-banner h3 {
  font-family: var(--font-serif);
  color: var(--primary);
  font-size: 1.35rem;
  margin-bottom: 6px;
}

.defi-banner p {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
}

.phase-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.phase-btn {
  padding: 14px 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.phase-btn.active {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
}

.phase-btn span.phase-icon {
  font-size: 1.4rem;
}

/* Instructions de phase */
.phase-instructions {
  border-left: 2px solid var(--primary);
  padding-left: 14px;
  margin-bottom: 20px;
  text-align: left;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text);
}

/* Boîte de rappel d'alarme */
.alarm-box {
  background: #fdfaf3;
  border: 1px solid #dfd3ba;
  padding: 18px;
  border-radius: var(--radius-sm);
  margin-top: 20px;
  text-align: center;
}

.alarm-box h4 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--primary);
  margin-bottom: 6px;
}

.alarm-box p {
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* =============================================================
   LEADERBOARD / MUR DU DÉFI
   ============================================================= */
.leaderboard-section {
  margin-top: 30px;
  text-align: left;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.leaderboard-header h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--primary);
}

.leaderboard-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.duel-card {
  background: #fbfaf5;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.duel-name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.duel-status-badge {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 2px;
  font-weight: 700;
}

.duel-status-badge.complete {
  background: var(--primary);
  color: var(--bg);
}

.duel-status-badge.pending {
  background: rgba(82, 99, 66, 0.15);
  color: var(--primary);
}

.duel-videos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.duel-video-col {
  text-align: center;
}

.duel-video-col span {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: 4px;
}

.duel-video-col video {
  width: 100%;
  aspect-ratio: 9/16;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #000;
}

.duel-video-placeholder {
  width: 100%;
  aspect-ratio: 9/16;
  max-height: 180px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 10px;
  background: rgba(82, 99, 66, 0.04);
}

/* =============================================================
   PROGRESSION & SUCCÈS
   ============================================================= */
.progress-card {
  display: none;
  text-align: center;
  padding: 40px 20px;
}

.progress-card.active {
  display: block;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 2px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin: 16px 0 8px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.progress-status {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--primary);
}

.progress-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Écran de confirmation */
.success-card {
  display: none;
  text-align: center;
  padding: 40px 20px;
}

.success-card.active {
  display: block;
}

.success-icon {
  font-size: 2.2rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.success-card h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.success-card p {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* =============================================================
   GALERIE PUBLIQUE & LIGHTBOX
   ============================================================= */
.gallery-card {
  margin-top: 10px;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.gallery-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
}

.gallery-title-wrapper h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--primary);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--primary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--primary-soft);
  transform: rotate(45deg);
}

.gallery-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-style: italic;
  font-family: var(--font-serif);
}

.gallery-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border: 2px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gallery-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #edece5;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: transform 0.2s;
}

.gallery-item:hover,
.gallery-item:active {
  transform: scale(1.02);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-empty {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
  font-family: var(--font-serif);
}

/* Modale Lightbox plein écran */
.lightbox-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 38, 24, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 94vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(246, 245, 239, 0.2);
}

.lightbox-close {
  position: absolute;
  top: -42px;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* =============================================================
   PIED DE PAGE OFFICIEL
   ============================================================= */
.footer {
  text-align: center;
  padding: 40px 10px 10px;
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--primary);
  opacity: 0.75;
}
