/* ============================================
   Pick Our First Dance Song - Wedding Theme
   Spring / Light Blue / Elegant
   ============================================ */

:root {
  --primary: #5B9BD5;
  --primary-dark: #3A7FC1;
  --primary-light: #9DC4E8;
  --primary-lightest: #E6F0FA;
  --secondary: #A8C5A0;
  --secondary-light: #D4E4D0;
  --gold: #D4AF37;
  --gold-light: #F0E4B8;
  --text-dark: #2C3E50;
  --text-body: #4A5568;
  --text-light: #718096;
  --white: #FFFFFF;
  --danger: #E53E3E;
  --danger-hover: #C53030;
  --card-shadow: 0 2px 12px rgba(123, 167, 201, 0.15);
  --card-shadow-hover: 0 4px 20px rgba(123, 167, 201, 0.25);
}

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

body {
  font-family: "Lato", sans-serif;
  font-weight: 300;
  color: var(--text-body);
  background-color: var(--primary-lightest);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- Falling Petals ---- */

.petals-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.petal {
  position: absolute;
  top: -40px;
  opacity: 0;
  animation: petalFall linear forwards;
  will-change: transform, opacity;
}

/* Petal SVG shapes via background - soft organic look */
.petal::before {
  content: "";
  display: block;
  border-radius: 50% 0 50% 0;
}

/* Size variants */
.petal--sm::before { width: 10px; height: 14px; }
.petal--md::before { width: 14px; height: 18px; }
.petal--lg::before { width: 18px; height: 24px; }

/* Color variants - soft spring palette */
.petal--blush::before  { background: rgba(220, 180, 190, 0.25); }
.petal--pink::before   { background: rgba(200, 160, 180, 0.20); }
.petal--blue::before   { background: rgba(91, 155, 213, 0.20); }
.petal--sage::before   { background: rgba(168, 197, 160, 0.18); }
.petal--cream::before  { background: rgba(212, 175, 55, 0.12); }

@keyframes petalFall {
  0% {
    opacity: 0;
    transform: translateY(0) translateX(0) rotate(0deg) scale(0.8);
  }
  8% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(calc(100vh + 40px)) translateX(var(--drift)) rotate(var(--spin)) scale(1);
  }
}

/* ---- Layout ---- */

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* ---- Typography ---- */

h1,
h2,
h3 {
  font-family: "Libre Baskerville", Georgia, serif;
  color: var(--text-dark);
  font-weight: 600;
}

/* ---- Floral Accents ---- */

.floral-accent {
  text-align: center;
  padding: 8px 0;
  color: var(--secondary);
  font-size: 1rem;
  opacity: 0.5;
  letter-spacing: 0.4em;
  user-select: none;
}

.floral-accent.top::before {
  content: "\2740 \2740 \2740";
}

.floral-accent.bottom::before {
  content: "\2740 \2740 \2740";
}

/* ---- Hero Header ---- */

.hero {
  text-align: center;
  padding: 16px 0 24px;
}

.hero h1 {
  font-size: 1.7rem;
  font-style: italic;
  line-height: 1.3;
  margin: 12px 0 8px;
  color: var(--text-dark);
}

.subtitle {
  font-family: "Lato", sans-serif;
  font-weight: 300;
  font-style: italic;
  color: var(--text-light);
  font-size: 1rem;
  letter-spacing: 0.05em;
}

/* ---- Song Grid ---- */

.song-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* ---- Song Card ---- */

.song-card {
  background: var(--white);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  border: 1px solid rgba(123, 167, 201, 0.1);
}

.song-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-1px);
}

.album-art {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background-color: var(--primary-light);
}

.song-info {
  flex: 1;
  min-width: 0;
}

.song-title {
  font-family: "Libre Baskerville", serif;
  font-size: 1.1rem;
  margin: 0 0 4px;
  color: var(--text-dark);
}

.song-artist {
  font-size: 0.9rem;
  color: var(--text-light);
  margin: 0;
}

/* ---- Play Button ---- */

.btn-play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.btn-play:hover {
  background: var(--primary);
}

.btn-play:hover svg {
  fill: var(--white);
}

.btn-play svg {
  width: 20px;
  height: 20px;
  fill: var(--primary-dark);
  transition: fill 0.2s;
}

.btn-play.playing {
  background: var(--primary);
}

.btn-play.playing svg {
  fill: var(--white);
}

/* ---- Audio Progress Bar ---- */

.audio-progress {
  width: 100%;
  height: 4px;
  background: var(--primary-lightest);
  border-radius: 2px;
  overflow: hidden;
  display: none;
}

.audio-progress.active {
  display: block;
}

.audio-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s linear;
}

/* ---- Vote Button ---- */

.btn-vote {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: "Lato", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-vote:hover {
  background: var(--primary-dark);
}

.btn-vote:active {
  transform: scale(0.98);
}

/* ---- General Buttons ---- */

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-family: "Lato", sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  background: var(--primary);
  color: var(--white);
}

.btn:hover {
  background: var(--primary-dark);
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-secondary:hover {
  background: var(--primary-lightest);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* ---- Message Card (confirmation / closed) ---- */

.message-card {
  text-align: center;
  padding: 48px 24px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(123, 167, 201, 0.1);
}

.message-card h2 {
  color: var(--primary);
  font-style: italic;
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.message-card p {
  font-size: 1.05rem;
  color: var(--text-light);
  margin-bottom: 20px;
  line-height: 1.5;
}

.message-card .btn {
  margin-top: 8px;
}

/* ---- Footer ---- */

footer {
  margin-top: auto;
  padding-top: 24px;
}

/* ---- Loading Spinner ---- */

.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-light);
  font-style: italic;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* ============================================
   Admin Panel Styles
   ============================================ */

.admin-body {
  background: var(--primary-lightest);
  font-family: "Lato", sans-serif;
  overflow-x: hidden;
}

.admin-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  position: relative;
  z-index: 1;
}

.admin-header {
  text-align: center;
  padding: 16px 0 24px;
}

.admin-header h1 {
  font-family: "Libre Baskerville", serif;
  font-size: 1.5rem;
  color: var(--text-dark);
}

/* ---- Admin Login Gate ---- */

.login-gate {
  max-width: 360px;
  margin: 80px auto;
  text-align: center;
  background: var(--white);
  padding: 32px 24px;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  position: relative;
  z-index: 1;
}

.login-gate h2 {
  font-family: "Libre Baskerville", serif;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.login-gate input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 12px;
  font-family: "Lato", sans-serif;
}

.login-gate input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(123, 167, 201, 0.2);
}

.login-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: none;
}

/* ---- Admin Sections ---- */

.admin-section {
  background: var(--white);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.admin-section h2 {
  font-family: "Libre Baskerville", serif;
  font-size: 1.2rem;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.admin-section h3 {
  font-size: 1rem;
  margin: 16px 0 12px;
}

/* ---- Status Indicator ---- */

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 400;
}

.status-badge.open {
  background: #c6f6d5;
  color: #276749;
}

.status-badge.closed {
  background: #fed7d7;
  color: #9b2c2c;
}

.admin-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Results Bar Chart ---- */

.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.result-song-name {
  font-weight: 400;
  color: var(--text-dark);
}

.result-count {
  font-weight: 700;
  color: var(--primary-dark);
}

.result-bar {
  height: 28px;
  background: var(--primary-lightest);
  border-radius: 4px;
  overflow: hidden;
}

.result-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 2px;
}

.total-votes {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--text-light);
  text-align: right;
}

/* ---- Song Manager ---- */

.song-manager-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.song-manager-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--primary-lightest);
  border-radius: 8px;
}

.song-manager-item .album-art {
  width: 48px;
  height: 48px;
  border-radius: 6px;
}

.song-manager-info {
  flex: 1;
  min-width: 0;
}

.song-manager-info .song-title {
  font-size: 0.95rem;
}

.song-manager-info .song-artist {
  font-size: 0.85rem;
}

.song-manager-actions {
  display: flex;
  gap: 6px;
}

.audio-indicator {
  font-size: 0.8rem;
  color: var(--secondary);
  margin-top: 2px;
}

.audio-indicator.missing {
  color: var(--danger);
}

/* ---- Add Song Form ---- */

.add-song-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.add-song-form input[type="text"],
.add-song-form input[type="url"] {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: "Lato", sans-serif;
}

.add-song-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(123, 167, 201, 0.2);
}

.file-upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.file-upload-row input[type="file"] {
  font-size: 0.9rem;
  font-family: "Lato", sans-serif;
}

/* ---- QR Code Section ---- */

.qr-section {
  text-align: center;
}

.qr-code-container {
  display: inline-block;
  padding: 16px;
  background: var(--white);
  border-radius: 8px;
  border: 2px solid var(--primary-light);
  margin: 12px 0;
}

.qr-url {
  font-size: 0.85rem;
  color: var(--text-light);
  word-break: break-all;
  margin-top: 8px;
}

/* ---- Edit Modal ---- */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal h3 {
  font-family: "Libre Baskerville", serif;
  margin-bottom: 16px;
}

.modal .add-song-form {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ---- Toast Notification ---- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-dark);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 2000;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---- Responsive ---- */

@media (min-width: 600px) {
  .container {
    padding: 32px 24px 48px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .admin-container {
    padding: 32px 24px 48px;
  }
}
