/**
 * Memorial View 展示頁完整樣式
 * 移植自 Rainbow Bridge 星空療癒風主題
 * 支援 8 種主題：starry, sunset, sakura, forest, ocean, minimal, eternal, autumn
 */

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

html {
  scroll-behavior: smooth;
}

body.memorial-view-page {
  font-family: "Noto Serif TC", "Noto Sans TC", serif;
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.8;
  overflow-x: hidden;
}

/* ===== Theme Variables ===== */
/* Starry (Default) */
body.theme-starry {
  background: #0d0d1a;
  color: #eee;
  --theme-text: #eee;
  --theme-text-muted: #aaa;
  --theme-accent: #e94560;
  --theme-star: #f1c40f;
  --theme-card-bg: rgba(255, 255, 255, 0.05);
  --theme-border: rgba(255, 255, 255, 0.1);
  --theme-wave-color: #0d0d1a;
}

/* Sunset */
body.theme-sunset {
  background: #1a0a0a;
  color: #fff5e6;
  --theme-text: #fff5e6;
  --theme-text-muted: #d4a574;
  --theme-accent: #ff6b35;
  --theme-star: #ffd700;
  --theme-card-bg: rgba(255, 200, 150, 0.08);
  --theme-border: rgba(255, 150, 100, 0.15);
  --theme-wave-color: #1a0a0a;
}

/* Cloud */
body.theme-cloud {
  background: #8acfea;
  color: #1a3a5c;
  --theme-text: #1a3a5c;
  --theme-text-muted: #3a5a7a;
  --theme-accent: #2980b9;
  --theme-star: #74b9ff;
  --theme-card-bg: rgba(255, 255, 255, 0.7);
  --theme-border: rgba(100, 150, 200, 0.2);
  --theme-wave-color: #8acfea;
}

/* Sakura */
body.theme-sakura {
  background: #2d1a2d;
  color: #fff0f3;
  --theme-text: #fff0f3;
  --theme-text-muted: #d4a5b0;
  --theme-accent: #ff6b9d;
  --theme-star: #ffb7c5;
  --theme-card-bg: rgba(255, 183, 197, 0.08);
  --theme-border: rgba(255, 150, 180, 0.15);
  --theme-wave-color: #2d1a2d;
}

/* Forest */
body.theme-forest {
  background: #0a1a0a;
  color: #e8f5e8;
  --theme-text: #e8f5e8;
  --theme-text-muted: #8fbc8f;
  --theme-accent: #27ae60;
  --theme-star: #90ee90;
  --theme-card-bg: rgba(144, 238, 144, 0.08);
  --theme-border: rgba(100, 180, 100, 0.15);
  --theme-wave-color: #0a1a0a;
}

/* Minimal */
body.theme-minimal {
  background: #1a1a1a;
  color: #f5f5f5;
  --theme-text: #f5f5f5;
  --theme-text-muted: #999;
  --theme-accent: #888;
  --theme-star: #ccc;
  --theme-card-bg: rgba(255, 255, 255, 0.05);
  --theme-border: rgba(255, 255, 255, 0.1);
  --theme-wave-color: #1a1a1a;
}

/* Ocean */
body.theme-ocean {
  background: #1a365d;
  color: #ebf8ff;
  --theme-text: #ebf8ff;
  --theme-text-muted: #bee3f8;
  --theme-accent: #63b3ed;
  --theme-star: #90cdf4;
  --theme-card-bg: rgba(99, 179, 237, 0.08);
  --theme-border: rgba(99, 179, 237, 0.15);
  --theme-wave-color: #1a365d;
}

/* Eternal */
body.theme-eternal {
  background: #1a0a2e;
  color: #f5f0ff;
  --theme-text: #f5f0ff;
  --theme-text-muted: #d4c4e8;
  --theme-accent: #c9a0dc;
  --theme-star: #e9d5f5;
  --theme-card-bg: rgba(201, 160, 220, 0.08);
  --theme-border: rgba(201, 160, 220, 0.15);
  --theme-wave-color: #401c81;
}

/* Autumn */
body.theme-autumn {
  background: #1a1208;
  color: #fef9f0;
  --theme-text: #fef9f0;
  --theme-text-muted: #f4d9a0;
  --theme-accent: #daa520;
  --theme-star: #f4a460;
  --theme-card-bg: rgba(218, 165, 32, 0.08);
  --theme-border: rgba(218, 165, 32, 0.15);
  --theme-wave-color: #1a1208;
}

/* Cloud theme: text color overrides */
body.theme-cloud .pet-name {
  color: #1a3a5c !important;
}

body.theme-cloud .pet-title {
  color: #2c4a6a !important;
}

body.theme-cloud .pet-nickname {
  color: #4a6a8a !important;
}

body.theme-cloud .section-title,
body.theme-cloud .timeline-title,
body.theme-cloud .timeline-date {
  color: #2c4a6a !important;
}

body.theme-cloud .pet-dates,
body.theme-cloud .pet-age,
body.theme-cloud .pet-epitaph {
  color: #3a5a7a !important;
}

body.theme-cloud .story-content,
body.theme-cloud .letter-content,
body.theme-cloud .timeline-desc,
body.theme-cloud .message-text,
body.theme-cloud p {
  color: #1a3a5c !important;
}

body.theme-cloud .message-author,
body.theme-cloud .photo-date {
  color: #4a6a8a !important;
}

/* Hide stars for non-starry themes */
.stars.hidden {
  display: none;
}

/* ===== Sunset Theme: Sun Glow ===== */
.sunset-glow {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sunset-glow .sun {
  position: absolute;
  top: 5%;
  right: 10%;
  width: 120px;
  height: 120px;
  background: radial-gradient(
    circle,
    rgba(255, 200, 100, 0.9) 0%,
    rgba(255, 150, 50, 0.6) 40%,
    transparent 70%
  );
  border-radius: 50%;
  animation: sunPulse 4s ease-in-out infinite;
}

.sunset-glow .sun-rays {
  position: absolute;
  top: 5%;
  right: 10%;
  width: 300px;
  height: 300px;
  transform: translate(25%, -25%);
  background: radial-gradient(
    circle,
    rgba(255, 180, 80, 0.3) 0%,
    rgba(255, 120, 50, 0.1) 50%,
    transparent 70%
  );
  border-radius: 50%;
  animation: raysPulse 6s ease-in-out infinite;
}

@keyframes sunPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

@keyframes raysPulse {
  0%,
  100% {
    transform: translate(25%, -25%) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate(25%, -25%) scale(1.2);
    opacity: 0.7;
  }
}

/* ===== Cloud Theme: Floating Feathers ===== */
.cloud-feathers {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cloud-feathers .feather {
  position: absolute;
  top: -50px;
  width: 20px;
  height: 40px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(200, 220, 240, 0.6) 100%
  );
  border-radius: 50% 50% 50% 50% / 80% 80% 20% 20%;
  animation: featherFall linear infinite;
  opacity: 0.7;
}

.cloud-feathers .feather::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 70%;
  background: rgba(180, 200, 220, 0.5);
  transform: translate(-50%, -30%);
}

@keyframes featherFall {
  0% {
    top: -50px;
    transform: translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  90% {
    opacity: 0.7;
  }
  100% {
    top: 110vh;
    transform: translateX(100px) rotate(360deg);
    opacity: 0;
  }
}

/* ===== Sakura Theme: Falling Petals ===== */
.sakura-petals {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sakura-petals .petal {
  position: absolute;
  top: -30px;
  width: 12px;
  height: 12px;
  background: radial-gradient(
    ellipse at 30% 30%,
    #ffb7c5 0%,
    #ff8fa3 50%,
    #ff6b8a 100%
  );
  border-radius: 50% 0 50% 50%;
  animation: petalFall linear infinite;
  opacity: 0.8;
  box-shadow: 0 0 10px rgba(255, 183, 197, 0.3);
}

.sakura-petals .petal:nth-child(odd) {
  width: 10px;
  height: 10px;
  background: radial-gradient(
    ellipse at 30% 30%,
    #ffd1dc 0%,
    #ffb7c5 50%,
    #ff9fb5 100%
  );
}

@keyframes petalFall {
  0% {
    top: -30px;
    transform: translateX(0) rotate(0deg) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  50% {
    transform: translateX(50px) rotate(180deg) scale(0.9);
  }
  90% {
    opacity: 0.6;
  }
  100% {
    top: 110vh;
    transform: translateX(-30px) rotate(360deg) scale(0.7);
    opacity: 0;
  }
}

/* ===== Forest Theme: Fireflies ===== */
.forest-fireflies {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.forest-fireflies .firefly {
  position: absolute;
  width: 6px;
  height: 6px;
  background: radial-gradient(
    circle,
    #90ee90 0%,
    rgba(144, 238, 144, 0.8) 30%,
    transparent 70%
  );
  border-radius: 50%;
  animation:
    fireflyFloat 8s ease-in-out infinite,
    fireflyGlow 2s ease-in-out infinite;
  box-shadow: 0 0 15px 5px rgba(144, 238, 144, 0.4);
}

.forest-fireflies .firefly:nth-child(odd) {
  animation-duration: 10s, 2.5s;
}

.forest-fireflies .firefly:nth-child(3n) {
  width: 4px;
  height: 4px;
}

@keyframes fireflyFloat {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(30px, -20px);
  }
  50% {
    transform: translate(-20px, 10px);
  }
  75% {
    transform: translate(10px, 30px);
  }
}

@keyframes fireflyGlow {
  0%,
  100% {
    opacity: 0.3;
    box-shadow: 0 0 10px 3px rgba(144, 238, 144, 0.3);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 20px 8px rgba(144, 238, 144, 0.6);
  }
}

/* ===== Stars Animation ===== */
.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* ===== Container ===== */
.memorial-container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== Header Section ===== */
.memorial-header {
  text-align: center;
  padding: 60px 20px 40px;
  position: relative;
}

.rainbow-bridge {
  width: 200px;
  height: 100px;
  margin: 0 auto 30px;
  background: linear-gradient(
    180deg,
    rgba(255, 107, 107, 0.3) 0%,
    rgba(255, 217, 61, 0.3) 16.66%,
    rgba(107, 203, 119, 0.3) 33.33%,
    rgba(77, 150, 255, 0.3) 50%,
    rgba(155, 89, 182, 0.3) 66.66%,
    rgba(255, 107, 157, 0.3) 83.33%,
    transparent 100%
  );
  border-radius: 100px 100px 0 0;
  position: relative;
}

.rainbow-bridge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 60px 30px rgba(255, 255, 255, 0.1);
}

.pet-avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.2);
  margin-bottom: 24px;
}

.pet-avatar-placeholder {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(233, 69, 96, 0.3),
    rgba(155, 89, 182, 0.3)
  ) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  color: #fff !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  margin: 0 auto 24px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 40px rgba(233, 69, 96, 0.2);
}

.pet-name {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff !important;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.pet-title {
  font-size: 1.5rem;
  font-weight: 400;
  margin-left: 0.3em;
  opacity: 0.9;
}

.pet-nickname {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
  font-style: italic;
}

.pet-dates {
  font-size: 1.1rem;
  color: #ccc !important;
  margin-bottom: 16px;
}

.pet-age {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #eee !important;
  margin-bottom: 20px;
}

.pet-epitaph {
  font-size: 1.2rem;
  font-style: italic;
  color: #ddd !important;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  padding: 0 30px;
}

.pet-epitaph::before,
.pet-epitaph::after {
  content: '"';
  font-size: 3rem;
  position: absolute;
  color: rgba(255, 255, 255, 0.2);
  line-height: 1;
}

.pet-epitaph::before {
  left: 0;
  top: -10px;
}

.pet-epitaph::after {
  right: 0;
  bottom: -30px;
  content: '"';
}

/* ===== Section Styles ===== */
.memorial-section {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px 30px;
  margin-bottom: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff !important;
}

.section-title::before,
.section-title::after {
  content: "";
  flex: 1;
  max-width: 100px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
}

/* ===== Story / Letter ===== */
.story-content,
.letter-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #ddd !important;
}

.letter-content {
  text-indent: 0;
  color: #ddd !important;
}

/* ===== Rich Content (TinyMCE 生成的 HTML) ===== */
.rich-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.rich-content p {
  margin-bottom: 1em;
}

.rich-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
  display: block;
}

.rich-content a {
  color: var(--theme-accent, #e94560);
  text-decoration: underline;
}

.rich-content a:hover {
  opacity: 0.8;
}

.rich-content ul,
.rich-content ol {
  margin: 1em 0;
  padding-left: 2em;
}

.rich-content li {
  margin-bottom: 0.5em;
}

.rich-content blockquote {
  border-left: 3px solid var(--theme-accent, #e94560);
  padding-left: 1rem;
  margin: 1em 0;
  font-style: italic;
  opacity: 0.9;
}

.rich-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.rich-content table th,
.rich-content table td {
  border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.1));
  padding: 0.5rem;
  text-align: left;
}

.rich-content h1,
.rich-content h2,
.rich-content h3,
.rich-content h4 {
  margin: 1.5em 0 0.5em;
  line-height: 1.3;
}

.rich-content h1 {
  font-size: 1.5rem;
}
.rich-content h2 {
  font-size: 1.3rem;
}
.rich-content h3 {
  font-size: 1.15rem;
}
.rich-content h4 {
  font-size: 1.05rem;
}

/* Letter Paper Effect */
.letter-section {
  margin-top: 2rem;
}

.letter-paper {
  background: linear-gradient(
    135deg,
    rgba(255, 250, 240, 0.05) 0%,
    rgba(255, 245, 230, 0.08) 100%
  );
  border: 1px solid rgba(255, 220, 180, 0.15);
  border-radius: 8px;
  padding: 2rem 2.5rem;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.letter-paper::before {
  content: '"';
  position: absolute;
  top: 1rem;
  left: 1.5rem;
  font-size: 4rem;
  color: rgba(255, 200, 150, 0.15);
  font-family: Georgia, serif;
  line-height: 1;
}

.letter-paper .letter-content {
  font-style: italic;
  margin-bottom: 1.5rem;
}

.letter-signature {
  text-align: right;
  font-style: italic;
  color: var(--theme-text-muted, #aaa);
  font-size: 1rem;
  margin-top: 1rem;
}

/* Cloud theme letter */
body.theme-cloud .letter-paper {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(100, 150, 200, 0.2);
}

body.theme-cloud .letter-paper .letter-content {
  color: #2c3e50 !important;
}

body.theme-cloud .letter-signature {
  color: #5a7a9a;
}

/* ===== Photo Gallery ===== */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.photo-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.photo-item:hover {
  transform: scale(1.03);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-item .photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.photo-item:hover .photo-overlay {
  opacity: 1;
}

/* ===== Video Items ===== */
.video-item {
  position: relative;
}

.video-item .video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
}

.video-item .video-play-icon .material-icons {
  font-size: 3.5rem;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  opacity: 0.9;
  transition: all 0.3s ease;
}

.video-item:hover .video-play-icon .material-icons {
  opacity: 1;
  transform: scale(1.1);
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2c3e50, #3498db);
}

.video-placeholder .material-icons {
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.7);
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #f1c40f, #e94560, #9b59b6);
}

.timeline-item {
  position: relative;
  padding-bottom: 30px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 0;
  width: 18px;
  height: 18px;
  background: #f1c40f;
  border-radius: 50%;
  border: 3px solid #1a1a2e;
  box-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

.timeline-date {
  font-size: 0.85rem;
  color: #f1c40f !important;
  margin-bottom: 5px;
}

.timeline-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff !important;
}

.timeline-desc {
  color: #bbb !important;
  font-size: 0.95rem;
}

.timeline-photos {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.timeline-photo-thumb {
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.timeline-photo-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.timeline-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Timeline Media (單一媒體) */
.timeline-item.has-media .timeline-content {
  display: flex;
  flex-direction: column;
}

.timeline-media {
  margin-top: 12px;
  max-width: 300px;
}

.timeline-media .timeline-image {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.timeline-media .timeline-image:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.timeline-video-wrapper {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
}

.timeline-video-thumb {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.timeline-video-wrapper:hover .timeline-video-thumb {
  transform: scale(1.02);
}

.timeline-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.timeline-play-overlay .material-icons {
  font-size: 4rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease;
}

.timeline-video-wrapper:hover .timeline-play-overlay .material-icons {
  transform: scale(1.1);
}

/* 響應式調整 */
@media (min-width: 640px) {
  .timeline-item.has-media .timeline-content {
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
  }

  .timeline-item.has-media .timeline-text {
    flex: 1;
  }

  .timeline-item.has-media .timeline-media {
    flex-shrink: 0;
    margin-top: 0;
  }
}

/* ===== Messages ===== */
.messages-section .section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.message-count-badge {
  font-size: 0.9rem;
  font-weight: normal;
  color: #888;
}

.message-form {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.message-author-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.message-author-row label {
  font-size: 0.9rem;
  color: #999;
  white-space: nowrap;
}

.message-author-input {
  flex: 1;
  max-width: 200px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #eee;
  font-family: inherit;
  font-size: 0.9rem;
}

.message-author-input:focus {
  outline: none;
  border-color: rgba(233, 69, 96, 0.5);
}

.message-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #eee;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

.message-form textarea::placeholder {
  color: #777;
}

.message-form textarea:focus {
  outline: none;
  border-color: rgba(233, 69, 96, 0.5);
}

.message-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.char-count {
  font-size: 0.85rem;
  color: #666;
}

.rate-limit-hint {
  font-size: 0.8rem;
  color: #888;
  margin-left: 8px;
}

.submit-message-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #e94560, #ff6b9d);
  border: none;
  border-radius: 20px;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
}

.submit-message-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.submit-message-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.submit-message-btn .material-icons {
  font-size: 18px;
}

.message-login-prompt {
  text-align: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 24px;
}

.message-login-prompt p {
  color: #aaa;
  margin-bottom: 12px;
}

.login-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #e94560;
  text-decoration: none;
  transition: color 0.3s ease;
}

.login-link:hover {
  color: #ff6b9d;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}

.message-item.message-new {
  animation: slideIn 0.4s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.message-sender {
  font-weight: 600;
  color: #bdbbbb;
  font-size: 0.95rem;
}

.message-date {
  font-size: 0.8rem;
  color: #777;
  margin-left: auto;
}

.message-content {
  color: #ccc;
  line-height: 1.7;
  font-size: 0.95rem;
}

.messages-loading,
.messages-end {
  text-align: center;
  padding: 20px;
  color: #666;
}

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #e94560;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.messages-empty {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.messages-empty .material-icons {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ===== Message Filter Tabs (彙整檢視) ===== */
.message-filter-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* border-bottom: 1px solid rgba(255, 255, 255, 0.1); */
}

.message-filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  /* 重置 button 預設樣式 */
  margin: 0;
  font-family: inherit;
  line-height: 1;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  /* 自訂樣式 */
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8125rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  height: 36px;
  box-sizing: border-box;
}

.filter-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.filter-tab.active {
  background: var(--theme-accent, #e94560);
  border-color: var(--theme-accent, #e94560);
  color: #fff;
}

.filter-tab .material-icons {
  font-size: 1rem;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 2px 6px;
  margin-left: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}

.filter-tab.active .filter-count {
  background: rgba(255, 255, 255, 0.25);
}

/* 淺色主題調整 */
body.theme-cloud .message-filter-tabs {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.theme-cloud .filter-tab {
  border-color: rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.6);
}

body.theme-cloud .filter-tab:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.2);
}

body.theme-cloud .filter-tab.active {
  color: #bdbbbb;
}

/* ===== Message Module Source Tag (來源標籤) ===== */
.message-module-source {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  margin-left: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.message-module-source .material-icons {
  font-size: 0.875rem;
}

body.theme-cloud .message-module-source {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.5);
}

/* ===== Reply Styles ===== */
.message-replies {
  margin-top: 12px;
  padding-left: 16px;
  border-left: 2px solid rgba(233, 69, 96, 0.3);
}

.reply-item {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.reply-item:last-child {
  margin-bottom: 0;
}

.reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.reply-sender {
  font-weight: 500;
  color: #ddd;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reply-sender.is-owner {
  color: #e94560;
}

.owner-badge {
  display: inline-block;
  background: linear-gradient(135deg, #e94560, #ff6b9d);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.reply-date {
  font-size: 0.75rem;
  color: #666;
}

.reply-content {
  color: #bbb;
  font-size: 0.9rem;
  line-height: 1.6;
}

.message-actions {
  margin-top: 10px;
}

.reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: 16px;
  color: #999;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reply-btn:hover {
  border-color: #e94560;
  color: #e94560;
  background: rgba(233, 69, 96, 0.1);
}

.reply-btn .material-icons {
  font-size: 16px;
}

.reply-form-container {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  animation: fadeIn 0.2s ease;
}

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

.reply-input {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #eee;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.reply-input::placeholder {
  color: #666;
}

.reply-input:focus {
  outline: none;
  border-color: rgba(233, 69, 96, 0.5);
}

.reply-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.reply-char-count {
  font-size: 0.8rem;
  color: #666;
  margin-right: auto;
}

.cancel-reply-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  color: #999;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cancel-reply-btn:hover {
  border-color: #999;
  color: #fff;
}

.submit-reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #e94560, #ff6b9d);
  border: none;
  border-radius: 16px;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.submit-reply-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
}

.submit-reply-btn .material-icons {
  font-size: 16px;
}

.reply-item.reply-new {
  animation: slideIn 0.3s ease;
}

/* ===== Enhanced Message Styles ===== */
.form-actions-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.image-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #888;
}

.image-upload-btn:hover {
  background: rgba(233, 69, 96, 0.2);
  color: #e94560;
}

.image-upload-btn.small {
  width: 28px;
  height: 28px;
}

.image-upload-btn .material-icons {
  font-size: 20px;
}

.image-upload-btn.small .material-icons {
  font-size: 16px;
}

.image-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.image-preview-container:empty {
  display: none;
}

.preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
}

.preview-item.small {
  width: 50px;
  height: 50px;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.preview-item .remove-btn .material-icons {
  font-size: 14px;
}

.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.message-images.small {
  margin-top: 8px;
}

.message-image-thumb {
  display: block;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.message-images.small .message-image-thumb {
  width: 60px;
  height: 60px;
}

.message-image-thumb:hover {
  transform: scale(1.05);
}

.message-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edited-badge {
  color: #888;
  font-size: 0.75rem;
  margin-left: 4px;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  color: #888;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn:hover {
  border-color: var(--theme-accent, #e94560);
  color: var(--theme-accent, #e94560);
  background: rgba(233, 69, 96, 0.1);
}

.action-btn.small {
  padding: 4px 8px;
  font-size: 0.8rem;
}

.action-btn .material-icons {
  font-size: 16px;
}

.action-btn.small .material-icons {
  font-size: 14px;
}

.action-btn.delete-btn:hover {
  border-color: #ff4757;
  color: #ff4757;
  background: rgba(255, 71, 87, 0.1);
}

.reply-count {
  font-size: 0.8rem;
  color: #666;
}

.replies-container {
  margin-top: 16px;
  padding-left: 20px;
  border-left: 2px solid rgba(233, 69, 96, 0.2);
}

.reply-item {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}

.reply-item:last-child {
  margin-bottom: 0;
}

.reply-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.reply-textarea,
.edit-textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #eee;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.reply-textarea:focus,
.edit-textarea:focus {
  outline: none;
  border-color: rgba(233, 69, 96, 0.5);
}

.reply-form-footer,
.edit-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.reply-form-btns {
  display: flex;
  gap: 8px;
}

.reply-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.cancel-btn,
.submit-btn {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cancel-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #999;
}

.cancel-btn:hover {
  border-color: #999;
  color: #fff;
}

.submit-btn {
  background: linear-gradient(135deg, #e94560, #ff6b9d);
  border: none;
  color: #fff;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
}

.edit-form-container {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.more-replies {
  margin-top: 10px;
  text-align: center;
}

.more-replies button {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: #888;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.more-replies button:hover {
  border-color: #e94560;
  color: #e94560;
}

/* ===== Candle Section ===== */
.candle-section {
  text-align: center;
}

.candle-display {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.candle {
  width: 30px;
  height: 80px;
  background: linear-gradient(180deg, #fff5e6 0%, #ffd93d 100%);
  border-radius: 5px 5px 3px 3px;
  position: relative;
}

.candle::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 20px;
  background: radial-gradient(
    ellipse at bottom,
    #ff6b00 0%,
    #ffcc00 50%,
    transparent 70%
  );
  border-radius: 50% 50% 20% 20%;
  animation: flame 0.5s ease-in-out infinite alternate;
}

@keyframes flame {
  0% {
    transform: translateX(-50%) scale(1) rotate(-2deg);
  }
  100% {
    transform: translateX(-50%) scale(1.1) rotate(2deg);
  }
}

.candle-count {
  font-size: 1.2rem;
  color: #f1c40f;
  margin-bottom: 20px;
}

.light-candle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 15px 40px;
  background: linear-gradient(135deg, #e94560, #ff6b9d);
  border: none;
  border-radius: 30px;
  color: #fff;
  font-size: 1.1rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
}

.light-candle-btn:hover:not(:disabled):not(.lit) {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(233, 69, 96, 0.5);
}

.light-candle-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.light-candle-btn.lit {
  background: linear-gradient(135deg, #4a5568, #718096);
  box-shadow: none;
  cursor: default;
}

.light-candle-btn .material-icons {
  font-size: 24px;
}

/* 新蠟燭出現動畫（更華麗、更慢）*/
.candle.candle-new {
  animation: candleAppear 2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes candleAppear {
  0% {
    opacity: 0;
    transform: scale(0) translateY(50px);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 所有蠟燭閃爍效果（點燈時觸發，延長到 3 秒）*/
.candle.candle-sparkle {
  animation: candleSparkle 3s ease;
}

@keyframes candleSparkle {
  0%,
  100% {
    filter: brightness(1);
  }
  15% {
    filter: brightness(1.5) drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
  }
  25% {
    filter: brightness(1);
  }
  40% {
    filter: brightness(1.8) drop-shadow(0 0 15px rgba(255, 215, 0, 1));
  }
  50% {
    filter: brightness(1);
  }
  65% {
    filter: brightness(1.6) drop-shadow(0 0 12px rgba(255, 215, 0, 0.9));
  }
  75%,
  100% {
    filter: brightness(1);
  }
}

/* 蠟燭火焰加強（點燈時，延長到 3 秒）*/
.candle.candle-sparkle::before {
  animation:
    flameIntense 3s ease,
    flame 0.5s ease-in-out infinite alternate;
}

@keyframes flameIntense {
  0% {
    filter: brightness(1);
  }
  15% {
    filter: brightness(2) drop-shadow(0 0 8px #ff6b00);
    transform: translateX(-50%) scale(1.5);
  }
  30% {
    filter: brightness(1.5);
  }
  45% {
    filter: brightness(2.2) drop-shadow(0 0 10px #ff6b00);
    transform: translateX(-50%) scale(1.6);
  }
  60%,
  100% {
    filter: brightness(1);
    transform: translateX(-50%) scale(1);
  }
}

/* 光暈擴散效果（延長到 3 秒，範圍更大）*/
.candle-glow-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  margin: -150px 0 0 -150px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 215, 0, 0.8) 0%,
    rgba(255, 215, 0, 0.4) 40%,
    transparent 70%
  );
  pointer-events: none;
  animation: glowExpand 3s ease-out forwards;
  z-index: 10;
}

@keyframes glowExpand {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  30% {
    opacity: 1;
  }
  70% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: scale(4);
  }
}

/* 點燈按鈕點擊效果 */
.light-candle-btn.btn-lighting {
  animation: btnPulse 0.5s ease;
}

@keyframes btnPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.8);
  }
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
  pointer-events: none;
}

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

/* ===== Footer ===== */
.memorial-footer {
  text-align: center;
  padding: 40px 20px;
  color: #fff;
  font-size: 0.9rem;
}

.memorial-footer a {
  color: #fff;
  text-decoration: none;
}

.view-count {
  margin-top: 10px;
  font-size: 0.85rem;
}

/* ===== Owner Actions ===== */
.owner-actions {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
}

.owner-actions a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  color: #fff;
  text-decoration: none;
  transition: all 0.3s ease;
}

.owner-actions a:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== Hero Cover with Wave ===== */
.hero-cover {
  position: relative;
  width: 100%;
  height: 50vh;
  min-height: 350px;
  max-height: 500px;
  overflow: hidden;
  border-bottom: none; /* 移除底部邊框 */
  box-shadow: none; /* 移除陰影 */
}

.hero-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Hero Slideshow for multiple covers */
.hero-slideshow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.hero-slideshow .uk-slideshow-items {
  height: 100%;
}

.hero-slideshow .uk-slideshow-items li {
  height: 100%;
}

.hero-slideshow .uk-slideshow-items img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-cover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    180deg,
    rgba(13, 13, 26, 0.3) 0%,
    rgba(13, 13, 26, 0.5) 40%,
    rgba(13, 13, 26, 0.75) 70%,
    rgba(13, 13, 26, 0.95) 100%
  );
  pointer-events: none;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

.wave-stack {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  z-index: 3;
  pointer-events: none;
  border-top: none; /* 移除頂部邊框 */
  border-bottom: none; /* 移除底部邊框 */
}

.wave-stack svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
}

.wave-stack .wave-back {
  opacity: 0.3;
  transform: translateY(-30px);
}

.wave-stack .wave-mid {
  opacity: 0.5;
  transform: translateY(-10px);
}

.wave-stack .wave-front {
  opacity: 1;
}

.memorial-container.has-hero {
  padding-top: 0;
  margin-top: -120px;
  position: relative;
  z-index: 10;
  border-top: none; /* 移除波浪下方的線條 */
}

.memorial-container.has-hero .memorial-header {
  padding-top: 0;
  border-top: none; /* 確保移除波浪下方的線條 */
}

.memorial-container.has-hero .pet-avatar-wrapper {
  margin-top: 0;
}

.memorial-container.has-hero .rainbow-bridge {
  display: none;
}

/* ===== Theme-Specific Layout Overrides ===== */

/* Sunset Theme */
body.theme-sunset .timeline {
  padding-left: 0;
  display: flex;
  overflow-x: auto;
  gap: 0;
  padding-bottom: 20px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

body.theme-sunset .timeline::before {
  display: none;
}

body.theme-sunset .timeline::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 60px;
  height: 3px;
  background: linear-gradient(90deg, #ff6b35, #f7931e, #ffcc02, #ff6b35);
  z-index: 0;
}

body.theme-sunset .timeline-item {
  flex: 0 0 200px;
  padding: 0 10px 50px;
  text-align: center;
  scroll-snap-align: center;
  position: relative;
}

body.theme-sunset .timeline-dot {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #ff6b35, #ffcc02);
  border: 3px solid #1a0a0a;
  box-shadow: 0 0 15px rgba(255, 107, 53, 0.6);
  z-index: 1;
}

body.theme-sunset .timeline-date {
  color: #ffcc02 !important;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

body.theme-sunset .timeline-title {
  font-size: 1rem;
  color: #fff5e6 !important;
}

body.theme-sunset .timeline-desc {
  font-size: 0.85rem;
  color: #d4a574 !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Sunset Theme: Timeline with Media */
body.theme-sunset .timeline-item.has-media {
  flex: 0 0 280px;
}

body.theme-sunset .timeline-item.has-media .timeline-content {
  flex-direction: column;
}

body.theme-sunset .timeline-media {
  margin-top: 10px;
  max-width: 100%;
  width: 100%;
}

body.theme-sunset .timeline-media .timeline-image,
body.theme-sunset .timeline-media .timeline-video-thumb {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
}

body.theme-sunset .timeline-video-wrapper {
  position: relative;
  width: 100%;
}

body.theme-sunset .timeline-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

body.theme-sunset .timeline-play-overlay:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

body.theme-sunset .timeline-play-overlay .material-icons {
  color: #fff;
  font-size: 32px;
}

body.theme-sunset .photo-gallery {
  display: flex;
  overflow-x: auto;
  gap: 16px;
  padding-bottom: 16px;
  scroll-snap-type: x mandatory;
}

body.theme-sunset .photo-item {
  flex: 0 0 280px;
  height: 200px;
  aspect-ratio: auto;
  border-radius: 16px;
  scroll-snap-align: center;
  box-shadow: 0 8px 30px rgba(255, 107, 53, 0.2);
}

body.theme-sunset .memorial-section {
  background: rgba(255, 150, 100, 0.05);
  border: 1px solid rgba(255, 150, 100, 0.15);
  box-shadow: 0 0 40px rgba(255, 107, 53, 0.1);
}

body.theme-sunset .section-title::before,
body.theme-sunset .section-title::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 150, 100, 0.4),
    transparent
  );
}

body.theme-sunset .story-content,
body.theme-sunset .letter-content {
  font-size: 1.1rem;
  line-height: 2;
  color: #fff5e6 !important;
}

body.theme-sunset .story-content::first-letter,
body.theme-sunset .letter-content::first-letter {
  font-size: 3em;
  float: left;
  line-height: 1;
  margin-right: 10px;
  color: #ff6b35;
  font-weight: 700;
}

/* Cloud Theme */
body.theme-cloud .memorial-section {
  background: rgba(255, 255, 255, 0.85);
  border: none;
  box-shadow: 0 10px 40px rgba(100, 150, 200, 0.15);
  border-radius: 24px;
}

body.theme-cloud .memorial-section:nth-child(odd) {
  transform: rotate(-0.5deg);
}

body.theme-cloud .memorial-section:nth-child(even) {
  transform: rotate(0.5deg);
}

body.theme-cloud .section-title::before,
body.theme-cloud .section-title::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(100, 150, 200, 0.3),
    transparent
  );
}

body.theme-cloud .timeline {
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body.theme-cloud .timeline::before {
  display: none;
}

body.theme-cloud .timeline-item {
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(100, 150, 200, 0.1);
  margin-left: 0;
  transition: transform 0.3s ease;
}

body.theme-cloud .timeline-item:nth-child(odd) {
  margin-left: 0;
}

body.theme-cloud .timeline-item:nth-child(even) {
  margin-left: 40px;
}

body.theme-cloud .timeline-item:nth-child(3n) {
  margin-left: 80px;
}

body.theme-cloud .timeline-item:hover {
  transform: translateY(-3px);
}

body.theme-cloud .timeline-dot {
  display: none;
}

body.theme-cloud .timeline-date {
  color: #2980b9 !important;
  font-weight: 600;
}

body.theme-cloud .photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

body.theme-cloud .photo-item {
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(100, 150, 200, 0.2);
  aspect-ratio: auto;
  width: calc(33% - 12px);
  height: 150px;
}

body.theme-cloud .photo-item:nth-child(3n + 1) {
  width: calc(40% - 12px);
  height: 180px;
}

body.theme-cloud .photo-item:nth-child(3n + 2) {
  width: calc(30% - 12px);
  height: 130px;
}

/* Sakura Theme */
body.theme-sakura .memorial-section {
  background: rgba(255, 183, 197, 0.08);
  border: 1px solid rgba(255, 150, 180, 0.2);
  border-radius: 8px;
  position: relative;
}

body.theme-sakura .memorial-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #ffb7c5, transparent);
  border-radius: 2px;
}

body.theme-sakura .section-title {
  font-weight: 400;
  letter-spacing: 0.3em;
}

body.theme-sakura .section-title::before,
body.theme-sakura .section-title::after {
  max-width: 60px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 150, 180, 0.4),
    transparent
  );
}

body.theme-sakura .timeline {
  padding-left: 0;
  padding-right: 30px;
}

body.theme-sakura .timeline::before {
  left: auto;
  right: 8px;
  background: linear-gradient(180deg, #ffb7c5, #ff6b9d, #ffb7c5);
}

body.theme-sakura .timeline-item {
  text-align: right;
  padding-right: 40px;
  padding-left: 0;
}

body.theme-sakura .timeline-dot {
  left: auto;
  right: -4px;
  background: #ffb7c5;
  border-color: #2d1a2d;
  box-shadow: 0 0 10px rgba(255, 183, 197, 0.5);
}

body.theme-sakura .timeline-date {
  color: #ff6b9d !important;
}

body.theme-sakura .timeline-photos {
  justify-content: flex-end;
}

body.theme-sakura .photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 100px;
  gap: 10px;
}

body.theme-sakura .photo-item {
  border-radius: 6px;
  aspect-ratio: auto;
  height: auto;
}

body.theme-sakura .photo-item:nth-child(3n + 1) {
  grid-row: span 2;
}

body.theme-sakura .photo-item:nth-child(5n) {
  grid-column: span 2;
}

body.theme-sakura .story-content,
body.theme-sakura .letter-content {
  border-left: 2px solid rgba(255, 183, 197, 0.3);
  padding-left: 20px;
  margin-left: 10px;
}

/* Forest Theme */
body.theme-forest .memorial-section {
  background: rgba(144, 238, 144, 0.05);
  border: 1px solid rgba(100, 180, 100, 0.15);
  border-radius: 0;
  margin-left: -20px;
  margin-right: -20px;
  padding-left: 40px;
  padding-right: 40px;
}

body.theme-forest .section-title::before,
body.theme-forest .section-title::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(100, 180, 100, 0.4),
    transparent
  );
}

body.theme-forest .timeline {
  padding-left: 50px;
}

body.theme-forest .timeline::before {
  left: 20px;
  width: 3px;
  background: linear-gradient(180deg, #2d5a2d, #27ae60, #90ee90);
}

body.theme-forest .timeline-item {
  position: relative;
}

body.theme-forest .timeline-item::before {
  content: "";
  position: absolute;
  left: -42px;
  top: 8px;
  width: 20px;
  height: 2px;
  background: linear-gradient(90deg, #27ae60, transparent);
}

body.theme-forest .timeline-dot {
  left: -46px;
  background: #27ae60;
  border-color: #0a1a0a;
  box-shadow: 0 0 15px rgba(39, 174, 96, 0.5);
}

body.theme-forest .timeline-date {
  color: #90ee90 !important;
}

body.theme-forest .story-content,
body.theme-forest .letter-content {
  background: rgba(39, 174, 96, 0.05);
  padding: 24px;
  border-radius: 8px;
  border-left: 4px solid #27ae60;
}

/* Minimal Theme */
body.theme-minimal .memorial-section {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  padding: 60px 20px;
}

body.theme-minimal .memorial-section:last-of-type {
  border-bottom: none;
}

body.theme-minimal .section-title {
  font-weight: 300;
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

body.theme-minimal .section-title::before,
body.theme-minimal .section-title::after {
  display: none;
}

body.theme-minimal .timeline {
  padding-left: 0;
}

body.theme-minimal .timeline::before {
  display: none;
}

body.theme-minimal .timeline-item {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.theme-minimal .timeline-item:last-child {
  border-bottom: none;
}

body.theme-minimal .timeline-dot {
  display: none;
}

body.theme-minimal .timeline-date {
  flex: 0 0 100px;
  color: #666 !important;
  font-size: 0.85rem;
}

body.theme-minimal .timeline-title {
  font-weight: 400;
  font-size: 1rem;
}

body.theme-minimal .timeline-desc {
  display: none;
}

body.theme-minimal .timeline-photos {
  display: none;
}

body.theme-minimal .story-content,
body.theme-minimal .letter-content {
  font-size: 1rem;
  line-height: 2;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .hero-cover {
    height: 40vh;
    min-height: 280px;
    max-height: 400px;
  }

  .wave-stack {
    height: 100px;
  }

  .memorial-container.has-hero {
    margin-top: -80px;
  }

  .pet-name {
    font-size: 2rem;
  }

  .pet-title {
    font-size: 1.2rem;
    display: block;
    margin-left: 0;
    margin-top: 4px;
  }

  .pet-nickname {
    font-size: 1rem;
  }

  .pet-avatar,
  .pet-avatar-placeholder {
    width: 150px;
    height: 150px;
  }

  .memorial-section {
    padding: 30px 20px;
  }

  .photo-gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

/* UIkit Overrides */
.uk-lightbox {
  background: rgba(0, 0, 0, 0.95) !important;
}

/* ===== Locations Section (我們的足跡) ===== */
.locations-section {
  padding: 40px 20px;
}

.section-subtitle {
  text-align: center;
  color: var(--theme-text-muted);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
}

.locations-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.locations-map-wrapper {
  border-radius: 12px;
  overflow: hidden;
  background: var(--theme-card-bg);
  min-height: 400px;
}

#locationsMap {
  width: 100%;
  height: 100%;
  min-height: 400px;
  background: #2a2a3a;
}

.locations-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* 自訂捲軸 */
.locations-list::-webkit-scrollbar {
  width: 4px;
}

.locations-list::-webkit-scrollbar-track {
  background: var(--theme-border);
  border-radius: 2px;
}

.locations-list::-webkit-scrollbar-thumb {
  background: var(--theme-accent);
  border-radius: 2px;
}

.location-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--theme-card-bg);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.location-card:hover,
.location-card.active {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--theme-accent);
}

.location-card-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #9c27b0, #673ab7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.location-card-icon .material-icons {
  color: white;
  font-size: 1.25rem;
}

.location-card-content {
  flex: 1;
  min-width: 0;
}

.location-card-name {
  font-weight: 600;
  color: var(--theme-text);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.location-card-address {
  font-size: 0.8125rem;
  color: var(--theme-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.location-card-date {
  font-size: 0.75rem;
  color: var(--theme-accent);
}

/* 卡片上的故事圖示 */
.location-card-has-story {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: var(--theme-accent);
  opacity: 0.7;
}

.location-card-has-story .material-icons {
  font-size: 1rem;
}

/* 地點詳細資訊面板 */
.location-detail-panel {
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  position: relative;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.location-detail-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--theme-text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  transition: background 0.2s;
}

.location-detail-close:hover {
  background: var(--theme-hover);
}

.location-detail-close .material-icons {
  font-size: 1.25rem;
}

.location-detail-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--theme-text);
  margin-bottom: 0.5rem;
  padding-right: 2rem;
}

.location-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--theme-text-secondary);
  margin-bottom: 0.75rem;
}

.location-detail-date {
  color: var(--theme-accent);
}

.location-detail-description {
  font-size: 0.9rem;
  color: var(--theme-text);
  line-height: 1.6;
  padding-top: 0.75rem;
  border-top: 1px solid var(--theme-border);
  white-space: pre-wrap;
}

.location-detail-description:empty {
  display: none;
}

/* 選中的地點卡片樣式 */
.location-card.active {
  border-color: var(--theme-accent);
  background: rgba(var(--theme-accent-rgb, 156, 39, 176), 0.1);
}

/* 自訂地圖標記 */
.custom-marker {
  background: transparent;
  border: none;
}

.marker-pin {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #e91e63, #9c27b0);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  position: relative;
  box-shadow: 0 2px 8px rgba(233, 30, 99, 0.5);
}

.marker-pin::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Leaflet Popup 樣式 */
.leaflet-popup-content-wrapper {
  background: rgba(30, 30, 50, 0.95) !important;
  color: #fff !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

.leaflet-popup-tip {
  background: rgba(30, 30, 50, 0.95) !important;
}

.leaflet-popup-content {
  margin: 10px 14px !important;
  font-family: inherit !important;
}

.leaflet-popup-close-button {
  color: #aaa !important;
}

/* 響應式 */
@media (max-width: 768px) {
  .locations-container {
    grid-template-columns: 1fr;
  }

  .locations-map-wrapper {
    min-height: 300px;
    order: 1;
  }

  #locationsMap {
    min-height: 300px;
  }

  .locations-list {
    order: 2;
    max-height: 350px;
  }
}

/* ===== Add Photo Card (Gallery) ===== */
.add-photo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--theme-card-bg);
  border: 2px dashed var(--theme-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 150px;
  color: var(--theme-text-muted);
}

.add-photo-card:hover {
  border-color: var(--theme-accent);
  background: rgba(233, 69, 96, 0.1);
  color: var(--theme-accent);
}

.add-photo-card .material-icons {
  font-size: 2.5rem;
  opacity: 0.7;
}

.add-photo-card span:last-child {
  font-size: 0.875rem;
  font-weight: 500;
}

/* ===== Message Preview Card (简化留言显示) ===== */
.message-compose-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--theme-card-bg);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 16px;
}

.message-compose-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.compose-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--theme-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.compose-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compose-avatar .material-icons {
  color: white;
  font-size: 1.25rem;
}

.compose-placeholder {
  flex: 1;
  color: var(--theme-text-muted);
  font-size: 0.9375rem;
}

.compose-icon {
  color: var(--theme-accent);
  font-size: 1.25rem;
}

.message-login-card {
  padding: 20px;
  background: var(--theme-card-bg);
  border-radius: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.message-login-card .login-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--theme-accent);
  text-decoration: none;
  font-weight: 500;
}

.message-login-card .login-link:hover {
  text-decoration: underline;
}

.message-preview-card {
  padding: 16px;
  background: var(--theme-card-bg);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.message-preview-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.preview-author {
  font-weight: 600;
  color: var(--theme-text);
  font-size: 0.9375rem;
}

.preview-date {
  color: var(--theme-text-muted);
  font-size: 0.8125rem;
}

.preview-content {
  color: var(--theme-text);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.preview-has-image {
  color: var(--theme-accent);
  margin-left: 6px;
}

.preview-has-image .material-icons {
  font-size: 1rem;
  vertical-align: middle;
}

.preview-images {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.preview-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--theme-border);
}

.preview-more-images {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--theme-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.preview-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--theme-accent);
  font-size: 0.875rem;
  font-weight: 500;
  padding-top: 12px;
  border-top: 1px solid var(--theme-border);
}

.preview-more .material-icons {
  font-size: 1.25rem;
}

.message-empty-card {
  padding: 40px 20px;
  background: var(--theme-card-bg);
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
}

.message-empty-card .material-icons {
  font-size: 3rem;
  color: var(--theme-text-muted);
  opacity: 0.5;
  margin-bottom: 8px;
}

.message-empty-card p {
  color: var(--theme-text-muted);
  font-size: 0.9375rem;
}

/* ===== View All Messages Link (彙整檢視入口) ===== */
.view-all-messages-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: var(--theme-text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-all-messages-link:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--theme-accent);
  color: var(--theme-accent);
}

.view-all-messages-link .material-icons {
  font-size: 1.125rem;
}

.view-all-messages-link .material-icons:last-child {
  margin-left: auto;
}

body.theme-cloud .view-all-messages-link {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

body.theme-cloud .view-all-messages-link:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ===== Bottom Sheet Modal ===== */
.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.bottom-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet-modal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  background: #1a1a2e;
  border-radius: 24px 24px 0 0;
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

body.theme-cloud .bottom-sheet-modal {
  background: #f8fafc;
}

body.theme-sunset .bottom-sheet-modal {
  background: #2d1810;
}

body.theme-sakura .bottom-sheet-modal {
  background: #2a2028;
}

body.theme-forest .bottom-sheet-modal {
  background: #1a2418;
}

body.theme-minimal .bottom-sheet-modal {
  background: #ffffff;
}

.bottom-sheet-modal.active {
  transform: translateY(0);
}

.bottom-sheet-header {
  padding: 16px 20px;
  /* border-bottom: 1px solid rgba(255, 255, 255, 0.1); */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

body.theme-cloud .bottom-sheet-header {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

.bottom-sheet-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

body.theme-cloud .bottom-sheet-handle {
  background: rgba(0, 0, 0, 0.15);
}

body.theme-minimal .bottom-sheet-header {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.theme-minimal .bottom-sheet-handle {
  background: rgba(0, 0, 0, 0.15);
}

.bottom-sheet-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--theme-text);
  margin: 0;
}

.bottom-sheet-close {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--theme-text-muted);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-sheet-close:hover {
  color: var(--theme-text);
}

.bottom-sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

/* Photo Submit Form */
.photo-submit-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.photo-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  border: 2px dashed var(--theme-border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.photo-dropzone:hover,
.photo-dropzone.dragover {
  border-color: var(--theme-accent);
  background: rgba(233, 69, 96, 0.05);
}

.photo-dropzone .material-icons {
  font-size: 3rem;
  color: var(--theme-text-muted);
}

.photo-dropzone p {
  color: var(--theme-text);
  font-weight: 500;
  margin: 0;
}

.photo-dropzone small {
  color: var(--theme-text-muted);
  font-size: 0.8125rem;
}

.photo-submit-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-submit-preview:empty {
  display: none;
}

.photo-submit-preview .preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
}

.photo-submit-preview .preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-submit-preview .preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.photo-submit-preview .preview-item .remove-btn .material-icons {
  font-size: 14px;
}

.photo-submit-caption textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  color: var(--theme-text);
  font-family: inherit;
  font-size: 0.9375rem;
  resize: vertical;
}

.photo-submit-caption textarea::placeholder {
  color: var(--theme-text-muted);
}

.photo-submit-caption textarea:focus {
  outline: none;
  border-color: var(--theme-accent);
}

.photo-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--theme-accent), #ff6b9d);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.photo-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
}

.photo-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Message Count Badge */
.message-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  background: var(--theme-accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  margin-left: 8px;
}

/* Responsive for Bottom Sheet */
@media (min-width: 768px) {
  .bottom-sheet-modal {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border-radius: 24px 24px 0 0;
  }

  .bottom-sheet-modal.active {
    transform: translateX(-50%) translateY(0);
  }

  .bottom-sheet-modal.bottom-sheet-large {
    max-width: 700px;
  }
}

/* Large Bottom Sheet Modal */
.bottom-sheet-modal.bottom-sheet-large {
  max-height: 90vh;
}

.bottom-sheet-modal.bottom-sheet-large .bottom-sheet-content {
  padding-bottom: 30px;
}

/* Form Hints */
.form-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--theme-text-muted);
  opacity: 0.7;
}

/* Form Labels with Icons */
.submit-form .form-group label .material-icons {
  font-size: 1rem;
  vertical-align: middle;
  margin-right: 4px;
  opacity: 0.7;
}

/* Google Places Autocomplete Dropdown */
.pac-container {
  z-index: 10000 !important;
  background-color: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  font-family: inherit;
  margin-top: 4px;
}

.pac-item {
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.pac-item:first-child {
  border-top: none;
}

.pac-item:hover,
.pac-item-selected {
  background-color: rgba(255, 255, 255, 0.1);
}

.pac-item-query {
  color: #fff;
  font-weight: 500;
}

.pac-icon {
  display: none;
}

.pac-matched {
  color: var(--theme-accent, #c9a86c);
  font-weight: 600;
}

/* Light themes */
body.theme-cloud .pac-container {
  background-color: #ffffff;
  border-color: #e2e8f0;
}

body.theme-cloud .pac-item {
  color: #1e293b;
  border-top-color: #e2e8f0;
}

body.theme-cloud .pac-item:hover,
body.theme-cloud .pac-item-selected {
  background-color: #f1f5f9;
}

body.theme-cloud .pac-item-query {
  color: #0f172a;
}

@media (max-width: 480px) {
  .add-photo-card {
    min-height: 120px;
  }

  .add-photo-card .material-icons {
    font-size: 2rem;
  }

  .message-compose-card {
    padding: 12px;
  }

  .compose-avatar {
    width: 36px;
    height: 36px;
  }
}

/* Photo Submit Item */
.photo-submit-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
}

.photo-submit-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-photo-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.remove-photo-btn .material-icons {
  font-size: 14px;
}

.remove-photo-btn:hover {
  background: rgba(233, 69, 96, 0.9);
}

/* Rotating Animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rotating {
  animation: rotate 1s linear infinite;
}

/* ===== Section Action Button (右上角圓形+按鈕) ===== */
.section-with-action {
  position: relative;
}

.section-action-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--theme-accent);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 3px 12px rgba(233, 69, 96, 0.35);
  z-index: 10;
}

.section-action-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 20px rgba(233, 69, 96, 0.45);
}

.section-action-btn:active {
  transform: scale(0.95);
}

.section-action-btn .material-icons {
  font-size: 1.5rem;
}

/* ===== Transparent Scrollbar ===== */
.memorial-view-page {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.memorial-view-page::-webkit-scrollbar {
  width: 6px;
}

.memorial-view-page::-webkit-scrollbar-track {
  background: transparent;
}

.memorial-view-page::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.memorial-view-page::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Cloud theme scrollbar */
body.theme-cloud {
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

body.theme-cloud::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

body.theme-cloud::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Bottom sheet scrollbar */
.bottom-sheet-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.bottom-sheet-content::-webkit-scrollbar {
  width: 4px;
}

.bottom-sheet-content::-webkit-scrollbar-track {
  background: transparent;
}

.bottom-sheet-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

body.theme-cloud .bottom-sheet-content {
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

body.theme-cloud .bottom-sheet-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

/* Timeline scrollbar */
.timeline {
  scrollbar-width: none;
}

.timeline::-webkit-scrollbar {
  display: none;
}

/* Locations list scrollbar */
.locations-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.locations-list::-webkit-scrollbar {
  width: 4px;
}

.locations-list::-webkit-scrollbar-track {
  background: transparent;
}

.locations-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* ===== Module Comments Section ===== */
.module-comments-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--theme-border);
}

/* Comment Input */
.module-comment-input {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.comment-input-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--theme-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.comment-input-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comment-input-avatar .material-icons {
  color: white;
  font-size: 1rem;
}

.comment-input-field {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--theme-card-bg);
  border-radius: 20px;
  padding: 4px 4px 4px 16px;
  border: 1px solid var(--theme-border);
}

.module-comment-text {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--theme-text);
  font-size: 0.875rem;
  padding: 8px 0;
  outline: none;
}

.module-comment-text::placeholder {
  color: var(--theme-text-muted);
}

.comment-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--theme-accent);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.comment-send-btn:hover {
  transform: scale(1.05);
}

.comment-send-btn .material-icons {
  font-size: 1rem;
}

/* Comment Login */
.module-comment-login {
  text-align: center;
  padding: 12px;
}

.module-comment-login a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--theme-accent);
  text-decoration: none;
  font-size: 0.875rem;
}

.module-comment-login a:hover {
  text-decoration: underline;
}

.module-comment-login .material-icons {
  font-size: 1.125rem;
}

/* Comment Preview */
.module-comment-preview {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px 16px;
}

body.theme-cloud .module-comment-preview {
  background: rgba(0, 0, 0, 0.03);
}

.comment-preview-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-author {
  font-weight: 600;
  color: var(--theme-text);
  font-size: 0.8125rem;
}

.comment-text {
  color: var(--theme-text);
  font-size: 0.8125rem;
  flex: 1;
  min-width: 0;
}

.comment-has-image {
  font-size: 1rem;
  vertical-align: middle;
  margin-right: 2px;
  opacity: 0.7;
}

.comment-time {
  color: var(--theme-text-muted);
  font-size: 0.75rem;
  margin-left: auto;
}

.view-all-comments-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--theme-accent);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.view-all-comments-btn:hover {
  text-decoration: underline;
}

/* Comment Empty */
.module-comment-empty {
  text-align: center;
  padding: 8px;
  color: var(--theme-text-muted);
  font-size: 0.8125rem;
}

/* Modal Comment Input */
.modal-comment-input {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--theme-border);
}

.modal-comment-textarea {
  flex: 1;
  min-height: 60px;
  padding: 12px;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  color: var(--theme-text);
  font-family: inherit;
  font-size: 0.875rem;
  resize: none;
}

.modal-comment-textarea::placeholder {
  color: var(--theme-text-muted);
}

.modal-comment-textarea:focus {
  outline: none;
  border-color: var(--theme-accent);
}

.modal-comment-submit {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: var(--theme-accent);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.modal-comment-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(233, 69, 96, 0.3);
}

.modal-comment-submit .material-icons {
  font-size: 1rem;
}

/* Modal Comments List */
.modal-comments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-comment-item {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
}

body.theme-cloud .modal-comment-item {
  background: rgba(0, 0, 0, 0.03);
}

.comment-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.comment-item-author {
  font-weight: 600;
  color: var(--theme-text);
  font-size: 0.875rem;
}

.comment-item-time {
  color: var(--theme-text-muted);
  font-size: 0.75rem;
}

.comment-item-content {
  color: var(--theme-text);
  font-size: 0.875rem;
  line-height: 1.5;
}

.comment-item-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.comment-delete-btn {
  background: transparent;
  border: none;
  color: var(--theme-text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment-delete-btn:hover {
  color: #e94560;
}

.comment-delete-btn .material-icons {
  font-size: 1rem;
}

.comments-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--theme-text-muted);
}

.comments-empty .material-icons {
  font-size: 2.5rem;
  opacity: 0.5;
  margin-bottom: 8px;
}

.comments-empty p {
  font-size: 0.875rem;
}

.load-more-comments-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  color: var(--theme-text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.load-more-comments-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--theme-accent);
}

/* ===== Module Comment Form with Author ===== */
.modal-comment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--theme-border);
}

.comment-author-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-author-row label {
  font-size: 0.8125rem;
  color: var(--theme-text-muted);
  white-space: nowrap;
}

.comment-author-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  color: var(--theme-text);
  font-size: 0.875rem;
  max-width: 200px;
}

.comment-author-input:focus {
  outline: none;
  border-color: var(--theme-accent);
}

/* Comment Item Footer (actions) */
.comment-item-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

body.theme-cloud .comment-item-footer {
  border-top-color: rgba(0, 0, 0, 0.05);
}

.comment-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: transparent;
  border: none;
  color: var(--theme-text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.comment-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--theme-text);
}

.comment-action-btn.reply-btn:hover {
  color: var(--theme-accent);
}

.comment-action-btn.delete-btn:hover {
  color: #e94560;
}

.comment-action-btn .material-icons {
  font-size: 1rem;
}

.comment-action-btn .reply-count {
  color: var(--theme-accent);
  font-weight: 500;
}

/* Module Reply Form */
.module-reply-form {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

body.theme-cloud .module-reply-form {
  background: rgba(0, 0, 0, 0.03);
}

.reply-author-row {
  margin-bottom: 8px;
}

.reply-author-input {
  width: 100%;
  max-width: 150px;
  padding: 6px 10px;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  color: var(--theme-text);
  font-size: 0.8125rem;
}

.reply-author-input:focus {
  outline: none;
  border-color: var(--theme-accent);
}

.reply-input-row {
  display: flex;
  gap: 8px;
}

.reply-text-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  color: var(--theme-text);
  font-size: 0.875rem;
}

.reply-text-input:focus {
  outline: none;
  border-color: var(--theme-accent);
}

.reply-submit-btn {
  padding: 8px 12px;
  background: var(--theme-accent);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reply-submit-btn:hover {
  filter: brightness(1.1);
}

.reply-submit-btn .material-icons {
  font-size: 1rem;
}

/* Module Replies List */
.module-replies-list {
  margin-top: 12px;
  margin-left: 20px;
  padding-left: 12px;
  border-left: 2px solid var(--theme-border);
}

.module-reply-item {
  padding: 8px 0;
}

.module-reply-item + .module-reply-item {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

body.theme-cloud .module-reply-item + .module-reply-item {
  border-top-color: rgba(0, 0, 0, 0.05);
}

.reply-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.reply-item-author {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--theme-text);
}

.reply-item-time {
  font-size: 0.6875rem;
  color: var(--theme-text-muted);
}

.reply-delete-btn {
  margin-left: auto;
  padding: 2px;
  background: transparent;
  border: none;
  color: var(--theme-text-muted);
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s ease;
}

.reply-delete-btn:hover {
  opacity: 1;
  color: #e94560;
}

.reply-delete-btn .material-icons {
  font-size: 0.875rem;
}

.reply-item-content {
  font-size: 0.8125rem;
  color: var(--theme-text);
  line-height: 1.4;
}

/* Comment Form Footer */
.comment-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-rate-limit-hint {
  font-size: 0.75rem;
  color: var(--theme-text-muted);
  opacity: 0.7;
}

/* Comments Loading */
.comments-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--theme-text-muted);
}

.comments-loading .material-icons {
  font-size: 2rem;
  margin-bottom: 8px;
}

.comments-loading p {
  font-size: 0.875rem;
}

/* Rotating animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rotating {
  animation: rotate 1s linear infinite;
}

/* Comment input placeholder style */
.comment-input-placeholder {
  flex: 1;
  padding: 10px 16px;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 20px;
  color: var(--theme-text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.comment-input-placeholder:hover {
  border-color: var(--theme-accent);
}

/* View all hint */
.view-all-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  color: var(--theme-accent);
  font-size: 0.8125rem;
  cursor: pointer;
}

.view-all-hint .material-icons {
  font-size: 1rem;
}

/* ===== Submit Form (投稿表單) ===== */
.submit-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--theme-text);
}

.form-group label .required {
  color: var(--theme-accent);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea {
  padding: 12px;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  color: var(--theme-text);
  font-family: inherit;
  font-size: 0.9375rem;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--theme-accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--theme-text-muted);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.media-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border: 2px dashed var(--theme-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--theme-text-muted);
}

.media-upload-area:hover {
  border-color: var(--theme-accent);
  color: var(--theme-accent);
}

.media-upload-area .material-icons {
  font-size: 2rem;
}

.media-preview {
  margin-top: 12px;
}

.media-preview:empty {
  display: none;
}

.media-preview img,
.media-preview video {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: cover;
}

.submit-form .submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: linear-gradient(135deg, var(--theme-accent), #ff6b9d);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.submit-form .submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
}

.submit-form .submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.submit-form .submit-btn .material-icons {
  font-size: 1.25rem;
}

/* ===== 訂閱紀念日提醒 Subscription Modal ===== */
.subscription-trigger {
  margin-top: 30px;
  text-align: center;
}

.subscription-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  border: 2px solid var(--theme-accent, #e94560);
  border-radius: 30px;
  color: var(--theme-text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.subscription-btn:hover {
  background: var(--theme-accent, #e94560);
  color: #fff;
}

.subscription-btn .material-icons {
  font-size: 1.25rem;
}

/* Subscription Modal Steps */
.subscription-step {
  padding: 10px 0;
}

.subscription-desc {
  text-align: center;
  color: var(--theme-text-muted);
  margin-bottom: 24px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.subscription-desc.success {
  color: #27ae60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.subscription-desc strong {
  color: var(--theme-text);
}

/* Form Groups */
.subscription-form-group {
  margin-bottom: 20px;
}

.subscription-form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--theme-text-muted);
}

.subscription-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--theme-text);
  font-size: 1rem;
  box-sizing: border-box;
}

.subscription-input:focus {
  outline: none;
  border-color: var(--theme-accent, #e94560);
}

.subscription-input::placeholder {
  color: var(--theme-text-muted);
  opacity: 0.7;
}

/* OTP Input */
.otp-input-container {
  text-align: center;
  margin: 24px 0;
}

.otp-input {
  width: 200px;
  padding: 16px;
  font-size: 1.5rem;
  letter-spacing: 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--theme-text);
}

.otp-input:focus {
  outline: none;
  border-color: var(--theme-accent, #e94560);
}

.otp-timer {
  text-align: center;
  color: var(--theme-text-muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* Buttons */
.subscription-submit-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #e94560, #ff6b9d);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.subscription-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.subscription-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.subscription-resend-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--theme-text-muted);
  margin-top: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.subscription-resend-btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--theme-text);
}

.subscription-resend-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Subscription Options */
.subscription-options {
  margin: 20px 0;
}

.subscription-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.subscription-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.subscription-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--theme-accent, #e94560);
  cursor: pointer;
}

.subscription-option .option-icon {
  color: var(--theme-accent, #e94560);
  font-size: 24px;
}

.subscription-option .option-text {
  flex: 1;
  color: var(--theme-text);
}

.subscription-option .option-text small {
  display: block;
  color: var(--theme-text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

/* Timing Options */
.subscription-timing {
  margin: 24px 0;
}

.subscription-timing > label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--theme-text-muted);
}

.timing-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.timing-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--theme-text);
  transition: all 0.2s ease;
}

.timing-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.timing-option:has(input:checked) {
  background: var(--theme-accent, #e94560);
  border-color: var(--theme-accent, #e94560);
  color: #fff;
}

.timing-option input {
  display: none;
}

/* Success State */
.subscription-success {
  text-align: center;
  padding: 30px 0;
}

.subscription-success .success-icon {
  font-size: 64px;
  color: #27ae60;
  margin-bottom: 16px;
}

.subscription-success h4 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--theme-text);
}

.subscription-success p {
  color: var(--theme-text-muted);
}

.subscription-success .unsubscribe-note {
  font-size: 0.85rem;
  color: var(--theme-text-muted);
  margin-top: 16px;
  opacity: 0.8;
}

.subscription-done-btn {
  width: 100%;
  padding: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 10px;
  color: var(--theme-text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.subscription-done-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Theme Variants - Cloud Theme */
body.theme-cloud .subscription-input,
body.theme-cloud .otp-input {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
  color: #333;
}

body.theme-cloud .subscription-option {
  background: rgba(0, 0, 0, 0.03);
}

body.theme-cloud .subscription-option:hover {
  background: rgba(0, 0, 0, 0.06);
}

body.theme-cloud .timing-option {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
  color: #333;
}

body.theme-cloud .timing-option:hover {
  background: rgba(0, 0, 0, 0.06);
}

body.theme-cloud .subscription-resend-btn {
  border-color: rgba(0, 0, 0, 0.15);
  color: #666;
}

body.theme-cloud .subscription-done-btn {
  background: rgba(0, 0, 0, 0.05);
  color: #333;
}

/* Theme Variants - Minimal Theme */
body.theme-minimal .subscription-input,
body.theme-minimal .otp-input {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
  color: #333;
}

body.theme-minimal .subscription-option {
  background: rgba(0, 0, 0, 0.02);
}

body.theme-minimal .timing-option {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
  color: #333;
}

/* Responsive */
@media (max-width: 480px) {
  .subscription-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .otp-input {
    width: 180px;
    font-size: 1.25rem;
    letter-spacing: 6px;
  }

  .timing-options {
    gap: 8px;
  }

  .timing-option {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  .message-filter-tabs {
    overflow-x: auto;
    padding: 20px;
  }
}
