/* ═══════════════════════════════════════════
   daily-letter.css — Daily Love Letter 💌
   (trigger, board, lịch sử, modal viết thư, toast nhắc)
   ═══════════════════════════════════════════ */

/* ─── Trigger button ─── */
.daily-trigger {
  position: fixed;
  bottom: 1.6rem;
  left: 1.4rem;
  z-index: 900;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,192,203,0.5);
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rose-gold);
  box-shadow: 0 4px 20px rgba(201,132,142,0.22), 0 1px 4px rgba(201,132,142,0.12);
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), background 0.25s, box-shadow 0.25s;
}
.daily-trigger:hover {
  transform: scale(1.12);
  background: rgba(255,192,203,0.3);
  box-shadow: 0 6px 24px rgba(201,132,142,0.32);
}
.daily-trigger:active { transform: scale(0.94); }

html.dark .daily-trigger {
  background: rgba(20,10,15,0.55);
  border-color: rgba(242,167,187,0.3);
}
html.dusk .daily-trigger {
  background: rgba(37,19,24,0.6);
  border-color: rgba(232,149,106,0.3);
}
html.dawn .daily-trigger {
  background: rgba(255,253,248,0.35);
  border-color: rgba(232,148,106,0.35);
}

/* Unread dot */
.daily-icon-unread { position: relative; display: flex; align-items: center; justify-content: center; }
.daily-unread-dot {
  position: absolute;
  top: -3px;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F9A7BB, #E07090);
  border: 1.5px solid rgba(255,255,255,0.9);
  animation: daily-dot-pulse 2s ease-in-out infinite;
}
@keyframes daily-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242,107,139,0.45); }
  50%       { box-shadow: 0 0 0 5px rgba(242,107,139,0); }
}
html.dark .daily-unread-dot { border-color: rgba(26,16,21,0.9); }

/* ─── Overlay backdrop ─── */
.daily-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 0 5.2rem 1.4rem;
  pointer-events: none;
}
.daily-overlay.active { pointer-events: auto; }

/* ─── The board itself ─── */
.daily-board {
  position: relative;
  width: min(400px, calc(100vw - 2.8rem));
  background: var(--bg-letter-card);
  border: 1px solid var(--border-card);
  border-radius: 18px;
  box-shadow:
    0 8px 40px rgba(201,132,142,0.18),
    0 2px 8px rgba(201,132,142,0.1),
    inset 0 0 0 1px rgba(255,255,255,0.6);
  padding: 1.6rem 1.6rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 80vh;
  overflow: hidden;

  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.35s cubic-bezier(0.4,0,0.2,1),
              transform 0.35s cubic-bezier(0.34,1.3,0.64,1);
  pointer-events: none;
}
.daily-board.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

html.dark .daily-board {
  background: var(--bg-letter-card);
  border-color: rgba(242,167,187,0.14);
  box-shadow: 0 8px 40px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(242,167,187,0.06);
}
html.dusk .daily-board {
  box-shadow: 0 8px 40px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(232,149,106,0.1);
}

/* Close button */
.daily-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-card);
  background: rgba(255,192,203,0.1);
  color: var(--rose-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s, transform 0.2s;
}
.daily-close:hover { opacity: 1; background: rgba(255,192,203,0.22); transform: scale(1.1); }

/* ─── Header ─── */
.daily-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.1rem;
}
.daily-deco-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--petal), transparent);
  opacity: 0.6;
}
.daily-title {
  font-family: 'Cormorant Garamond', 'Lora', serif;
  font-size: 1.05rem;
  font-weight: 400;
  font-style: italic;
  color: var(--rose-gold);
  letter-spacing: 0.04em;
  white-space: nowrap;
  margin: 0;
}

/* Date line */
.daily-date {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--mauve);
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.3rem;
  opacity: 0.8;
}

/* ─── Content area ─── */
.daily-content {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--petal) transparent;
  padding-right: 0.3rem;
  min-height: 80px;
  max-height: calc(80vh - 200px);
}
.daily-content::-webkit-scrollbar { width: 3px; }
.daily-content::-webkit-scrollbar-thumb { background: var(--petal); border-radius: 2px; }

/* Letter typography */
.daily-content p, .daily-letter-text {
  font-family: 'Lora', 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--ink);
  margin: 0 0 0.8em;
  white-space: pre-wrap;
}
.daily-empty {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.88rem;
  color: var(--mauve);
  text-align: center;
  padding: 1.2rem 0;
  opacity: 0.75;
}

/* ─── Footer ─── */
.daily-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-card);
  gap: 0.5rem;
}
.daily-history-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--mauve);
  background: none;
  border: 1px solid var(--border-card);
  border-radius: 50px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s, background 0.2s, transform 0.15s;
}
.daily-history-btn:hover {
  opacity: 1;
  background: rgba(255,192,203,0.12);
  transform: translateY(-1px);
}

/* Write button in daily footer */
.daily-write-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--bg-letter-card);
  background: var(--rose-gold);
  border: 1px solid transparent;
  border-radius: 50px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.2s, background 0.2s, transform 0.15s;
}
.daily-write-btn:hover {
  opacity: 1;
  background: var(--blush);
  transform: translateY(-1px);
}

/* ─── History board ─── */
.daily-history-board { max-height: 75vh; }

.history-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--petal) transparent;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 0.3rem;
  max-height: calc(75vh - 180px);
}
.history-list::-webkit-scrollbar { width: 3px; }
.history-list::-webkit-scrollbar-thumb { background: var(--petal); border-radius: 2px; }

.history-item {
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: rgba(255,192,203,0.04);
}
.history-item-date {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--mauve);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
  opacity: 0.7;
}
.history-item-text {
  font-family: 'Lora', serif;
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  margin: 0;
}
.history-empty {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.88rem;
  color: var(--mauve);
  text-align: center;
  padding: 2rem 0;
  opacity: 0.7;
}
.history-item-author {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.67rem;
  color: var(--rose-gold);
  background: rgba(242,167,187,0.12);
  border: 1px solid rgba(242,167,187,0.28);
  border-radius: 50px;
  padding: 1px 0.55rem;
  margin-left: 0.45rem;
  vertical-align: middle;
  font-family: 'Be Vietnam Pro', sans-serif;
  letter-spacing: 0.03em;
}

/* Decoration hearts scattered */
.daily-board::before {
  content: '✦';
  position: absolute;
  top: 0.65rem;
  left: 1rem;
  font-size: 0.55rem;
  color: var(--petal);
  opacity: 0.5;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   WRITE LOVE LETTER MODAL 💌
   ═══════════════════════════════════════════ */

.write-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(30, 8, 16, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.4,0,0.2,1);
}
.write-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.write-board {
  position: relative;
  width: min(480px, calc(100vw - 2.4rem));
  background: var(--bg-letter-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  box-shadow:
    0 12px 60px rgba(201,132,142,0.22),
    0 2px 12px rgba(201,132,142,0.12),
    inset 0 0 0 1px rgba(255,255,255,0.55);
  padding: 1.8rem 1.8rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 90vh;
  overflow: hidden;

  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.35s cubic-bezier(0.4,0,0.2,1),
              transform 0.35s cubic-bezier(0.34,1.3,0.64,1);
}
.write-overlay.active .write-board {
  opacity: 1;
  transform: translateY(0) scale(1);
}
html.dark .write-board {
  background: var(--bg-letter-card);
  border-color: rgba(242,167,187,0.14);
  box-shadow: 0 12px 60px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(242,167,187,0.06);
}
html.dusk .write-board {
  box-shadow: 0 12px 60px rgba(0,0,0,0.42), inset 0 0 0 1px rgba(232,149,106,0.1);
}

/* ─── Author selector row ─── */
.write-author-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.write-author-label {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--mauve);
  letter-spacing: 0.04em;
  opacity: 0.85;
  white-space: nowrap;
}
.write-author-pills {
  display: flex;
  gap: 0.5rem;
}
.write-author-pill {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--soft-ink);
  background: rgba(255,192,203,0.08);
  border: 1.5px solid var(--border-card);
  border-radius: 50px;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
.write-author-pill:hover {
  background: rgba(255,192,203,0.18);
  border-color: rgba(242,167,187,0.5);
  color: var(--rose-gold);
}
.write-author-pill.active {
  background: rgba(242,167,187,0.18);
  border-color: var(--blush);
  color: var(--rose-gold);
}
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-card);
  transition: background 0.2s;
}
.write-author-pill.active .pill-dot {
  background: var(--blush);
}
.pill-emoji {
  font-size: 0.95rem;
  line-height: 1;
}

/* ─── Textarea wrapper ─── */
.write-textarea-wrap {
  position: relative;
  flex: 1;
}
.write-textarea {
  width: 100%;
  min-height: 180px;
  max-height: calc(90vh - 320px);
  resize: vertical;
  background: rgba(255,192,203,0.04);
  border: 1.5px solid var(--border-card);
  border-radius: 14px;
  padding: 1rem 1.1rem 2rem;
  font-family: 'Lora', 'Cormorant Garamond', serif;
  font-size: 0.93rem;
  line-height: 1.85;
  color: var(--ink);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s;
}
.write-textarea::placeholder {
  color: var(--mauve);
  opacity: 0.5;
  font-style: italic;
}
.write-textarea:focus {
  border-color: rgba(242,167,187,0.6);
  background: rgba(255,192,203,0.06);
}
html.dark .write-textarea {
  background: rgba(255,192,203,0.03);
  color: var(--ink);
}
.write-char-count {
  position: absolute;
  bottom: 0.55rem;
  right: 0.8rem;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.65rem;
  color: var(--mauve);
  opacity: 0.5;
  pointer-events: none;
}

/* ─── Actions row ─── */
.write-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  padding-top: 0.2rem;
}
.write-btn-cancel {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--mauve);
  background: none;
  border: 1px solid var(--border-card);
  border-radius: 50px;
  padding: 0.42rem 1rem;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s, background 0.2s;
}
.write-btn-cancel:hover {
  opacity: 1;
  background: rgba(255,192,203,0.1);
}
.write-btn-submit {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--bg-letter-card);
  background: var(--rose-gold);
  border: 1px solid transparent;
  border-radius: 50px;
  padding: 0.42rem 1.15rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
}
.write-btn-submit:hover {
  background: var(--blush);
  transform: translateY(-1px);
}
.write-btn-submit:active {
  transform: translateY(0);
}
.write-btn-submit[disabled],
.write-btn-submit[style*="pointer-events: none"] {
  opacity: 0.6 !important;
  cursor: wait;
}

/* ─── Success toast ─── */
.write-success {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(242,167,187,0.18);
  border: 1px solid rgba(242,167,187,0.45);
  border-radius: 50px;
  padding: 0.4rem 1.2rem;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.8rem;
  color: var(--rose-gold);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.write-success.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Author signature shown in daily letter ─── */
.daily-author-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--rose-gold);
  background: rgba(242,167,187,0.12);
  border: 1px solid rgba(242,167,187,0.3);
  border-radius: 50px;
  padding: 2px 0.7rem;
  margin-bottom: 0.6rem;
  letter-spacing: 0.04em;
}

/* ─── Mobile adjustments ─── */
@media (max-width: 480px) {
  .write-board {
    padding: 1.4rem 1.2rem 1.1rem;
    border-radius: 18px;
  }
  .write-textarea {
    min-height: 140px;
    font-size: 0.9rem;
  }
  .write-author-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }
  .daily-footer {
    flex-wrap: wrap;
  }
}

/* ═══════════════════════════════════════════
   WRITE REMINDER TOAST 💌
   ═══════════════════════════════════════════ */
.write-reminder-toast {
  position: fixed;
  bottom: 5.6rem;
  left: 1.4rem;
  z-index: 940;
  max-width: calc(100vw - 2.8rem);
  width: 300px;
  background: var(--bg-letter-card);
  border: 1px solid rgba(242,167,187,0.35);
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(201,132,142,0.22),
    0 2px 8px rgba(201,132,142,0.1),
    inset 0 0 0 1px rgba(255,255,255,0.5);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34,1.3,0.64,1);
  pointer-events: none;
}
.write-reminder-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
html.dark .write-reminder-toast {
  border-color: rgba(242,167,187,0.18);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(242,167,187,0.06);
}

.wrt-inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem;
  cursor: pointer;
}
.wrt-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,192,203,0.15);
  border: 1px solid rgba(242,167,187,0.3);
  display: flex; align-items: center; justify-content: center;
  color: var(--rose-gold);
}
.wrt-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.wrt-title {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.3;
}
.wrt-sub {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--mauve);
  opacity: 0.75;
}
.wrt-btn {
  flex-shrink: 0;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  color: white;
  background: linear-gradient(135deg, var(--petal), var(--blush));
  border: none;
  border-radius: 50px;
  padding: 0.32rem 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(201,132,142,0.3);
  transition: opacity 0.2s, transform 0.15s;
}
.wrt-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.wrt-dismiss {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-card);
  background: transparent;
  color: var(--mauve);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s;
}
.wrt-dismiss:hover { opacity: 1; background: rgba(255,192,203,0.15); }
