/* ===========================
   OPERATION: MEOW DATE
   Design System & Styles
   =========================== */

/* --- CSS Custom Properties --- */
:root {
  --white: #FFFFFF;
  --soft-pink: #FFD6E0;
  --pink-medium: #FFB3C6;
  --pink-deep: #FF8FAB;
  --cream: #FFF5E4;
  --cream-dark: #FFE8CC;
  --cat-brown: #C8956C;
  --cat-brown-light: #E0BB95;
  --error-red: #FF4D4D;
  --error-red-dark: #CC0000;
  --text-dark: #3D2C2E;
  --text-muted: #8B7577;
  --shadow-soft: 0 8px 32px rgba(200, 149, 108, 0.15);
  --shadow-hover: 0 12px 40px rgba(200, 149, 108, 0.25);
  --shadow-popup: 0 20px 60px rgba(0, 0, 0, 0.3);
  --radius-card: 24px;
  --radius-btn: 50px;
  --radius-small: 12px;
  --font-heading: 'Fredoka', sans-serif;
  --font-body: 'Poppins', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--cream) 0%, var(--soft-pink) 50%, var(--cream) 100%);
  background-attachment: fixed;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* --- Floating Hearts Background --- */
#floating-hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.heart {
  position: absolute;
  font-size: 1.2rem;
  opacity: 0;
  animation: floatHeart linear infinite;
  will-change: transform, opacity;
}

@keyframes floatHeart {
  0% {
    transform: translateY(100vh) translateX(0) rotate(0deg) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.4;
    transform: translateY(50vh) translateX(30px) rotate(180deg) scale(0.8);
  }
  90% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(-10vh) translateX(-20px) rotate(360deg) scale(0.3);
    opacity: 0;
  }
}

/* --- Screen Container --- */
.screen {
  display: none;
  width: 100%;
  max-width: 600px;
  padding: 1rem;
  position: relative;
  z-index: 1;
  animation: fadeIn 0.6s ease-out;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* --- Card --- */
.card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 2.5rem 2rem;
  width: 100%;
  text-align: center;
  border: 1px solid rgba(255, 214, 224, 0.5);
  transition: var(--transition-smooth);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

/* --- Cat Image --- */
.cat-container {
  margin-bottom: 1.5rem;
}

.cat-image {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 4px 12px rgba(200, 149, 108, 0.3));
  transition: var(--transition-smooth);
}

.cat-bounce {
  animation: catBounce 3s ease-in-out infinite;
}

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

/* --- Typography --- */
.typing-text {
  font-family: var(--font-heading);
  color: var(--text-dark);
  min-height: 1.5em;
  margin-bottom: 0.5rem;
}

h1.typing-text {
  font-size: 1.8rem;
  font-weight: 600;
}

.sub-text {
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--text-muted);
}

.question-text {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--pink-deep);
  margin-top: 0.5rem;
}

/* Typing cursor */
.typing-cursor::after {
  content: '|';
  animation: blink 0.7s step-end infinite;
  color: var(--cat-brown);
  font-weight: 300;
  margin-left: 2px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* --- Buttons --- */
.button-area {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: var(--transition-smooth);
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn:hover::after {
  opacity: 1;
}

.btn:focus-visible {
  outline: 3px solid var(--cat-brown);
  outline-offset: 3px;
}

.btn-yes {
  background: linear-gradient(135deg, var(--pink-deep), var(--pink-medium));
  color: var(--white);
  padding: 1rem 2.5rem;
  font-size: 1.3rem;
  box-shadow: 0 4px 15px rgba(255, 143, 171, 0.4);
}

.btn-yes:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(255, 143, 171, 0.5);
}

.btn-yes:active {
  transform: scale(0.98);
}

.btn-no {
  background: var(--cream);
  color: var(--text-muted);
  padding: 0.75rem 1.8rem;
  font-size: 1rem;
  border: 1px solid var(--cream-dark);
}

.btn-no:hover {
  transform: scale(1.05);
  background: var(--cream-dark);
  box-shadow: 0 4px 12px rgba(200, 149, 108, 0.2);
}

.btn-no:active {
  transform: scale(0.98);
}

/* --- YES / Celebration Screen --- */
.card-celebration {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 214, 224, 0.4));
}

.celebration-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pink-deep), var(--cat-brown));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  animation: celebrationPulse 2s ease-in-out infinite;
}

@keyframes celebrationPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.celebration-sub {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* --- Date Idea Cards --- */
.date-ideas {
  margin: 1.5rem 0;
}

.date-ideas-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 1rem;
}

.date-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.date-card {
  background: var(--white);
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-small);
  padding: 1.2rem 0.75rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-heading);
}

.date-card:hover {
  transform: translateY(-3px);
  border-color: var(--pink-medium);
  box-shadow: 0 6px 20px rgba(255, 179, 198, 0.3);
}

.date-card:focus-visible {
  outline: 3px solid var(--cat-brown);
  outline-offset: 2px;
}

.date-card.selected {
  border-color: var(--pink-deep);
  background: linear-gradient(135deg, rgba(255, 214, 224, 0.3), rgba(255, 255, 255, 1));
  box-shadow: 0 4px 15px rgba(255, 143, 171, 0.3);
  transform: translateY(-2px);
}

.date-card-emoji {
  font-size: 2rem;
}

.date-card-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
}

.btn-lets-go {
  margin-top: 1rem;
  animation: fadeIn 0.4s ease-out;
}

/* Staggered entrance for date cards */
.date-card.animate-in {
  animation: cardEntrance 0.5s ease-out backwards;
}
.date-card.animate-in:nth-child(1) { animation-delay: 0.1s; }
.date-card.animate-in:nth-child(2) { animation-delay: 0.2s; }
.date-card.animate-in:nth-child(3) { animation-delay: 0.3s; }
.date-card.animate-in:nth-child(4) { animation-delay: 0.4s; }
.date-card.animate-in:nth-child(5) { animation-delay: 0.5s; }

.date-card-full {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--cream), var(--white));
  border-style: dashed;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- Date Picker Screen --- */
.card-date-picker {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 232, 204, 0.3));
}

.date-picker-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.3rem;
}

.date-picker-sub {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--pink-deep);
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.date-picker-inputs {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  flex: 1;
  min-width: 140px;
}

.input-group label {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  padding-left: 0.5rem;
}

.cute-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-small);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-dark);
  background: var(--white);
  transition: var(--transition-smooth);
  outline: none;
}

.cute-input:focus {
  border-color: var(--pink-medium);
  box-shadow: 0 0 0 4px rgba(255, 179, 198, 0.2);
}

/* --- Confirmation / Final Screen --- */
.card-final {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 214, 224, 0.5));
}

.final-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pink-deep), var(--error-red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
  animation: celebrationPulse 2s ease-in-out infinite;
}

.final-sub {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.final-message {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.final-hearts {
  font-size: 2rem;
  margin-top: 1.5rem;
  animation: heartPulse 1.5s ease-in-out infinite;
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* --- Error Popup --- */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: overlayIn 0.3s ease-out;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.popup-dialog {
  background: var(--white);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-popup);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: popupBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.popup-titlebar {
  background: linear-gradient(135deg, var(--error-red), var(--error-red-dark));
  color: var(--white);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
}

.popup-icon {
  font-size: 1.1rem;
}

.popup-title {
  flex: 1;
}

.popup-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--white);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.popup-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.popup-body {
  padding: 1.5rem;
  text-align: center;
}

.popup-cat-container {
  margin-bottom: 1rem;
}

.popup-cat-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 50%;
  animation: popupCatShake 0.5s ease-in-out;
}

@keyframes popupCatShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-5deg); }
  40% { transform: rotate(5deg); }
  60% { transform: rotate(-3deg); }
  80% { transform: rotate(3deg); }
}

.popup-error-code {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  letter-spacing: 1px;
}

.popup-message {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text-dark);
  line-height: 1.5;
}

/* Loading spinner for click 4 */
.popup-loading {
  padding: 1rem 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--cream-dark);
  border-top-color: var(--pink-deep);
  border-radius: 50%;
  margin: 0 auto 0.75rem;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-muted);
  animation: loadingDots 1.5s steps(3) infinite;
}

.popup-result {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--pink-deep);
  font-weight: 600;
  padding-top: 0.5rem;
}

.popup-footer {
  padding: 0 1.5rem 1.5rem;
  text-align: center;
}

.btn-popup {
  background: linear-gradient(135deg, var(--soft-pink), var(--pink-medium));
  color: var(--text-dark);
  padding: 0.7rem 2rem;
  font-size: 1rem;
  font-weight: 600;
}

.btn-popup:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(255, 179, 198, 0.4);
}

/* --- Achievement Toast --- */
.achievement-toast {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--cat-brown), var(--cat-brown-light));
  color: var(--white);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-small);
  box-shadow: 0 8px 30px rgba(200, 149, 108, 0.4);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 200;
  transition: top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90vw;
}

.achievement-toast.show {
  top: 20px;
}

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

.achievement-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.8;
}

.achievement-desc {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
}

/* --- Responsive Design --- */

/* Tablet */
@media (max-width: 768px) {
  .card {
    padding: 2rem 1.5rem;
  }

  h1.typing-text {
    font-size: 1.5rem;
  }

  .question-text {
    font-size: 1.2rem;
  }

  .cat-image {
    width: 150px;
    height: 150px;
  }

  .celebration-title, .final-title {
    font-size: 1.7rem;
  }
}

/* Phone */
@media (max-width: 480px) {
  body {
    padding: 0;
  }

  .screen {
    padding: 0.5rem;
    max-width: 100%;
  }

  .card {
    padding: 1.5rem 1rem;
    border-radius: 20px;
  }

  h1.typing-text {
    font-size: 1.3rem;
  }

  .sub-text {
    font-size: 1rem;
  }

  .question-text {
    font-size: 1.15rem;
  }

  .cat-image {
    width: 130px;
    height: 130px;
  }

  .btn-yes {
    padding: 0.9rem 2rem;
    font-size: 1.15rem;
    width: 100%;
  }

  .btn-no {
    padding: 0.7rem 1.5rem;
    width: 100%;
  }

  .button-area {
    flex-direction: column;
  }

  .date-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .date-picker-inputs {
    flex-direction: column;
  }

  .popup-dialog {
    max-width: 95%;
  }

  .popup-cat-img {
    width: 100px;
    height: 100px;
  }

  .celebration-title, .final-title {
    font-size: 1.5rem;
  }

  .final-hearts {
    font-size: 1.5rem;
  }
}

/* Prevent horizontal scroll */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}
