/* ===== CSS CUSTOM PROPERTIES =====
   Define the color palette and typography once here.
   Referencing variables (var(--name)) throughout keeps changes centralized. */
:root {
  --color-bg:        #FFF0F5; /* very light rose – page background */
  --color-primary:   #FF85A2; /* medium pink – buttons, accents */
  --color-light:     #FFB6C1; /* light pink – borders, soft highlights */
  --color-dark:      #C2185B; /* deep rose – hover states */
  --color-text:      #4a2030; /* dark rose-brown – body text */
  --color-muted:     #a06080; /* muted rose – secondary text, date */
  --color-white:     #ffffff;

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Lato', Arial, sans-serif;

  --radius: 16px;
  --shadow: 0 4px 24px rgba(194, 24, 91, 0.10);
}

/* ===== RESET & BASE =====
   Minimal reset so default browser styles don't interfere. */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  /* Center everything vertically and horizontally */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

/* ===== FLORAL BACKGROUND DECORATION =====
   Pure CSS, no external images. Uses ::before on body to draw
   a soft decorative element behind the card. */
body::before {
  content: '✿ ✾ ✿';
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem;
  color: var(--color-light);
  letter-spacing: 12px;
  pointer-events: none;
  user-select: none;
}

body::after {
  content: '✿ ✾ ✿';
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem;
  color: var(--color-light);
  letter-spacing: 12px;
  pointer-events: none;
  user-select: none;
}

/* ===== CARD =====
   The single centered card that contains either the login screen or the app. */
.card {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  padding: 40px 32px;
  position: relative;
  /* Decorative top border in primary pink */
  border-top: 4px solid var(--color-primary);
}

/* Small flower accent top-center of the card */
.card::before {
  content: '🌸';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  line-height: 1;
}

/* ===== LOGIN SCREEN ===== */
#login-screen h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 8px;
}

#login-screen .subtitle {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

#login-screen label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#login-screen input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-light);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 20px;
}

#login-screen input[type="password"]:focus {
  border-color: var(--color-primary);
}

#login-btn {
  width: 100%;
  padding: 14px;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#login-btn:hover {
  background: var(--color-dark);
}

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

#login-error {
  /* Hidden by default; shown via JS when password is wrong */
  display: none;
  color: #c0392b;
  font-size: 0.9rem;
  text-align: center;
  margin-top: 12px;
}

/* ===== APP SCREEN ===== */
#app-screen {
  /* Hidden by default; shown via JS after successful login */
  display: none;
}

.app-date {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
  text-align: center;
}

.app-message {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  line-height: 1.6;
  color: var(--color-text);
  text-align: center;
  margin-bottom: 32px;
  /* Subtle italic for warmth */
  font-style: italic;
}

/* Decorative opening quote mark */
.app-message::before {
  content: '\201C'; /* left double quotation mark " */
  display: block;
  font-size: 3rem;
  color: var(--color-light);
  line-height: 0.5;
  margin-bottom: 12px;
}

.app-archive-link {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-bottom: 24px;
}

.app-archive-link:hover {
  color: var(--color-primary);
}

/* ===== ARCHIVE VIEW ===== */
#archive-view {
  display: none;
}

#archive-view h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--color-primary);
  margin-bottom: 16px;
  text-align: center;
}

.archive-back {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-bottom: 20px;
}

.archive-back:hover {
  color: var(--color-primary);
}

.archive-list {
  list-style: none;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.archive-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-bg);
}

.archive-list li:last-child {
  border-bottom: none;
}

.archive-entry-date {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.archive-entry-text {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-style: italic;
  color: var(--color-text);
}

/* ===== INSTALL HINT (iOS) =====
   Shown only on iOS Safari when not already running in standalone mode. */
#install-hint {
  display: none; /* shown conditionally by app.js */
  background: var(--color-bg);
  border: 1px solid var(--color-light);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: center;
  margin-top: 16px;
  line-height: 1.5;
}

/* ===== RESPONSIVE ADJUSTMENTS =====
   On wider screens add a little more breathing room. */
@media (min-width: 480px) {
  .card {
    padding: 48px 40px;
  }

  .app-message {
    font-size: 1.55rem;
  }
}
