/* ==========================================================================
   ROMANTIC GLASSMORPHISM DESIGN SYSTEM (Mobile-Only Optimized)
   Target Profile: Samsung Galaxy A56 & Premium Mobile Browsers
   ========================================================================== */

:root {
  /* Colors */
  --primary-pink: #ff85a1;
  --secondary-lavender: #a38bf9;
  --rose-gold: #b76e79;
  --blush-pastel: #ffe5ec;
  --deep-sunset: #473254;
  --gold-accent: #e5c158;
  --heart-red: #ff4d6d;
  
  /* Neutral Gradients & Backgrounds */
  --bg-gradient: linear-gradient(135deg, #ffe5ec 0%, #ffc6ff 50%, #e8dbfc 100%);
  --text-dark: #3a2e39;
  --text-light: #fcf7f8;
  --text-muted: #7d6b7d;
  
  /* Glassmorphism Tokens */
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-bg-dense: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 10px 30px -10px rgba(183, 110, 121, 0.3);
  --glass-glow: 0 0 15px rgba(255, 133, 161, 0.4);
  
  /* Font Family */
  --font-ui: 'Outfit', sans-serif;
  --font-title: 'Playfair Display', serif;
  --font-handwriting: 'Dancing Script', cursive;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* Disable tap highlight box on Android Chrome */
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-ui);
  color: var(--text-dark);
  background: #1e1124; /* Fallback */
}

/* Particle Canvas */
#particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ==========================================================================
   Mobile-Only Simulator Frame
   ========================================================================== */
.mobile-frame {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-gradient);
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
  z-index: 2;
  display: flex;
  flex-direction: column;
}

/* For screens larger than a typical phone, center and show phone borders */
@media (min-width: 481px) {
  body {
    background: #120917;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-frame {
    height: 92vh;
    border-radius: 40px;
    border: 8px solid rgba(255, 255, 255, 0.15);
  }
}

/* Common Helper Classes */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Splash Screen Envelope (Gate)
   ========================================================================== */
.splash-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ffc6ff 0%, #ffe5ec 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.8s ease-in-out, visibility 0.8s;
  padding: 20px;
}

.splash-container.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.splash-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(45deg, var(--heart-red), var(--deep-sunset));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 30px;
  margin-bottom: 10px;
  opacity: 0;
  animation: fadeInUp 1s ease forwards 0.5s;
}

.splash-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.4;
  opacity: 0;
  animation: fadeInUp 1s ease forwards 0.8s;
}

/* 3D Envelope Animation */
.envelope-wrapper {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.envelope {
  position: relative;
  width: 220px;
  height: 140px;
  background: #f2e3d5;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.envelope:hover {
  transform: translateY(-5px);
}

.envelope .flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 110px solid transparent;
  border-right: 110px solid transparent;
  border-top: 80px solid #ecdac6;
  transform-origin: top;
  transition: transform 0.4s ease 0.2s, z-index 0.2s ease 0.4s;
  z-index: 4;
}

.envelope .pocket {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(150deg, #ecdac6 60%, #e0c8b0 100%);
  border-radius: 0 0 10px 10px;
  z-index: 3;
  clip-path: polygon(0 40px, 110px 85px, 220px 40px, 220px 140px, 0 140px);
}

.letter-preview {
  position: absolute;
  bottom: 10px;
  left: 15px;
  width: 190px;
  height: 110px;
  background: var(--text-light);
  border-radius: 5px;
  padding: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  z-index: 2;
  transition: transform 0.4s ease 0.4s;
  display: flex;
  justify-content: center;
  align-items: center;
}

.preview-text {
  font-family: var(--font-handwriting);
  font-size: 1.8rem;
  color: var(--heart-red);
}

.heart-seal {
  position: absolute;
  top: 60px;
  left: 95px;
  width: 30px;
  height: 30px;
  background: var(--heart-red);
  transform: rotate(-45deg);
  z-index: 5;
  transition: transform 0.4s ease, opacity 0.3s ease 0.2s;
  box-shadow: 0 4px 10px rgba(255, 77, 109, 0.3);
}

.heart-seal:before,
.heart-seal:after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  background: var(--heart-red);
  border-radius: 50%;
}

.heart-seal:before {
  top: -15px;
  left: 0;
}

.heart-seal:after {
  left: 15px;
  top: 0;
}

/* Open Envelope States */
.envelope.open .flap {
  transform: rotateX(180deg);
  z-index: 1;
}

.envelope.open .letter-preview {
  transform: translateY(-80px) scale(1.05);
  z-index: 5;
}

.envelope.open .heart-seal {
  opacity: 0;
  transform: scale(0) rotate(-45deg);
}

/* ==========================================================================
   Music Player Widget
   ========================================================================== */
.floating-player-wrapper {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  padding: 6px;
  border-radius: 50px;
  box-shadow: var(--glass-shadow);
}

.vinyl-record {
  width: 36px;
  height: 36px;
  background: #111;
  background-image: radial-gradient(circle, #222 2px, transparent 3px, #111 4px, #333 8px, #111 9px, #444 13px, #111 14px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.5s ease;
}

.vinyl-label {
  width: 12px;
  height: 12px;
  background: var(--primary-pink);
  border-radius: 50%;
  border: 2px solid #000;
}

.vinyl-record.spinning {
  animation: spin 3s linear infinite;
}

.music-toggle {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  color: var(--deep-sunset);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
}

.music-toggle svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   App Layout & Header
   ========================================================================== */
.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.app-header {
  padding: 24px 20px 16px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.1) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  text-align: center;
  z-index: 10;
}

.anniversary-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--rose-gold);
  font-weight: 800;
}

/* Countdown Clock styling */
.countdown-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.time-block {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 10px;
  min-width: 62px;
  box-shadow: 0 4px 15px -3px rgba(183, 110, 121, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.time-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--deep-sunset);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.6);
}

.time-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Views Area */
.views-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 24px;
  scroll-behavior: smooth;
}

/* hide scrollbars for seamless look */
.views-wrapper::-webkit-scrollbar {
  display: none;
}

.content-view {
  display: none;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.content-view.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.view-header {
  margin-bottom: 24px;
  text-align: center;
}

.view-header h2 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--deep-sunset);
  margin-bottom: 6px;
}

.view-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   VIEW 2: Horizontal Polaroid Slider (Samsung A56 Optimized)
   ========================================================================== */
.gallery-slider {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  gap: 20px;
  padding: 15px 10px 25px;
  scrollbar-width: none; /* Firefox */
}

.gallery-slider::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.gallery-slide {
  flex: 0 0 88%; /* 88% width so the next card is slightly visible */
  scroll-snap-align: center;
  perspective: 1000px;
  aspect-ratio: 3/4.3;
}

.polaroid-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 25px rgba(183, 110, 121, 0.2);
  border-radius: 12px;
}

.polaroid-card.flipped {
  transform: rotateY(180deg);
}

.polaroid-front {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #fff;
  border-radius: 12px;
  padding: 12px 12px 20px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(183, 110, 121, 0.1);
}

.polaroid-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #faf6f0; /* paper style background */
  border-radius: 12px;
  padding: 12px 12px 20px;
  display: flex;
  flex-direction: column;
  border: 1.5px solid #eadecc;
  justify-content: space-between;
  transform: rotateY(180deg);
}

.polaroid-front img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #f2eef4;
}

.polaroid-caption {
  font-family: var(--font-handwriting);
  font-size: clamp(1.1rem, 4.5vw, 1.5rem);
  text-align: center;
  color: #3b2d2f;
  margin-top: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slide-date-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  background: var(--heart-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(255, 77, 109, 0.3);
  z-index: 10;
}

.handwritten-note {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px 5px;
}

.handwritten-note p {
  font-family: var(--font-handwriting);
  font-size: 1.5rem;
  color: #4a332a;
  line-height: 1.45;
  text-align: center;
}

.polaroid-actions {
  margin-top: 15px;
  display: flex;
  justify-content: center;
}

.view-photo-btn {
  background: var(--primary-pink);
  border: none;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(255, 133, 161, 0.3);
  transition: transform 0.2s;
}

.view-photo-btn:active {
  transform: scale(0.95);
}

/* Dots Page Indicator */
.slider-dots-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(183, 110, 121, 0.3);
  transition: width 0.3s, background-color 0.3s;
}

.dot.active {
  width: 20px;
  background-color: var(--heart-red);
  border-radius: 4px;
}

/* ==========================================================================
   VIEW 3: Letters Envelope Styling
   ========================================================================== */
.letters-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 10px 0;
}

.letter-envelope-item {
  cursor: pointer;
}

.envelope-mini {
  background: linear-gradient(135deg, #fceade 0%, #ecdac6 100%);
  border-radius: 12px;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid #dfc6ae;
  box-shadow: 0 6px 15px -4px rgba(183, 110, 121, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.envelope-mini::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: rgba(255, 255, 255, 0.15);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.envelope-mini:active {
  transform: scale(0.96);
}

.envelope-badge {
  background: var(--heart-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.envelope-title {
  font-family: var(--font-handwriting);
  font-size: 1.35rem;
  color: var(--deep-sunset);
  line-height: 1.25;
}

/* ==========================================================================
   VIEW 4: Promises & Secrets
   ========================================================================== */
.promises-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.promise-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--glass-shadow);
}

.promise-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.promise-icon {
  font-size: 1.5rem;
}

.promise-card h3 {
  font-size: 1.05rem;
  color: var(--deep-sunset);
  font-weight: 800;
}

.promise-card p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dark);
}

/* Stats Styling */
.stats-list {
  list-style: none;
}

.stats-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.85rem;
  border-bottom: 1px dashed rgba(183, 110, 121, 0.2);
}

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

.stats-list li span:first-child {
  color: var(--text-muted);
}

.stats-list li span:last-child {
  font-weight: 800;
  color: var(--deep-sunset);
}

/* Favorites Styling */
.fav-list {
  padding-left: 20px;
}

.fav-list li {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.fav-list li::marker {
  color: var(--primary-pink);
  font-weight: bold;
}

/* ==========================================================================
   Sticky Bottom Navigation
   ========================================================================== */
.app-navigation {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 75px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px 10px; /* buffer for bottom safe-area */
  z-index: 10;
}

/* Bottom safe-area for tall phones like Samsung A56 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-navigation {
    height: calc(75px + env(safe-area-inset-bottom));
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  cursor: pointer;
  width: 60px;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item svg {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
  transition: color 0.3s;
}

.nav-item span {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Active State Styles */
.nav-item.active {
  transform: translateY(-5px);
  color: var(--heart-red);
}

.nav-item.active svg {
  color: var(--heart-red);
  filter: drop-shadow(0 0 5px rgba(255, 77, 109, 0.4));
}

/* ==========================================================================
   Modals & Lightbox Overlays
   ========================================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(43, 30, 48, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Close Modal Button */
.close-modal-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Letter Card Style */
.letter-popup-card {
  width: 100%;
  max-width: 360px;
  background: #fbf8f3;
  border-radius: 16px;
  padding: 30px 20px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.4s ease;
}

.modal-overlay.show .letter-popup-card {
  transform: scale(1);
}

.letter-paper {
  background: 
    linear-gradient(90deg, rgba(255, 77, 109, 0.15) 1px, transparent 1px) 25px 0%,
    linear-gradient(rgba(183, 110, 121, 0.15) 1px, transparent 1px);
  background-size: 100% 100%, 100% 2.2rem;
  padding-left: 45px;
  padding-right: 10px;
  min-height: 280px;
}

.letter-handwritten {
  font-family: var(--font-handwriting);
  font-size: 1.6rem;
  color: #3b2d2f;
  line-height: 2.2rem;
  white-space: pre-wrap;
}

/* Lightbox Content */
.lightbox-content {
  position: relative;
  max-width: 95%;
  max-height: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.9);
  transition: transform 0.4s ease;
}

.modal-overlay.show .lightbox-content {
  transform: scale(1);
}

.lightbox-content img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border: 4px solid #fff;
}

.lightbox-caption {
  font-family: var(--font-handwriting);
  color: #fff;
  font-size: 1.6rem;
  margin-top: 15px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   Animations Keyframes
   ========================================================================== */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes heartbeat {
  0% { transform: translate(-50%, 0) scale(1); }
  25% { transform: translate(-50%, 0) scale(1.1); }
  40% { transform: translate(-50%, 0) scale(1); }
  60% { transform: translate(-50%, 0) scale(1.15); }
  100% { transform: translate(-50%, 0) scale(1); }
}

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