/* ============================================
   EchoSpark - Stylesheet
   Warm healing theme — like opening a photo album
   Mobile-first, cozy, serif, soft shadows
   ============================================ */

:root {
  /* Background — warm beige */
  --bg-primary: #faf0e6;
  --bg-secondary: #f5ebe0;

  /* Cards — pure white with warm shadow */
  --bg-card: #ffffff;

  /* Accents — warm orange & coral */
  --accent: #e8a87c;
  --accent-hover: #d48c6b;
  --accent-gradient: linear-gradient(135deg, #e8a87c 0%, #d48c6b 100%);
  --coral: #f5cba7;

  /* Text — deep brown & warm gray */
  --text-primary: #4a3728;
  --text-secondary: #8d7b6e;
  --text-muted: #b0a290;

  /* Borders */
  --border-light: #f0e6d8;

  /* Status */
  --success: #81b29a;
  --error: #d68a7a;
  --warning: #e8c87c;

  /* Geometry */
  --radius: 20px;
  --radius-sm: 12px;
  --radius-pill: 50px;

  /* Shadows */
  --shadow-soft: 0 8px 30px rgba(180, 140, 110, 0.15);
  --shadow-hover: 0 12px 40px rgba(180, 140, 110, 0.25);

  /* Transition */
  --transition: 0.3s ease;
}

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

html, body {
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  font-family: 'Georgia', 'Merriweather', 'Noto Serif SC', serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  line-height: 1.7;
}

/* ===== Cards ===== */

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 36px 28px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-soft);
  animation: fadeIn 0.5s ease;
  border: 1px solid var(--border-light);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Upload Card ===== */

.upload-card .upload-icon {
  font-size: 3.2rem;
  margin-bottom: 8px;
}

.title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent-hover);
  letter-spacing: -0.3px;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.7;
}

.constraints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}

.badge {
  display: inline-block;
  background: var(--coral);
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  font-size: 0.75rem;
  color: var(--text-primary);
  font-family: 'Georgia', serif;
}

/* ===== Upload Button ===== */

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 16px 36px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-height: 56px;
  min-width: 240px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Georgia', serif;
}

.upload-btn:hover,
.upload-btn:active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  filter: brightness(1.05);
}

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

.hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 16px;
  line-height: 1.6;
}

/* ===== Inline Error ===== */

.inline-error {
  background: rgba(214, 138, 122, 0.12);
  border: 1px solid rgba(214, 138, 122, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--error);
  text-align: left;
}

/* ===== Progress Bar ===== */

.progress-container {
  width: 100%;
  height: 10px;
  background: var(--border-light);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 20px 0 8px;
}

.progress-bar {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ===== Player Card ===== */

.player-card {
  padding: 28px 20px;
}

.player-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.player-container {
  width: 100%;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.player-container video,
.player-container audio {
  outline: none;
  width: 100%;
  border-radius: var(--radius-sm);
}

.player-container video {
  border: 3px solid var(--border-light);
  box-shadow: var(--shadow-soft);
}

/* Album label decoration under player */
.player-card::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--accent);
  border-radius: var(--radius-pill);
  margin: 12px auto 0;
}

/* ===== Loading Card ===== */

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Success Card ===== */

.success-card .success-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

/* ===== Error Card ===== */

.error-card .error-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.btn-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 36px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  font-family: 'Georgia', serif;
}

.btn-retry:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  filter: brightness(1.05);
}

/* ===== Mock Banner ===== */

.mock-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--warning);
  color: var(--text-primary);
  text-align: center;
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 9999;
  font-family: 'Georgia', serif;
}

/* ===== Toast ===== */

.toast {
  background: var(--coral);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* Fixed-position toast (e.g. "link adjusted to the SKU on this tag") */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--coral);
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 8px 30px rgba(180, 140, 110, 0.25);
  z-index: 10001;
  animation: appToastIn 0.3s ease;
  transition: opacity 0.3s ease;
}

@keyframes appToastIn {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.app-toast-fadeout {
  opacity: 0;
}

.error-text {
  color: var(--error);
  font-size: 0.9rem;
  padding: 16px;
}

/* ===== Preview Card ===== */

.preview-card {
  padding: 32px 24px;
}

.preview-card .upload-icon {
  font-size: 2.6rem;
  margin-bottom: 4px;
}

.preview-media-container {
  width: 100%;
  margin: 16px 0 20px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.preview-media {
  width: 100%;
  outline: none;
  border-radius: var(--radius-sm);
}

.preview-media.video {
  border: 3px solid var(--border-light);
  box-shadow: var(--shadow-soft);
}

.preview-media.audio {
  width: 100%;
}

/* File info display */
.file-info {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 24px;
  text-align: left;
}

.file-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}

.file-info-row:last-child {
  border-bottom: none;
}

.file-info-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.file-info-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  max-width: 60%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Preview action buttons */
.preview-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
}

.btn-reselect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 14px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  font-family: 'Georgia', serif;
  flex: 1;
  max-width: 180px;
}

.btn-reselect:hover {
  background: var(--border-light);
  transform: translateY(-1px);
}

.btn-confirm-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 14px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  font-family: 'Georgia', serif;
  flex: 1;
  max-width: 180px;
}

.btn-confirm-upload:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  filter: brightness(1.05);
}

/* ===== Back to Album Link ===== */

.back-to-album {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  transition: var(--transition);
  font-family: 'Georgia', serif;
}

.back-to-album:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

/* ===== Brand header — shared by the photo page and the album page =====
   Same markup (`.brand` > logo + `.brand-text`) on both pages, styled here
   once, so logo size, spacing, colours and narrow-screen behaviour are
   identical everywhere. */

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 0 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-light);
}

.brand .brand-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(180, 140, 110, 0.18);
}

.brand .brand-text {
  /* Hug the content instead of filling the row, so the logo + text group
     centres as a unit and the text is centred within it. */
  flex: 0 1 auto;
  min-width: 0;
  text-align: center;
}

.brand .brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-hover);
  letter-spacing: 0.2px;
  margin: 0 0 2px;
}

.brand .brand-tagline {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.55;
  margin: 0;
}

/* ===== Story Section (Preview) ===== */

.story-section {
  margin-bottom: 24px;
  text-align: left;
}

.story-label {
  display: block;
  font-size: 0.85rem;
  color: #8d7b6e;
  font-weight: 600;
  margin-bottom: 8px;
  font-family: 'Georgia', serif;
}

.story-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #f0e6d8;
  border-radius: 12px;
  font-family: 'Georgia', serif;
  font-size: 0.9rem;
  color: #4a3728;
  background: #faf0e6;
  outline: none;
  resize: vertical;
  min-height: 70px;
  transition: border-color 0.2s;
  line-height: 1.6;
}

.story-textarea:focus {
  border-color: #e8a87c;
}

.story-counter {
  font-size: 0.75rem;
  color: #8d7b6e;
  text-align: right;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ===== Player Story Display ===== */

.player-story {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f5ebe0;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 12px 0;
  font-style: italic;
  color: #4a3728;
  font-size: 0.88rem;
  line-height: 1.7;
  text-align: left;
}

.player-story .story-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.player-story .story-text {
  flex: 1;
}

/* ===== Share Section (in Player Page) ===== */

/* Sharing is a secondary action: quiet background, small type, text-style
   button — it should never compete with the story itself. */

.share-section {
  background: #fdf8f3;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 16px 0 8px;
  border: 1px solid var(--border-light);
}

.share-title {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 0;
  font-family: 'Georgia', serif;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* Default .hint carries a 16px top margin meant for standalone paragraphs. */
.share-section .hint {
  margin: 0 0 8px;
  font-size: 0.76rem;
}

.share-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 0 8px;
}

.btn-copy-link {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Georgia', serif;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-copy-link:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.qr-code-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px;
}

/* ===== Language Toggle ===== */

#lang-toggle .lang-btn:hover {
  opacity: 0.85;
}

/* ===== Responsive: Desktop ===== */

@media (min-width: 768px) {
  .card {
    max-width: 520px;
    padding: 44px 36px;
  }

  .title {
    font-size: 1.85rem;
  }

  .upload-card .upload-icon {
    font-size: 4rem;
  }

  .subtitle {
    font-size: 1.08rem;
  }
}

/* ===== Responsive: narrow phones =====
   Brand scales down here so both pages shrink identically; the logo keeps a
   fixed size (never squeezed) and the tagline wraps instead. */

@media (max-width: 480px) {
  .brand {
    gap: 12px;
  }

  .brand .brand-logo {
    width: 56px;
    height: 56px;
  }

  .brand .brand-tagline {
    font-size: 0.76rem;
  }
}
