/* ============================================================
   VARIABLES
   ============================================================ */
:root {
  --primary: #667eea;
  --primary-dark: #764ba2;
  --accent: #ffd700;
  --danger: #e74c3c;
  --dark: #1a1a2e;
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 30px rgba(0,0,0,0.15);
  --radius: 20px;
  --radius-sm: 12px;
  --ease: 0.3s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Poppins', sans-serif; color: #333; min-height: 100vh; overflow-x: hidden; }
button { font-family: inherit; }

/* ============================================================
   CARROUSEL — fond fixe plein écran
   ============================================================ */
#carousel {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.slide.active {
  opacity: 1;
  animation: kenBurns 14s ease-in-out both;
}

@keyframes kenBurns {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.1) translate(-2%, -1%); }
}

.carousel-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(10,10,30,0.45) 0%,
    rgba(10,10,30,0.32) 40%,
    rgba(10,10,30,0.72) 100%
  );
}

.hero-scroll-hint {
  cursor: pointer;
  text-decoration: none;
}

.hero-scroll-hint:hover {
  color: rgba(255,255,255,0.85);
}
.text-preview {
  margin-top: 12px;
  padding: 14px 18px;
  background: #fafafa;
  border: 2px dashed #e0e2ea;
  border-radius: 12px;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: #1a1a2e;
  line-height: 1.3;
}
.font-select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e8eaf0;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: #333;
  outline: none;
  background: #fff;
}
/* ============================================================
   HERO — pleine hauteur de page
   ============================================================ */
.hero {
  height: 100vh;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px 60px;
  position: relative;
}

.hero-content {
  max-width: 740px;
  animation: heroIn 1.1s ease both;
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(36px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.28);
  backdrop-filter: blur(12px);
  color: rgba(255,255,255,0.88);
  padding: 6px 22px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero-title {
  color: #fff;
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 20px;
  text-shadow: 0 2px 28px rgba(0,0,0,0.35);
}

.hero-name {
  background: linear-gradient(135deg, var(--accent) 0%, #ffb347 50%, #ff7eb3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: rgba(255,255,255,0.78);
  font-size: clamp(0.9rem, 2.2vw, 1.15rem);
  font-weight: 300;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.5);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: fadeInHint 2s ease 1.5s both;
}

@keyframes fadeInHint {
  from { opacity: 0; } to { opacity: 1; }
}

.scroll-arrow {
  width: 20px;
  height: 20px;
  border-right: 2px solid rgba(255,255,255,0.4);
  border-bottom: 2px solid rgba(255,255,255,0.4);
  transform: rotate(45deg);
  animation: bounceDown 1.6s ease infinite;
}

@keyframes bounceDown {
  0%, 100% { transform: rotate(45deg) translateY(0); }
  50%       { transform: rotate(45deg) translateY(5px); }
}

/* ============================================================
   BANDEAU DÉFILANT
   ============================================================ */
.ticker-wrap {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  overflow: hidden;
  padding: 14px 0;
  position: relative;
  z-index: 10;
}

.ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  animation: tickerScroll 38s linear infinite;
}

.ti {
  color: rgba(255,255,255,0.95);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0 28px;
}

.ts {
  color: rgba(255,255,255,0.4);
  font-size: 1rem;
  flex-shrink: 0;
}

@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ============================================================
   CONTENU PRINCIPAL
   ============================================================ */
.main-content {
  background: #f5f6fa;
  min-height: 60vh;
  border-radius: 0;
  padding-bottom: 80px;
  position: relative;
  z-index: 5;
}

/* ============================================================
   ONGLETS
   ============================================================ */
.tabs-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: #f5f6fa;
  border-bottom: 1px solid #e8eaf0;
}

.tab-btn {
  padding: 12px 36px;
  border: none;
  background: transparent;
  border-radius: 100px;
  font-size: 0.92rem;
  font-weight: 500;
  color: #999;
  cursor: pointer;
  transition: all var(--ease);
  letter-spacing: 0.02em;
}

.tab-btn:hover { background: rgba(102,126,234,0.1); color: var(--primary); }

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 16px rgba(102,126,234,0.42);
}

/* ============================================================
   PANNEAUX
   ============================================================ */
.tab-panel { display: none; padding: 28px 24px; }
.tab-panel.active { display: block; animation: panelIn 0.3s ease; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   GALERIE — toolbar
   ============================================================ */
.gallery-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.btn-browse {
  display: inline-flex;
  align-items: center;
  padding: 12px 26px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(102,126,234,0.38);
  transition: all var(--ease);
  user-select: none;
}

.btn-browse:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(102,126,234,0.5);
}

.btn-browse input[type="file"] { display: none; }

.btn-diaporama {
  display: inline-flex;
  align-items: center;
  padding: 12px 26px;
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--ease);
}

.btn-diaporama:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #bbb;
  padding: 60px 20px;
  font-size: 0.9rem;
}

/* ============================================================
   GRILLE PHOTOS
   ============================================================ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--ease), box-shadow var(--ease);
  background: #e0e0e0;
}

.photo-item:hover { transform: scale(1.03); box-shadow: var(--shadow-lg); z-index: 1; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease; }
.photo-item:hover img { transform: scale(1.06); }

.photo-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  background: var(--danger);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.28);
  z-index: 2;
}
.photo-item:hover .photo-delete { display: flex; }
.photo-delete:hover { transform: scale(1.08); }


/* ============================================================
   LIGHTBOX
   ============================================================ */
.lb-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.93); z-index: 900; backdrop-filter: blur(10px); }
.lb-backdrop.active { display: block; }

.lightbox { display: none; position: fixed; inset: 0; z-index: 901; flex-direction: column; align-items: center; justify-content: center; }
.lightbox.active { display: flex; }

.lb-close {
  position: absolute; top: 20px; right: 20px;
  width: 46px; height: 46px;
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%; color: #fff; font-size: 1.6rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--ease); line-height: 1;
}
.lb-close:hover { background: rgba(255,255,255,0.26); }

.lb-img-wrapper { max-width: min(90vw, 920px); max-height: 76vh; display: flex; align-items: center; justify-content: center; }

#lbImg {
  max-width: 100%; max-height: 76vh; object-fit: contain;
  border-radius: 14px; box-shadow: 0 20px 80px rgba(0,0,0,0.6);
  transition: opacity 0.2s ease;
}

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 54px; height: 54px;
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%; color: #fff; font-size: 2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--ease); line-height: 1;
}
.lb-nav:hover { background: rgba(255,255,255,0.28); }
.lb-prev { left: 20px; } .lb-next { right: 20px; }

.lb-footer {
  position: absolute; bottom: 24px;
  display: flex; align-items: center; gap: 20px;
  color: rgba(255,255,255,0.78); font-size: 0.9rem;
}

.lb-slideshow {
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; padding: 8px 22px; border-radius: 100px; font-size: 0.84rem;
  cursor: pointer; transition: background var(--ease);
}
.lb-slideshow:hover { background: rgba(255,255,255,0.26); }

/* ============================================================
   MUR DE MOTS
   ============================================================ */
.wall-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.btn-add-word {
  padding: 12px 26px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none; border-radius: 100px;
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  box-shadow: 0 4px 16px rgba(102,126,234,0.38);
  transition: all var(--ease);
}
.btn-add-word:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(102,126,234,0.52); }

.wall-actions { display: flex; gap: 8px; }

.btn-wall-action {
  padding: 11px 22px;
  background: #fff; color: #555;
  border: 2px solid #e0e2ea; border-radius: 100px;
  font-size: 0.84rem; font-weight: 500; cursor: pointer;
  transition: all var(--ease);
}
.btn-wall-action:hover { border-color: var(--primary); color: var(--primary); }

.wall-hint { font-size: 0.75rem; color: #bbb; margin-left: auto; }

.word-wall {
  position: relative;
  width: 100%;
  height: 68vh;
  min-height: 520px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px #e5e8f0;
  overflow: hidden;
  background-image: radial-gradient(circle, #dde1ea 1px, transparent 0);
  background-size: 28px 28px;
}

/* Plein écran sur le mur */
.word-wall:fullscreen,
.word-wall:-webkit-full-screen {
  border-radius: 0;
  height: 100vh;
  width: 100vw;
}

/* ============================================================
   CARTES DE MOTS
   ============================================================ */
.wall-word {
  position: absolute;
  padding: 14px 18px 18px;
  background: #fff;
  border-radius: 5px;
  box-shadow: 2px 3px 14px rgba(0,0,0,0.13), 0 0 0 1px rgba(0,0,0,0.06);
  cursor: grab;
  min-width: 90px;
  max-width: 280px;
  user-select: none;
  transform-origin: center center;
  transition: box-shadow 0.2s;
  touch-action: none;
}

.wall-word:hover { box-shadow: 5px 7px 22px rgba(0,0,0,0.2); z-index: 10; }
.wall-word.dragging { cursor: grabbing; box-shadow: 8px 12px 32px rgba(0,0,0,0.26); z-index: 999; }

.word-text { font-family: 'Caveat', cursive; line-height: 1.35; word-break: break-word; }
.word-author { display: block; font-size: 11px; color: #bbb; margin-top: 7px; font-style: italic; font-family: 'Poppins', sans-serif; }

/* Bouton supprimer */
.word-delete {
  position: absolute; top: -9px; right: -9px;
  width: 24px; height: 24px;
  background: var(--danger); color: #fff;
  border: 2.5px solid #fff; border-radius: 50%;
  font-size: 0.9rem; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  line-height: 1; box-shadow: 0 2px 7px rgba(231,76,60,0.45);
  transition: transform var(--ease);
}
.word-delete:hover { transform: scale(1.15); }
.wall-word:hover .word-delete { display: flex; }

/* Poignée rotation */
.rotate-handle {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 24px;
  background: var(--primary); color: #fff;
  border: 2.5px solid #fff; border-radius: 50%;
  font-size: 0.82rem; cursor: grab;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 2px 7px rgba(102,126,234,0.45);
}
.wall-word:hover .rotate-handle { display: flex; }

/* Poignée redimensionnement */
.resize-handle {
  position: absolute; bottom: 0; right: 0;
  width: 18px; height: 18px;
  cursor: se-resize;
  display: none;
  background: linear-gradient(135deg, transparent 45%, #ccd 45%);
  border-bottom-right-radius: 5px;
}
.wall-word:hover .resize-handle { display: block; }

/* ============================================================
   MODALS
   ============================================================ */
.modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal.active { display: flex; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(5px); }

.modal-box {
  position: relative; background: #fff; border-radius: var(--radius);
  padding: 34px; width: 100%; max-width: 490px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.32s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-box--sm { max-width: 360px; text-align: center; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.84) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close { position: absolute; top: 18px; right: 18px; background: none; border: none; font-size: 1.6rem; color: #ccc; cursor: pointer; line-height: 1; padding: 2px 6px; transition: color var(--ease); }
.modal-close:hover { color: #333; }

.modal-title { font-size: 1.2rem; font-weight: 600; color: var(--dark); margin-bottom: 22px; }
.delete-msg { color: #888; margin: 10px 0 26px; font-size: 0.9rem; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 8px; }

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
  width: 100%; padding: 12px 14px;
  border: 2px solid #e8eaf0; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.95rem; color: #333;
  outline: none; resize: none; transition: border-color var(--ease);
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group--left { text-align: left; }

.char-count { display: block; text-align: right; font-size: 0.73rem; color: #ccc; margin-top: 4px; }

.color-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: transform var(--ease), box-shadow var(--ease); box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.swatch:hover { transform: scale(1.18); }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 3px var(--primary); transform: scale(1.12); }

.size-slider { display: flex; align-items: center; gap: 12px; }
.size-label-small { font-size: 0.82rem; color: #aaa; min-width: 14px; }
.size-label-big   { font-size: 1.35rem; color: #aaa; min-width: 18px; }
input[type="range"] { flex: 1; accent-color: var(--primary); cursor: pointer; }

.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 26px; }
.modal-footer--center { justify-content: center; }

.btn-primary, .btn-secondary, .btn-danger {
  padding: 12px 26px; border: none; border-radius: 100px;
  font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all var(--ease);
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 16px rgba(102,126,234,0.36); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(102,126,234,0.52); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-secondary { background: #f0f1f5; color: #666; }
.btn-secondary:hover { background: #e5e7ef; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }

@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }
.shake { animation: shake 0.4s ease; border-color: var(--danger) !important; }

/* ============================================================
   IMPRESSION
   ============================================================ */
@media print {
  body > *:not(#print-wall-wrapper) { display: none !important; }

  #tab-words { display: block !important; position: fixed !important; inset: 0 !important; padding: 0 !important; }
  .word-wall {
    height: 100vh !important;
    width: 100vw !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .wall-header, .tabs-nav, .ticker-wrap, .hero, #carousel, .carousel-overlay { display: none !important; }
  .word-delete, .rotate-handle, .resize-handle { display: none !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .lb-nav { width: 40px; height: 40px; font-size: 1.4rem; }
  .lb-prev { left: 8px; } .lb-next { right: 8px; }
  .tab-btn { padding: 10px 20px; font-size: 0.84rem; }
  .word-wall { height: 56vh; }
  .modal-box { padding: 24px; }
  .wall-hint { display: none; }
  .wall-actions { gap: 6px; }
  .btn-wall-action { padding: 10px 16px; font-size: 0.8rem; }
  .gallery-toolbar { gap: 8px; }
}
