/* ================================================
   DESIGN TOKENS & RESET
   ================================================ */
:root {
  --mint: #A8E6CF;
  --mint-light: #C8F5E0;
  --powder-blue: #A8D8EA;
  --powder-blue-light: #C2E4F0;
  --lavender: #C3B1E1;
  --lavender-light: #D9CDEE;
  --lemon: #FFEEAD;
  --lemon-light: #FFF5D1;
  --cherry: #E8A0A0;
  --cherry-light: #F0C0C0;
  --ruby: #D4878F;

  --bg-primary: #F8F6FF;
  --bg-card: rgba(255, 255, 255, 0.55);
  --text-primary: #3D3456;
  --text-secondary: #7A6E8A;
  --text-light: #AEA4BC;

  --glass-bg: rgba(255, 255, 255, 0.35);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-shadow: rgba(160, 140, 190, 0.15);

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ================================================
   ANIMATED BACKGROUND
   ================================================ */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(135deg, #F0EAFF 0%, #FCEAEA 20%, #EAF7F0 40%, #EAF2FA 60%, #FFF8E8 80%, #F5E0E0 100%);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  25% {
    background-position: 100% 0%;
  }

  50% {
    background-position: 100% 100%;
  }

  75% {
    background-position: 0% 100%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* Floating background images (loaded from assets/) */
.bg-float-img {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  object-fit: cover;
  border-radius: 12px;
  opacity: 0.4;
  filter: blur(0.4px) saturate(0.85);
  will-change: transform;
}



/* ================================================
   APP CONTAINER
   ================================================ */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  /* Use small viewport height for mobile browsers */
  overflow-x: hidden;
  overflow-y: auto;
  /* Allow scrolling if content overflows */
}

/* When strip is visible, allow natural scrolling. 
   On landscape iPad, we hide the main header to save vertical space. */
.strip-mode .app-container {
  overflow-y: auto;
  max-width: 1000px;
  /* Allow wider layout for larger strip */
}

.strip-mode .header {
  display: none;
}

/* ================================================
   HEADER
   ================================================ */
.header {
  text-align: center;
  margin-bottom: 28px;
}

.header-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-shadow:
    0 0 30px rgba(212, 135, 143, 0.45),
    0 0 60px rgba(195, 177, 225, 0.35),
    0 0 90px rgba(232, 160, 160, 0.2);
  animation: titleGlow 4s ease-in-out infinite alternate;
  line-height: 1.2;
}

@keyframes titleGlow {
  0% {
    text-shadow:
      0 0 30px rgba(212, 135, 143, 0.45),
      0 0 60px rgba(195, 177, 225, 0.35),
      0 0 90px rgba(232, 160, 160, 0.2);
  }

  100% {
    text-shadow:
      0 0 40px rgba(212, 135, 143, 0.65),
      0 0 80px rgba(195, 177, 225, 0.5),
      0 0 120px rgba(232, 160, 160, 0.3);
  }
}

.header-sub {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 300;
  color: var(--text-secondary);
  margin-top: 8px;
  letter-spacing: 0.02em;
}

/* ================================================
   CAMERA
   ================================================ */
.camera-wrapper {
  flex: 1;
  min-width: 320px;
  max-width: 480px;
  /* Reduced window size */
}

.camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(40, 30, 60, 0.08);
  border: 2px solid var(--glass-border);
  box-shadow:
    0 8px 32px rgba(212, 135, 143, 0.12),
    0 4px 16px var(--glass-shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.camera-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1) scale(1.8);
  /* mirror + 1.8x zoom */
  display: block;
}

/* Filter: B&W */
.camera-container.filter-bw video {
  filter: grayscale(1) contrast(1.05) brightness(1.02);
}

/* Countdown */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(61, 52, 86, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 5;
}

.countdown-overlay.active {
  opacity: 1;
}

.countdown-number {
  font-family: var(--font-display);
  font-size: 7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 40px rgba(212, 135, 143, 0.7), 0 0 80px rgba(232, 160, 160, 0.4);
  animation: countPulse 1s ease-in-out;
}

@keyframes countPulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  30% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Flash */
.flash-overlay {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

.flash-overlay.flash {
  animation: flashBang 0.4s ease-out;
}

@keyframes flashBang {
  0% {
    opacity: 0.95;
  }

  100% {
    opacity: 0;
  }
}

/* Photo counter pill */
.photo-counter {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 6;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.3s ease;
}

.photo-counter.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================
   FILTERS BAR
   ================================================ */
.booth-main {
  display: flex;
  flex-direction: row;
  gap: 30px;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
  /* Stack on small screens */
}

.booth-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  flex-shrink: 0;
  width: 200px;
  /* Width for side-bar */
}

.filters-bar {
  display: flex;
  flex-direction: column;
  /* Stack filters vertically in sidebar */
  gap: 12px;
  width: 100%;
  margin-bottom: 0;
  /* Remove margin as it's now in a column */
  flex-wrap: nowrap;
  /* Prevent wrapping in column layout */
  justify-content: flex-start;
  /* Align filters to top */
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 10px 20px;
  border: 1.5px solid var(--glass-border);
  border-radius: 100px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  width: 100%;
  /* Fill sidebar width */
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--lavender);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(195, 177, 225, 0.2);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--cherry-light), var(--lavender-light), var(--mint-light));
  border-color: var(--cherry);
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(212, 135, 143, 0.25);
}

/* ================================================
   START BUTTON
   ================================================ */
.start-btn {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 700;
  padding: 16px 20px;
  width: 100%;
  /* Fill sidebar width */
  border: none;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--cherry), var(--lavender), var(--mint));
  background-size: 200% 200%;
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow:
    0 8px 32px rgba(212, 135, 143, 0.3),
    0 2px 8px rgba(195, 177, 225, 0.2);
  transition: all 0.4s ease;
  animation: btnGradient 5s ease infinite;
  position: relative;
  overflow: hidden;
}

@keyframes btnGradient {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.start-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.start-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 12px 40px rgba(212, 135, 143, 0.4),
    0 4px 12px rgba(195, 177, 225, 0.25);
}

.start-btn:hover::before {
  opacity: 1;
}

.start-btn:active {
  transform: translateY(-1px) scale(0.98);
}

.start-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ================================================
   STRIP VIEW
   ================================================ */
.strip-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 85vh;
  min-height: 85svh;
  padding: 20px 0;
  animation: fadeSlideUp 0.6s ease;
}

@keyframes fadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.strip-heading {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  /* Slightly smaller heading */
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  /* Less margin */
  text-shadow: 0 0 30px rgba(195, 177, 225, 0.4);
  flex-shrink: 0;
}

.strip-image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 85vh;
  max-height: 85svh;
  display: block;
  border-radius: 4px;
  /* Physical strip feel */
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.2),
    0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Landscape Tablet / iPad Optimization */
@media (orientation: landscape) and (max-height: 1200px) {
  .app-container {
    max-width: 1200px;
    padding: 10px 20px;
    justify-content: center;
  }

  .strip-view {
    flex-direction: row;
    gap: 40px;
    align-items: center;
    justify-content: center;
    min-height: auto;
    padding: 0;
    width: 100%;
  }

  .strip-heading {
    display: none;
  }

  .strip-image {
    max-height: 90vh;
    max-height: 90svh;
  }

  .strip-actions {
    flex-direction: column;
    margin-top: 0;
    gap: 12px;
    flex-shrink: 0;
  }

  .action-btn {
    padding: 12px 24px;
    font-size: 1rem;
    width: 160px;
  }
}

/* Actions */
.strip-actions {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  /* Less margin */
  flex-wrap: wrap;
  justify-content: center;
  flex-shrink: 0;
}

.action-btn {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 36px;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.01em;
}

.download-btn {
  background: linear-gradient(135deg, var(--cherry) 0%, var(--ruby) 100%);
  color: #fff;
  box-shadow: 0 6px 24px rgba(212, 135, 143, 0.35);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(212, 135, 143, 0.45);
}

.retake-btn {
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px var(--glass-shadow);
}

.retake-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--cherry-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232, 160, 160, 0.2);
}

/* ================================================
   CONFETTI CANVAS
   ================================================ */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  pointer-events: none;
}

/* ================================================
   UTILITY
   ================================================ */
.hidden {
  display: none !important;
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 520px) {
  .app-container {
    padding: 20px 14px 40px;
  }

  .camera-container {
    border-radius: var(--radius-md);
  }

  .start-btn {
    font-size: 1.1rem;
    padding: 16px 44px;
  }

  .filters-bar {
    gap: 6px;
  }

  .filter-btn {
    font-size: 0.8rem;
    padding: 8px 14px;
  }

  .strip-actions {
    flex-direction: column;
    width: 100%;
    padding: 0 20px;
  }

  .action-btn {
    width: 100%;
    text-align: center;
  }
}