/* ==========================================================================
   MANORA PhotoBooth - Galerie Invités Mobile
   Style & Design System alignés sur le site vitrine Manora
   ========================================================================== */

:root {
  --cream: #fff3df;
  --cream-2: #fffaf1;
  --paper: #fffefb;
  --sand: #ead8bd;
  --wood: #b87955;
  --brown: #85462f;
  --ink: #17324d;
  --muted: #596775;
  --terracotta: #e85d45;
  --peach: #ffc8ad;
  --sun: #f6ca55;
  --mint: #a9ded2;
  --teal: #16847c;
  --sky: #b9def0;
  --pink: #f3b6c8;
  
  --line: rgba(23, 50, 77, 0.12);
  --shadow-card: 0 10px 30px rgba(42, 67, 82, 0.065);
  --shadow-hover: 0 18px 38px rgba(42, 67, 82, 0.13);
  --shadow-floating: 0 16px 45px rgba(23, 50, 77, 0.18);

  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --font-family: "Avenir Next", "Trebuchet MS", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--cream-2);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 105px; /* space for sticky bottom bar */
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(246, 202, 85, 0.18), transparent 20rem),
    radial-gradient(circle at 90% 35%, rgba(169, 222, 210, 0.22), transparent 24rem),
    radial-gradient(circle at 50% 85%, rgba(243, 182, 200, 0.15), transparent 22rem);
  background-attachment: fixed;
}

/* --- STICKY APP HEADER --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 248, 242, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}

.header-content {
  max-width: 650px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.event-details h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
  margin: 0;
}

.live-subtitle {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(22, 132, 124, 0.2);
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0% { transform: scale(0.95); opacity: 0.85; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.85; }
}

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

.icon-btn {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(23, 50, 77, 0.05);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:active {
  transform: scale(0.92);
  background: #fff;
}

.icon-btn-light {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* --- MAIN GALLERY SECTION --- */
.gallery-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px;
}

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

@media (min-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

/* --- MANORA PHOTO CARD --- */
.photo-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  aspect-ratio: 4 / 5;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  animation: card-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .photo-card { animation: none; transition: none; }
}

@keyframes card-appear {
  from { opacity: 0; transform: translateY(18px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.photo-card:active {
  transform: scale(0.97);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #ead8bd;
  transition: transform 0.4s ease;
}

.photo-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(23, 50, 77, 0) 45%, rgba(23, 50, 77, 0.88) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px 10px;
  pointer-events: none;
}

.photo-card-info {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  pointer-events: auto;
}

.author-badge {
  font-size: 0.78rem;
  font-weight: 750;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 95px;
}

.card-time {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 1px;
}

.like-btn {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-pill);
  padding: 5px 9px;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.like-btn:active {
  transform: scale(1.25);
}

.like-btn.liked {
  background: rgba(232, 93, 69, 0.85);
  border-color: var(--terracotta);
  color: #ffffff;
}

/* --- EMPTY STATE --- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 20px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line);
  margin-top: 16px;
  box-shadow: var(--shadow-card);
}

.empty-icon-box {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 20px 20px 8px 20px;
  background: var(--sun);
  font-size: 1.6rem;
  transform: rotate(-3deg);
  box-shadow: 0 8px 20px rgba(246, 202, 85, 0.4);
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 320px;
  margin: 0 auto;
}

/* --- STICKY BOTTOM ACTION BAR --- */
.floating-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  padding: 14px 20px 22px;
  background: linear-gradient(180deg, rgba(255, 250, 241, 0) 0%, rgba(255, 250, 241, 0.92) 35%, rgba(255, 250, 241, 1) 100%);
  pointer-events: none;
  display: flex;
  justify-content: center;
}

.post-cta-btn {
  pointer-events: auto;
  width: 100%;
  max-width: 420px;
  background: var(--ink);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 16px 26px;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 12px 30px rgba(23, 50, 77, 0.25);
  cursor: pointer;
  transition: all 0.22s ease;
}

.post-cta-btn:hover {
  background: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(22, 132, 124, 0.35);
}

.post-cta-btn:active {
  transform: scale(0.96);
}

/* --- UPLOAD DRAWER MODAL --- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(23, 50, 77, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.upload-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 101;
  max-width: 520px;
  margin: 0 auto;
  background: var(--paper);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border: 1px solid var(--line);
  border-bottom: none;
  padding: 20px 20px 30px;
  box-shadow: var(--shadow-floating);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-backdrop.active .upload-drawer {
  transform: translateY(0);
}

.drawer-handle {
  width: 44px;
  height: 5px;
  background: var(--sand);
  border-radius: var(--radius-pill);
  margin: 0 auto 16px;
}

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

.drawer-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
}

.preview-box {
  width: 100%;
  max-height: 230px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f1e9dd;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
}

.preview-box img {
  max-width: 100%;
  max-height: 230px;
  object-fit: contain;
}

.input-group {
  margin-bottom: 14px;
}

.input-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brown);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(22, 132, 124, 0.15);
  background: #fff;
}

.submit-btn {
  width: 100%;
  background: var(--terracotta);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 15px;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  box-shadow: 0 8px 22px rgba(232, 93, 69, 0.35);
  transition: all 0.2s ease;
}

.submit-btn:hover {
  background: var(--brown);
  transform: translateY(-2px);
}

.submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  background: var(--cream);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.secondary-btn:hover {
  background: var(--sand);
  color: var(--ink);
}

/* --- LIGHTBOX MODAL --- */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(23, 50, 77, 0.94);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox-modal.active {
  opacity: 1;
  pointer-events: auto;
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lightbox-time {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.lightbox-body {
  flex: 1;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.lightbox-body::-webkit-scrollbar {
  display: none;
}

.lightbox-slide {
  flex: 0 0 100%;
  min-width: 100%;
  padding: 8px 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.lightbox-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 45px rgba(0,0,0,0.5);
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-footer {
  padding: 16px 20px 24px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lightbox-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

@media (max-width: 599px) {
  .lightbox-header {
    padding: max(12px, env(safe-area-inset-top)) 14px 8px;
  }

  .lightbox-footer {
    padding: 12px 14px max(18px, env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
  }

  .lightbox-actions {
    width: 100%;
  }

  .lightbox-actions .action-pill-btn {
    min-height: 44px;
    justify-content: center;
  }

  #lightbox-like-btn {
    flex: 0 0 auto;
  }

  #lightbox-download-btn {
    flex: 1;
  }
}

.lightbox-author {
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
}

.lightbox-caption {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 2px;
}

.action-pill-btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 750;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

/* --- QR CODE CONTAINER --- */
.qr-container {
  background: #fff;
  padding: 18px;
  border-radius: var(--radius-md);
  display: inline-block;
  position: relative;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.qr-code-img {
  width: 220px;
  height: 220px;
  display: block;
  image-rendering: pixelated;
}

.qr-brand {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70px;
  height: 70px;
  display: block;
  transform: translate(-50%, -50%);
  overflow: hidden;
  border: 5px solid #ffffff;
  border-radius: 17px;
  background: #ffffff;
  box-shadow: 0 0 0 2px #ffffff, 0 4px 12px rgba(23, 50, 77, 0.16);
}

.qr-brand img {
  width: 72px;
  height: 72px;
  max-width: none;
  display: block;
  transform: translate(-12px, -5px);
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--ink);
  border: 1px solid var(--mint);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 750;
  box-shadow: 0 10px 30px rgba(23, 50, 77, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.3s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
