@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&family=Quicksand:wght@400;500;600;700&display=swap');

:root {
  --primary-color: #ff7597;
  --primary-hover: #ff527b;
  --secondary-color: #fca3b7;
  --bg-gradient: linear-gradient(135deg, #ffeef2 0%, #fff5f7 50%, #e8f0fe 100%);
  --text-main: #4a3e43;
  --text-muted: #8c767e;
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(255, 117, 151, 0.1);
  --font-main: 'Quicksand', sans-serif;
  --font-hand: 'Caveat', cursive;
  --transition-speed: 0.4s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Floating Hearts Background */
.background-hearts {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.heart-particle {
  position: absolute;
  bottom: -20px;
  background-color: var(--secondary-color);
  display: inline-block;
  height: 20px;
  width: 20px;
  opacity: 0.6;
  transform: rotate(-45deg);
  animation: floatUp 12s infinite linear;
}

.heart-particle::before,
.heart-particle::after {
  content: "";
  background-color: var(--secondary-color);
  border-radius: 50%;
  height: 20px;
  position: absolute;
  width: 20px;
}

.heart-particle::before {
  top: -10px;
  left: 0;
}

.heart-particle::after {
  left: 10px;
  top: 0;
}

@keyframes floatUp {
  0% {
    bottom: -20px;
    transform: translateX(0) rotate(-45deg) scale(0.6);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    bottom: 110%;
    transform: translateX(100px) rotate(45deg) scale(1.2);
    opacity: 0;
  }
}

/* Login Screen */
#login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  background: var(--bg-gradient);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

#login-screen.hidden {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 3rem 2.5rem;
  border-radius: 24px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,117,151,0.15) 0%, transparent 60%);
  z-index: -1;
  pointer-events: none;
}

.login-icon {
  font-size: 3.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
  animation: pulse 2s infinite;
  display: inline-block;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.login-card h2 {
  font-family: var(--font-hand);
  font-size: 2.8rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.login-card p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

.input-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.input-group input {
  width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 50px;
  border: 2px solid rgba(255, 117, 151, 0.2);
  outline: none;
  font-family: var(--font-main);
  font-size: 1rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-main);
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.input-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(255, 117, 151, 0.15);
}

.btn-login {
  width: 100%;
  padding: 1rem;
  border-radius: 50px;
  border: none;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  color: white;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 117, 151, 0.3);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 117, 151, 0.4);
  filter: brightness(1.05);
}

.btn-login:active {
  transform: translateY(0);
}

.login-error {
  color: #e04f62;
  font-size: 0.9rem;
  margin-top: 1rem;
  display: none;
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Main App Layout */
#main-app {
  display: none;
  position: relative;
  z-index: 10;
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem 6rem;
  opacity: 0;
  transition: opacity 1s ease;
}

#main-app.visible {
  display: block;
  opacity: 1;
}

/* Floating Controls (Music) */
.floating-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Vinyl Player Styling */
.control-btn.vinyl-player {
  width: 60px;
  height: 60px;
  background: #111;
  border: 4px solid #333;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  position: relative;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s, box-shadow 0.3s;
  overflow: hidden;
}

.control-btn.vinyl-player::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

.control-btn.vinyl-player::after {
  content: '♥';
  position: absolute;
  color: white;
  font-size: 0.75rem;
  z-index: 3;
  pointer-events: none;
}

/* Vinyl grooves */
.vinyl-grooves {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-image: 
    radial-gradient(circle, transparent 30%, rgba(255,255,255,0.06) 31%, transparent 32%),
    radial-gradient(circle, transparent 45%, rgba(255,255,255,0.06) 46%, transparent 47%),
    radial-gradient(circle, transparent 60%, rgba(255,255,255,0.06) 61%, transparent 62%);
  z-index: 1;
}

/* Spinning Animation */
.control-btn.vinyl-player.playing {
  animation: spinVinyl 4s linear infinite;
  box-shadow: 0 12px 28px rgba(255, 117, 151, 0.3);
}

@keyframes spinVinyl {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.control-btn.vinyl-player:hover {
  transform: scale(1.08);
}

/* Header & Hero Section */
header {
  text-align: center;
  margin-bottom: 4rem;
  padding-top: 2rem;
}

.title-birthday {
  font-family: var(--font-hand);
  font-size: 4.5rem;
  color: var(--primary-color);
  text-shadow: 2px 2px 4px rgba(255, 117, 151, 0.1);
  margin-bottom: 1rem;
  animation: floatTitle 3s ease-in-out infinite alternate;
}

@keyframes floatTitle {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.subtitle-birthday {
  font-size: 1.1rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Love Counter Section */
.counter-container {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 4rem;
}

.counter-title {
  font-family: var(--font-hand);
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

.counter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.counter-box {
  background: rgba(255, 255, 255, 0.9);
  padding: 1.5rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 117, 151, 0.1);
  box-shadow: 0 4px 12px rgba(255, 117, 151, 0.05);
}

.counter-num {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.2rem;
}

.counter-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Timeline Section */
.section-title {
  text-align: center;
  font-family: var(--font-hand);
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 3rem;
  position: relative;
}

.section-title::after {
  content: '♥';
  display: block;
  font-size: 1.2rem;
  color: var(--secondary-color);
  margin-top: 0.5rem;
}

.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto 5rem;
  padding: 2rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: linear-gradient(to bottom, var(--secondary-color), var(--primary-color), var(--secondary-color));
  transform: translateX(-50%);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  width: 50%;
  padding: 1.5rem 2.5rem;
  box-sizing: border-box;
}

.timeline-item::after {
  content: '♥';
  position: absolute;
  top: 2rem;
  right: -10px;
  width: 20px;
  height: 20px;
  background: white;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  z-index: 1;
}

.timeline-item.left {
  left: 0;
  text-align: right;
}

.timeline-item.right {
  left: 50%;
}

.timeline-item.right::after {
  left: -10px;
}

.timeline-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 1.8rem;
  border-radius: 20px;
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.timeline-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(255, 117, 151, 0.15);
}

.timeline-date {
  font-weight: 700;
  color: var(--primary-color);
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.timeline-title {
  font-family: var(--font-hand);
  font-size: 2rem;
  margin-bottom: 0.8rem;
  color: var(--text-main);
}

.timeline-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* Gallery Section */
.gallery-section {
  margin-bottom: 5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 1rem 0;
}

.gallery-item {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.gallery-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 16px 36px rgba(255, 117, 151, 0.18);
}

.gallery-img-wrapper {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  overflow: hidden;
}

.gallery-img-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-speed);
}

.gallery-item:hover .gallery-img-wrapper img {
  transform: scale(1.08);
}

.gallery-info {
  padding: 1.5rem;
}

.gallery-info h4 {
  font-family: var(--font-hand);
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.gallery-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Envelope / Letter Section */
.envelope-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 3rem;
  perspective: 1000px;
}

.envelope-wrapper {
  position: relative;
  width: 320px;
  height: 220px;
  background-color: #f7d2d8;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.6s ease;
  margin-top: 50px;
}

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

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

/* Sides */
.envelope-pocket {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 160px solid #f9cbd3;
  border-right: 160px solid #f9cbd3;
  border-bottom: 110px solid #f8bdc9;
  border-top: 110px solid transparent;
  border-radius: 0 0 12px 12px;
  z-index: 3;
}

/* Letter inside */
.envelope-letter {
  position: absolute;
  bottom: 10px;
  left: 15px;
  width: 290px;
  height: 180px;
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.6s ease;
  z-index: 2;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

.envelope-letter-preview {
  font-family: var(--font-hand);
  font-size: 1.8rem;
  color: var(--primary-color);
  font-weight: 700;
  text-align: center;
  animation: pulse 2s infinite;
}

/* Interactive envelope open states */
.envelope-wrapper.open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 1;
  transition: transform 0.4s ease, z-index 0.2s ease;
}

.envelope-wrapper.open .envelope-letter {
  transform: translateY(-80px);
  z-index: 2;
}

/* Letter Backdrop */
.letter-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.letter-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

/* Letter Modal Container */
.letter-modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1002;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  padding: 1.5rem;
}

.letter-modal-container.active {
  opacity: 1;
  pointer-events: all;
}

.letter-paper {
  background: #fffbf2; /* Cream paper background */
  background-image: radial-gradient(#efdfca 1px, transparent 0), radial-gradient(#efdfca 1px, transparent 0);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  border-radius: 20px;
  box-shadow: 0 15px 45px rgba(255, 117, 151, 0.2);
  padding: 3rem 2.5rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid rgba(255, 117, 151, 0.15);
  transform: scale(0.9) rotate(-2deg);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.letter-modal-container.active .letter-paper {
  transform: scale(1) rotate(0deg);
}

.letter-paper-content {
  font-family: var(--font-hand);
  font-size: 1.5rem;
  line-height: 1.8;
  color: #4a3e43;
}

.letter-paper-content h5 {
  font-family: var(--font-hand);
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  text-align: center;
}

.letter-paper-content p {
  margin-bottom: 1.5rem;
  text-indent: 1.5rem;
}

.letter-paper-content .letter-signature {
  text-align: right;
  font-size: 2.4rem;
  color: var(--primary-color);
  margin-top: 2rem;
}

.letter-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s, transform 0.2s;
}

.letter-close-btn:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  padding: 1.5rem;
}

.lightbox-modal.active {
  opacity: 1;
  pointer-events: all;
}

.lightbox-content {
  background: white;
  border-radius: 24px;
  overflow: hidden;
  max-width: 800px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: row;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

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

.lightbox-media {
  flex: 1.2;
  background: #fdf6f7;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.lightbox-media img {
  width: 100%;
  height: 100%;
  max-height: 500px;
  object-fit: cover;
}

.lightbox-details {
  flex: 1;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lightbox-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-main);
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s, background-color 0.2s;
}

.lightbox-close:hover {
  transform: scale(1.1);
  background-color: white;
  color: var(--primary-color);
}

.lightbox-title {
  font-family: var(--font-hand);
  font-size: 2.6rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.lightbox-desc {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-main);
}

/* Responsive Styles */
@media (max-width: 768px) {
  .timeline::before {
    left: 40px;
  }

  .timeline-item {
    width: 100%;
    padding-left: 80px;
    padding-right: 1rem;
    text-align: left !important;
  }

  .timeline-item.right {
    left: 0;
  }

  .timeline-item::after {
    left: 30px !important;
    right: auto !important;
  }

  .counter-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lightbox-content {
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
  }

  .lightbox-media img {
    max-height: 300px;
  }

  .lightbox-details {
    padding: 1.5rem;
  }

  .title-birthday {
    font-size: 3.2rem;
  }
}
