/* ── Variables ─────────────────────────────────────────────── */
:root {
  --cream:          #FAF6F0;
  --rose:           #C97B85;
  --rose-light:     #E8B4BB;
  --rose-dark:      #A5606A;
  --gold:           #C9A84C;
  --gold-light:     #EEE0B8;
  --burgundy:       #4A1F2E;
  --burgundy-light: #7A4A5A;
  --card-bg:        #FFFFFF;
  --shadow:         rgba(74, 31, 46, 0.10);
  --shadow-soft:    rgba(74, 31, 46, 0.06);
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--cream);
  color: var(--burgundy);
  font-family: 'Lora', Georgia, serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── LOGIN SCREEN ──────────────────────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 24px;
  animation: fadeUp 0.7s ease both;
}

.login-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 52px 44px 44px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow-soft), 0 8px 40px var(--shadow);
  border: 1px solid var(--rose-light);
}

.login-flower {
  display: block;
  font-size: 48px;
  margin-bottom: 18px;
  line-height: 1;
}

.login-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 600;
  color: var(--burgundy);
  margin-bottom: 12px;
  line-height: 1.3;
}

.login-subtitle {
  font-size: 15px;
  color: var(--burgundy-light);
  font-style: italic;
  margin-bottom: 32px;
  line-height: 1.6;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.password-input {
  width: 100%;
  padding: 14px 20px;
  border: 1.5px solid var(--rose-light);
  border-radius: 12px;
  background: var(--cream);
  color: var(--burgundy);
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  text-align: center;
  letter-spacing: 4px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.password-input::placeholder {
  letter-spacing: 0;
  color: var(--rose-light);
}

.password-input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(201, 123, 133, 0.15);
}

.login-btn {
  width: 100%;
  padding: 15px;
  background: var(--rose);
  color: var(--cream);
  border: none;
  border-radius: 12px;
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
  background: var(--rose-dark);
  transform: scale(1.02);
  box-shadow: 0 5px 18px rgba(201, 123, 133, 0.45);
}

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

.login-error {
  margin-top: 18px;
  color: var(--rose-dark);
  font-style: italic;
  font-size: 14px;
  animation: fadeUp 0.3s ease both;
}

/* ── MAIN SITE (Mom's view) ────────────────────────────────── */
.main-site {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
  animation: fadeUp 0.7s ease both;
}

/* ── Decorative flourishes ─────────────────────────────────── */
.flourish-top {
  width: 100%;
  max-width: 380px;
  padding-top: 28px;
  padding-bottom: 4px;
  opacity: 0.75;
}

.flourish-bottom {
  width: 100%;
  max-width: 380px;
  padding-top: 4px;
  padding-bottom: 4px;
  opacity: 0.75;
}

/* ── HEADER ────────────────────────────────────────────────── */
.site-header {
  text-align: center;
  padding: 20px 0 36px;
}

.site-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: clamp(28px, 6.5vw, 48px);
  font-weight: 600;
  color: var(--burgundy);
  line-height: 1.2;
  margin-bottom: 10px;
}

.site-subtitle {
  font-size: clamp(14px, 2.8vw, 17px);
  font-style: italic;
  color: var(--burgundy-light);
  line-height: 1.5;
  margin-bottom: 14px;
}

.progress-text {
  font-size: 13px;
  color: var(--rose);
  letter-spacing: 0.4px;
  min-height: 1.4em;
}

/* ── MAIN CONTENT ──────────────────────────────────────────── */
.main-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  flex: 1;
}

/* ── MEMORY CARD ───────────────────────────────────────────── */
.memory-card {
  width: 100%;
  max-width: 700px;
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow-soft), 0 6px 36px var(--shadow);
  border: 1px solid rgba(201, 123, 133, 0.14);
  transition: opacity 0.4s ease;
}

.memory-card.fading { opacity: 0; }

.memory-photo-wrap {
  width: 100%;
  overflow: hidden;
  background: var(--cream);
}

.memory-photo {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(201, 123, 133, 0.12);
}

.memory-body { padding: 36px 44px 36px; }

.memory-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: clamp(21px, 4vw, 28px);
  font-weight: 600;
  color: var(--burgundy);
  line-height: 1.3;
  margin-bottom: 18px;
}

.memory-text {
  font-size: clamp(15px, 2.4vw, 18px);
  line-height: 1.8;
  color: var(--burgundy);
}

.memory-text p { margin-bottom: 16px; }
.memory-text p:last-child { margin-bottom: 0; }

.memory-author {
  font-size: 15px;
  font-style: italic;
  color: var(--rose);
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--gold-light);
}

/* ── NEXT BUTTON ───────────────────────────────────────────── */
.next-btn {
  display: inline-block;
  padding: 17px 44px;
  background: var(--rose);
  color: var(--cream);
  border: none;
  border-radius: 50px;
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: clamp(17px, 3vw, 20px);
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.next-btn:hover {
  background: var(--rose-dark);
  transform: scale(1.02);
  box-shadow: 0 6px 24px rgba(201, 123, 133, 0.45);
}

.next-btn:active { transform: scale(0.99); }

/* ── COMPLETION SCREEN ─────────────────────────────────────── */
.completion-screen {
  width: 100%;
  max-width: 700px;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 60px 44px 52px;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow-soft), 0 6px 36px var(--shadow);
  border: 1px solid rgba(201, 123, 133, 0.14);
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.6s ease both;
}

.completion-hearts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.heart-float {
  position: absolute;
  bottom: 0;
  animation: floatUp var(--dur, 2.8s) ease-in-out var(--delay, 0s) both;
  opacity: 0;
  line-height: 1;
}

.completion-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: clamp(26px, 6vw, 42px);
  font-weight: 600;
  color: var(--burgundy);
  margin-bottom: 20px;
  position: relative;
}

.completion-message {
  font-size: clamp(15px, 2.5vw, 19px);
  line-height: 1.85;
  color: var(--burgundy-light);
  margin-bottom: 36px;
  position: relative;
}

.restart-btn {
  display: inline-block;
  padding: 14px 38px;
  background: transparent;
  color: var(--rose);
  border: 2px solid var(--rose);
  border-radius: 50px;
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  position: relative;
}

.restart-btn:hover {
  background: var(--rose);
  color: var(--cream);
  transform: scale(1.02);
}

.restart-btn:active { transform: scale(0.99); }

/* ── FOOTER ────────────────────────────────────────────────── */
.site-footer {
  padding: 16px 0 28px;
  text-align: center;
}

.signout-link {
  font-size: 12px;
  color: var(--burgundy-light);
  text-decoration: none;
  opacity: 0.45;
  letter-spacing: 0.4px;
  transition: opacity 0.2s ease;
}

.signout-link:hover {
  opacity: 0.85;
  text-decoration: underline;
}

/* ── KEYFRAMES ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes floatUp {
  0%   { opacity: 0;   transform: translateY(20px)   scale(0.6); }
  15%  { opacity: 0.9; }
  75%  { opacity: 0.6; }
  100% { opacity: 0;   transform: translateY(-160px) scale(1.1); }
}

/* ── RESPONSIVE (Mom's view) ───────────────────────────────── */
@media (max-width: 600px) {
  .login-card    { padding: 36px 24px 32px; }
  .memory-body   { padding: 24px 22px 24px; }
  .completion-screen { padding: 44px 24px 36px; }
  .next-btn      { width: 100%; text-align: center; padding: 16px 24px; }
  .restart-btn   { width: 100%; }
}

/* ════════════════════════════════════════════════════════════
   ADD PAGE STYLES
   ════════════════════════════════════════════════════════════ */

.add-site {
  /* same as .main-site but wider max-width works fine at 780px */
}

.add-header { padding-bottom: 20px; }

.add-title {
  font-size: clamp(24px, 5.5vw, 38px); /* a touch smaller than Mom's big title */
}

.add-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  flex: 1;
  padding-bottom: 48px;
}

/* ── Section cards ─────────────────────────────────────────── */
.add-section {
  width: 100%;
  max-width: 700px;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 36px 44px;
  box-shadow: 0 2px 8px var(--shadow-soft), 0 6px 36px var(--shadow);
  border: 1px solid rgba(201, 123, 133, 0.14);
}

.section-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: clamp(18px, 3.5vw, 24px);
  font-weight: 600;
  color: var(--burgundy);
  margin-bottom: 20px;
}

.section-desc {
  font-size: 14px;
  font-style: italic;
  color: var(--burgundy-light);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ── Form ──────────────────────────────────────────────────── */
.add-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-row-inline {
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group-grow { flex: 1; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--burgundy-light);
  letter-spacing: 0.2px;
}

.form-optional {
  color: var(--rose-light);
  font-weight: 400;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 15px;
  border: 1.5px solid var(--rose-light);
  border-radius: 10px;
  background: var(--cream);
  color: var(--burgundy);
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(201, 123, 133, 0.14);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A4A5A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-textarea {
  resize: vertical;
  line-height: 1.7;
  min-height: 140px;
}

.char-count {
  font-size: 11px;
  color: var(--burgundy-light);
  text-align: right;
  opacity: 0.5;
  margin-top: -4px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* ── Add button ────────────────────────────────────────────── */
.add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 32px;
  background: var(--rose);
  color: var(--cream);
  border: none;
  border-radius: 50px;
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.add-btn:hover {
  background: var(--rose-dark);
  transform: scale(1.02);
  box-shadow: 0 5px 18px rgba(201, 123, 133, 0.45);
}

.add-btn:active { transform: scale(0.99); }

.add-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.count-note {
  font-size: 13px;
  color: var(--rose);
  min-height: 1.4em;
}

/* ── Photo upload ──────────────────────────────────────────── */
.photo-drop-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 24px;
  border: 2px dashed var(--rose-light);
  border-radius: 14px;
  background: var(--cream);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
  margin-bottom: 16px;
}

.photo-drop-label:hover {
  border-color: var(--rose);
  background: rgba(201, 123, 133, 0.04);
}

.photo-drop-icon { font-size: 32px; line-height: 1; }

.photo-drop-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--rose);
}

.photo-drop-sub {
  font-size: 13px;
  font-style: italic;
  color: var(--burgundy-light);
}

.photo-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-queue {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.queue-label {
  font-size: 14px;
  color: var(--burgundy-light);
  flex: 1;
}

/* ── Progress bar ──────────────────────────────────────────── */
.upload-progress { margin-bottom: 12px; }

.progress-track {
  height: 5px;
  background: var(--gold-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--rose);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-label-text {
  font-size: 13px;
  color: var(--burgundy-light);
}

/* ── Thumbnail grid ────────────────────────────────────────── */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--cream);
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(74, 31, 46, 0.72);
  color: #fff;
  border: none;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.thumb-wrap:hover .thumb-del { opacity: 1; }

/* ── Recent memories list ──────────────────────────────────── */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-empty {
  font-style: italic;
  color: var(--burgundy-light);
  font-size: 14px;
}

.recent-item {
  padding: 13px 16px;
  background: var(--cream);
  border-radius: 12px;
  border: 1px solid rgba(201, 123, 133, 0.12);
}

.recent-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}

.recent-author {
  font-size: 13px;
  font-weight: 500;
  font-style: italic;
  color: var(--rose);
}

.recent-time {
  font-size: 12px;
  color: var(--burgundy-light);
  opacity: 0.65;
  flex: 1;
}

.recent-del {
  background: none;
  border: none;
  color: var(--burgundy-light);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.18s ease, color 0.18s ease;
}

.recent-del:hover {
  opacity: 0.9;
  color: var(--rose-dark);
}

.recent-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--burgundy);
  margin-bottom: 3px;
}

.recent-item-text {
  font-size: 13px;
  color: var(--burgundy-light);
  line-height: 1.5;
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 24px;
  border-radius: 50px;
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  box-shadow: 0 4px 20px rgba(74, 31, 46, 0.25);
  z-index: 9999;
  white-space: nowrap;
  max-width: calc(100vw - 48px);
  text-align: center;
  animation: fadeUp 0.3s ease both;
}

.toast.toast-hidden { display: none; }
.toast-ok    { background: var(--burgundy); color: var(--cream); }
.toast-error { background: var(--rose-dark); color: var(--cream); }

/* ── Add footer ────────────────────────────────────────────── */
.add-footer { display: flex; align-items: center; justify-content: center; gap: 4px; }

.footer-sep {
  color: var(--burgundy-light);
  opacity: 0.4;
  font-size: 12px;
  margin: 0 4px;
}

/* ── RESPONSIVE (add page) ─────────────────────────────────── */
@media (max-width: 600px) {
  .add-section { padding: 24px 20px; }

  .form-row-inline {
    flex-direction: column;
  }

  .form-actions { flex-direction: column; align-items: flex-start; }

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

  /* Always show delete buttons on mobile (no hover) */
  .thumb-del { opacity: 1; }
}
