/* =========================================================================
   style.css
   Shared styles for the whole site: colors, layout, animations.
   Uses CSS variables so the theme is easy to customize from one place.
   ========================================================================= */

:root {
  /* --- Color palette: change these to re-theme the whole site --- */
  --color-bg-top: #ffd6e8;
  --color-bg-bottom: #ffb8d9;
  --color-card-bg: rgba(255, 255, 255, 0.5); /* translucent for the glass effect */
  --color-card-border: rgba(255, 255, 255, 0.65);
  --color-primary: #ff6b9d;
  --color-primary-dark: #d63e79;
  --color-secondary: rgba(255, 240, 245, 0.6);
  --color-text: #4a2c3a;
  --color-text-light: #7a5566;
  --color-success: #4caf82;
  --color-danger: #d5304a;

  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --shadow-soft: 0 20px 45px rgba(155, 40, 90, 0.25);
  --shadow-button: 0 10px 20px rgba(255, 107, 157, 0.4);
  --glass-blur: 18px;

  --font-heading: 'Poppins', 'Segoe UI', sans-serif;
  --font-body: 'Quicksand', 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: linear-gradient(160deg, var(--color-bg-top), var(--color-bg-bottom));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  padding: 24px;
  perspective: 1200px; /* gives the floating orbs/hearts a sense of depth */
}

/* -------------------------------------------------------------------------
   Busy animated 3D-style background: soft blurred gradient orbs that drift
   and rotate in 3D space behind the glass card. Pure CSS, no images/canvas.
   ------------------------------------------------------------------------- */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  transform-style: preserve-3d;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  animation: orbDrift ease-in-out infinite;
  transform-style: preserve-3d;
}

.bg-orb:nth-child(1) {
  width: 320px;
  height: 320px;
  top: -80px;
  left: -60px;
  background: radial-gradient(circle at 35% 35%, #ffffff, #ff9dc1 70%, transparent 100%);
  animation-duration: 16s;
}

.bg-orb:nth-child(2) {
  width: 260px;
  height: 260px;
  bottom: -60px;
  right: -40px;
  background: radial-gradient(circle at 40% 40%, #fff2f7, #ff5f95 75%, transparent 100%);
  animation-duration: 20s;
  animation-delay: -4s;
}

.bg-orb:nth-child(3) {
  width: 200px;
  height: 200px;
  top: 55%;
  left: 8%;
  background: radial-gradient(circle at 40% 40%, #ffffff, #ffb8d9 70%, transparent 100%);
  animation-duration: 14s;
  animation-delay: -8s;
}

.bg-orb:nth-child(4) {
  width: 180px;
  height: 180px;
  top: 12%;
  right: 12%;
  background: radial-gradient(circle at 40% 40%, #fff7fa, #ea4c85 75%, transparent 100%);
  animation-duration: 18s;
  animation-delay: -2s;
}

.bg-orb:nth-child(5) {
  width: 140px;
  height: 140px;
  bottom: 18%;
  left: 42%;
  background: radial-gradient(circle at 40% 40%, #ffffff, #ff86b3 70%, transparent 100%);
  animation-duration: 22s;
  animation-delay: -10s;
}

@keyframes orbDrift {
  0% {
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg) scale(1);
  }
  25% {
    transform: translate3d(30px, -25px, 40px) rotateX(15deg) rotateY(20deg) scale(1.08);
  }
  50% {
    transform: translate3d(-20px, 20px, -30px) rotateX(-10deg) rotateY(-15deg) scale(0.95);
  }
  75% {
    transform: translate3d(20px, 30px, 20px) rotateX(10deg) rotateY(10deg) scale(1.05);
  }
  100% {
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-orb,
  .floating-heart {
    animation: none !important;
  }
}

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

.floating-heart {
  position: absolute;
  bottom: -40px;
  font-size: 1.4rem;
  opacity: 0.55;
  animation: floatUp linear infinite;
  will-change: transform;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-110vh) translateX(20px) rotate(25deg);
    opacity: 0;
  }
}

/* -------------------------------------------------------------------------
   Card
   ------------------------------------------------------------------------- */
.card {
  position: relative;
  z-index: 1;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  padding: 48px 36px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  animation: cardEntrance 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(28px) rotateX(8deg) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0deg) scale(1);
  }
}

/* Fallback for browsers without backdrop-filter support (e.g. older Firefox):
   fall back to a mostly-opaque card so text stays readable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card {
    background: #fffaf9;
  }
}

.card h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  margin: 0 0 12px;
  color: var(--color-primary-dark);
}

.card p.subtitle {
  color: var(--color-text-light);
  margin: 0 0 32px;
  font-size: 1.05rem;
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.btn {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  border: none;
  border-radius: 999px;
  padding: 16px 32px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:focus-visible {
  outline: 3px solid var(--color-primary-dark);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-button);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 26px rgba(255, 107, 157, 0.45);
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-primary-dark);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
  background: #ffe0ec;
}

/* The escaping "No" button */
#noBtn {
  position: fixed;
  /* top/left are set dynamically by JS once movement begins.
     0.55s roughly matches ESCAPE_COOLDOWN_MS in index.js so the button
     finishes gliding to its new spot right as it becomes chase-able again. */
  transition: top 0.55s cubic-bezier(0.34, 1.2, 0.4, 1), left 0.55s cubic-bezier(0.34, 1.2, 0.4, 1),
    font-size 0.35s ease, padding 0.35s ease, transform 0.25s ease;
  z-index: 5;
  will-change: top, left;
}

.opinion-link {
  display: inline-block;
  margin-top: 28px;
  font-size: 0.88rem;
  color: var(--color-text-light);
  text-decoration: none;
  border-bottom: 1px dashed var(--color-text-light);
  transition: color 0.18s ease, border-color 0.18s ease;
}

.opinion-link:hover,
.opinion-link:focus-visible {
  color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  margin-top: 8px;
  position: relative;
  min-height: 70px; /* reserve space so layout doesn't jump when No starts moving */
}

/* -------------------------------------------------------------------------
   Forms (date/time picker, admin login)
   ------------------------------------------------------------------------- */
.form-group {
  text-align: left;
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
  font-size: 0.95rem;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid #ffd6e4;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--color-secondary);
  color: var(--color-text);
  transition: border-color 0.18s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.error-message {
  color: var(--color-danger);
  font-size: 0.9rem;
  margin-top: 6px;
  min-height: 1.1em;
}

/* -------------------------------------------------------------------------
   Success page decorations
   ------------------------------------------------------------------------- */
.emoji-hero {
  font-size: 3.4rem;
  margin-bottom: 8px;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

.summary-box {
  background: var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 24px 0;
  font-weight: 600;
  color: var(--color-primary-dark);
}

/* Confetti pieces for the success page */
.confetti-piece {
  position: absolute;
  top: -20px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  z-index: 0;
}

@keyframes confettiFall {
  to {
    transform: translateY(110vh) rotate(360deg);
    opacity: 0.9;
  }
}

/* -------------------------------------------------------------------------
   Admin dashboard
   ------------------------------------------------------------------------- */
.admin-wrapper {
  max-width: 900px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-header h1 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--color-primary-dark);
}

.logout-form {
  margin: 0;
}

table.submissions {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
}

table.submissions th,
table.submissions td {
  padding: 12px 14px;
  border-bottom: 1px solid #ffe3ec;
  font-size: 0.95rem;
}

table.submissions th {
  background: var(--color-secondary);
  color: var(--color-primary-dark);
  font-family: var(--font-heading);
}

.empty-state {
  text-align: center;
  color: var(--color-text-light);
  padding: 40px 20px;
  font-weight: 600;
}

.login-card {
  max-width: 360px;
}

/* -------------------------------------------------------------------------
   Responsive tweaks
   ------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .card {
    padding: 36px 22px;
  }

  .btn {
    padding: 14px 22px;
    font-size: 1rem;
  }

  table.submissions th,
  table.submissions td {
    padding: 8px 8px;
    font-size: 0.82rem;
  }
}
