/* ============================================
   Cute Photo Booth - Pastel theme
   Font: Quicksand (Google Fonts)
   ============================================ */

:root {
  --bg-soft-pink: #FFD1DC;
  --btn-mint: #98FB98;
  --btn-lavender: #E6E6FA;
  --btn-frame: #FFFACD;
  --btn-frame-active: #f5f0b8;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --radius-card: 20px;
  --radius-btn: 30px;
  --radius-video: 15px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Quicksand', sans-serif;
  background: var(--bg-soft-pink);
  color: #333;
  overflow-x: hidden;
  position: relative;
}

/* Screen reader only (accessibility) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

/* Floating hearts background */
.hearts-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

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

.heart:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.heart:nth-child(2) { left: 80%; top: 15%; animation-delay: 1.5s; }
.heart:nth-child(3) { left: 25%; top: 70%; animation-delay: 3s; }
.heart:nth-child(4) { left: 70%; top: 65%; animation-delay: 4.5s; }
.heart:nth-child(5) { left: 50%; top: 40%; animation-delay: 2s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

/* Main container - white card */
.container {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 1.5rem auto;
  padding: 1.5rem;
  background: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

header {
  text-align: center;
  margin-bottom: 1.25rem;
}

header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: #e91e8c;
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: #666;
}

/* Video section */
.camera-section {
  margin-bottom: 1.5rem;
}

.video-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius-video);
  overflow: hidden;
  background: #f0f0f0;
  border: 3px solid white;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  min-height: 200px;
}

#video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-video);
  transform: scaleX(-1); /* mirror like a selfie */
}

.frame-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Loading overlay */
.loading-overlay,
.error-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-video);
  padding: 1rem;
  min-height: 200px;
}

.loading-overlay p,
.error-overlay p {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  text-align: center;
}

.error-overlay p:first-of-type {
  font-weight: 600;
  color: #c2185b;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-soft-pink);
  border-top-color: #e91e8c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Countdown overlay (3-2-1 before capture) */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(3rem, 10vw, 4.5rem);
  font-weight: 700;
  color: white;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 3;
}

/* Quick white flash on capture */
.flash-overlay {
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0.95;
  z-index: 4;
}

/* Frame toggle buttons - soft yellow */
.frame-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.frame-btn {
  font-family: 'Quicksand', sans-serif;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-btn);
  border: 2px solid #f0e68c;
  background: var(--btn-frame);
  color: #333;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.frame-btn:hover {
  transform: scale(1.05);
  background: #faf5c4;
}

.frame-btn.active {
  background: var(--btn-frame-active);
  border-color: #e6dc7a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.frame-btn.active::after {
  content: ' ✨';
}

.frame-btn-none {
  font-weight: 500;
  opacity: 0.9;
}

/* Filter buttons */
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: 'Quicksand', sans-serif;
  color: #555;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}

.filter-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filter-btn.active {
  border-color: #e91e8c;
  background: #ffe6f1;
  color: #c2185b;
  box-shadow: 0 2px 8px rgba(233, 30, 139, 0.18);
}

.filter-swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f5f5f5;
}

.filter-swatch-none {
  background: linear-gradient(135deg, #ffffff, #f7f7f7);
}

.filter-swatch-bw {
  background: linear-gradient(135deg, #000000, #ffffff);
}

.filter-swatch-warm {
  background: linear-gradient(135deg, #ffb199, #ff0844);
}

.filter-swatch-cool {
  background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
}

.filter-label {
  font-weight: 600;
}

/* Action buttons */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.btn {
  font-family: 'Quicksand', sans-serif;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-btn);
  border: 2px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-capture {
  background: var(--btn-mint);
  border-color: #7dd87d;
  color: #2e7d32;
}

.btn-download {
  background: var(--btn-lavender);
  border-color: #c5c5e8;
  color: #4a4a7c;
}

/* Capture button animation (quick scale on click) */
.btn-capture:active:not(:disabled) {
  transform: scale(0.95);
}

/* "Cheese!" popup */
.cheese-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 16px;
  font-size: 1.5rem;
  font-weight: 700;
  color: #e91e8c;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 100;
  animation: cheesePop 1s ease-out forwards;
  pointer-events: none;
}

.cheese-popup.hidden {
  display: none;
}

@keyframes cheesePop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* Captured photo - polaroid style */
.captured-section h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  color: #555;
}

.polaroid-wrapper {
  padding: 1rem;
  background: #fafafa;
  border-radius: var(--radius-video);
  border: 1px solid #eee;
}

.captured-container {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 8px;
  padding: 1rem;
  border: 8px solid white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  position: relative;
}

.no-photo {
  margin: 0;
  color: #999;
  font-size: 0.95rem;
}

.captured-image {
  max-width: 100%;
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

/* Instructions footer */
.instructions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  font-size: 0.85rem;
  color: #666;
  text-align: center;
}

.instructions p {
  margin: 0;
}

/* Mobile: stack and full width */
@media (max-width: 480px) {
  .container {
    margin: 0.75rem;
    padding: 1rem;
  }

  .frame-toggles {
    flex-direction: column;
  }

  .frame-btn {
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

/* ========== Full app (photobooth-v2 parity) ========== */
.pb-app {
  min-height: 100vh;
  background: linear-gradient(180deg, #ffd1dc33 0%, #fff 35%);
}

.pb-screen.hidden {
  display: none !important;
}

.pb-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #eee;
  padding: 0.75rem 1rem;
}

.pb-header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pb-title {
  margin: 0;
  font-size: 1.15rem;
  color: #e91e8c;
}

.pb-subtitle {
  margin: 0;
  font-size: 0.75rem;
  color: #888;
}

.pb-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pb-icon-btn {
  border: none;
  background: #fff5f8;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.2rem;
}

.pb-steps {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pb-step {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: #eee;
  color: #888;
}

.pb-step.active {
  background: #e91e8c;
  color: #fff;
}

.pb-step.done {
  background: #ffb6d9;
  color: #fff;
}

.pb-step-line {
  width: 1.5rem;
  height: 2px;
  background: #ddd;
}

.pb-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

.pb-h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0 0 0.5rem;
  color: #333;
  text-align: center;
}

.pb-h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin: 1.5rem 0 0.75rem;
}

.pb-lead {
  text-align: center;
  color: #666;
  margin: 0 0 1.5rem;
}

.pb-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.btn-primary {
  background: linear-gradient(135deg, #e91e8c, #ff6b9d);
  color: #fff;
  border-color: #e91e8c;
}

.btn-outline {
  background: #fff;
  color: #555;
  border: 2px solid #ddd;
}

.pb-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.pb-layout-card {
  border: 2px solid #eee;
  border-radius: 16px;
  padding: 0.75rem;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-family: 'Quicksand', sans-serif;
  transition: transform 0.15s, box-shadow 0.15s;
}

.pb-layout-card:hover {
  transform: scale(1.02);
}

.pb-layout-card.selected {
  border-color: #e91e8c;
  box-shadow: 0 4px 16px rgba(233, 30, 140, 0.2);
}

.pb-layout-thumb {
  aspect-ratio: 3 / 4;
  margin-bottom: 0.5rem;
}

.pb-layout-cell {
  background: #ffd1dc66;
  border-radius: 4px;
}

.pb-layout-card.selected .pb-layout-cell {
  background: #e91e8c44;
}

.pb-layout-desc {
  display: block;
  font-size: 0.7rem;
  color: #999;
}

.pb-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
}

.pb-theme-card {
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 0.5rem;
  background: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  text-align: center;
  font-family: 'Quicksand', sans-serif;
}

.pb-theme-card.selected {
  border-color: #e91e8c;
}

.pb-theme-preview {
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  margin-bottom: 0.35rem;
}

.pb-caption-wrap {
  max-width: 420px;
  margin: 1.5rem auto;
}

.pb-caption-wrap label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.pb-caption-wrap input {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  border: 2px solid #eee;
  font-family: 'Quicksand', sans-serif;
  text-align: center;
}

.pb-caption-count {
  font-size: 0.75rem;
  color: #999;
  text-align: center;
  margin: 0.25rem 0 0;
}

.pb-capture-controls {
  margin-bottom: 1rem;
}

.pb-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pb-label {
  font-size: 0.75rem;
  color: #888;
  width: 100%;
  text-align: center;
}

@media (min-width: 640px) {
  .pb-label {
    width: auto;
    margin-right: 0.5rem;
  }
}

.pb-timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pb-timer-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 2px solid #eee;
  background: #fff;
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
}

.pb-timer-btn.active {
  background: #e91e8c;
  color: #fff;
  border-color: #e91e8c;
}

.pb-video-shell {
  position: relative;
  max-width: 640px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  overflow: hidden;
  border: 4px solid #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  background: #000;
  aspect-ratio: 4 / 3;
}

.pb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.pb-cheese {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  z-index: 40;
  pointer-events: none;
}

.pb-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.pb-thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #e91e8c;
}

.pb-review-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 1024px) {
  .pb-review-grid {
    grid-template-columns: 1fr 2fr 1fr;
    align-items: start;
  }
}

.pb-panel {
  background: #fff;
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid #eee;
}

.pb-small {
  font-size: 0.75rem;
  color: #888;
  margin: 0 0 0.75rem;
}

.pb-photo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow-y: auto;
}

.pb-photo-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 8px;
  margin-bottom: 0.35rem;
  border: 2px solid #eee;
  cursor: grab;
}

.pb-photo-list img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
}

.pb-drag {
  color: #ccc;
  font-size: 0.75rem;
}

.pb-sticker-palette strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.pb-sticker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pb-sticker-chip {
  min-width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  border: 1px solid #eee;
  background: #fafafa;
  cursor: pointer;
  font-size: 1rem;
}

.pb-preview-wrap {
  position: relative;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 12px;
  overflow: auto;
}

.pb-preview-wrap.pb-crosshair {
  cursor: crosshair;
}

#review-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.pb-qr-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.pb-review-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.pb-filter-chip {
  padding: 0.5rem;
  border-radius: 8px;
  border: 2px solid #eee;
  background: #fafafa;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: 'Quicksand', sans-serif;
}

.pb-filter-chip.active {
  border-color: #e91e8c;
  background: #fff5f8;
  color: #c2185b;
}

.pb-export-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.pb-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: #aaa;
}
