/* ============================================
   Valentine's CAPTCHA - Styles
   ============================================ */

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

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Roboto', Arial, sans-serif;
  background: #f2f2f2;
  color: #202124;
  -webkit-font-smoothing: antialiased;
}

/* --- Screen System --- */
.screen {
  display: none;
  min-height: 100vh;
  width: 100%;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
}

.screen.fade-out {
  opacity: 0;
}

.screen.fade-in {
  opacity: 1;
}

/* ============================================
   Screen 1: Security Question
   ============================================ */
.security-card {
  background: #fff;
  border-radius: 8px;
  padding: 48px 40px 36px;
  max-width: 450px;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  text-align: center;
  border: 1px solid #dadce0;
}

.google-logo {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.g-blue { color: #4285f4; }
.g-red { color: #ea4335; }
.g-yellow { color: #fbbc05; }
.g-green { color: #34a853; }

.security-title {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
  color: #202124;
}

.security-subtitle {
  font-size: 14px;
  color: #5f6368;
  margin-bottom: 32px;
}

.security-question {
  text-align: left;
}

.security-question label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 12px;
}

.input-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.input-wrapper input:focus {
  border-color: #4285f4;
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.input-wrapper input.shake {
  animation: shake 0.5s ease;
}

.input-wrapper input.error {
  border-color: #ea4335;
}

.input-error {
  display: none;
  font-size: 12px;
  color: #ea4335;
  margin-top: 6px;
  position: absolute;
  bottom: -20px;
  left: 0;
}

.input-error.visible {
  display: block;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 12px 24px;
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  background: #3367d6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-primary:active {
  background: #2a56c6;
}

.security-footer {
  font-size: 12px;
  color: #5f6368;
  margin-top: 24px;
}

/* ============================================
   Screen 1.5: Loading Spinner
   ============================================ */
.loading-card {
  background: #fff;
  border-radius: 8px;
  padding: 48px 40px;
  max-width: 450px;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  text-align: center;
  border: 1px solid #dadce0;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 24px auto;
  border: 3px solid #dadce0;
  border-top-color: #4285f4;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 14px;
  color: #5f6368;
}

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

/* ============================================
   Screen 2: CAPTCHA
   ============================================ */
.captcha-wrapper {
  position: relative;
  max-width: 400px;
  width: 100%;
}

.captcha-card {
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.captcha-header {
  background: #4a90d9;
  padding: 16px 20px;
}

.captcha-prompt {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

.captcha-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
  background: #e0e0e0;
}

.captcha-cell {
  position: relative;
  aspect-ratio: 1;
  cursor: pointer;
  overflow: hidden;
  background: #ccc;
  transition: transform 0.15s ease;
}

.captcha-cell:active {
  transform: scale(0.95);
}

/* Placeholder photo styling */
.captcha-cell .photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  padding: 8px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.captcha-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Selection overlay */
.captcha-cell .cell-overlay {
  position: absolute;
  inset: 0;
  background: rgba(66, 133, 244, 0.35);
  border: 3px solid #4285f4;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.captcha-cell .cell-check {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  background: #4285f4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.captcha-cell.selected .cell-overlay {
  opacity: 1;
}

.captcha-cell.selected .cell-check {
  opacity: 1;
}

/* Correct answer green flash */
.captcha-cell.correct .cell-overlay {
  background: rgba(52, 168, 83, 0.4);
  border-color: #34a853;
  opacity: 1;
}

.captcha-cell.correct .cell-check {
  background: #34a853;
  opacity: 1;
}

.captcha-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
}

.captcha-branding {
  display: flex;
  align-items: center;
  gap: 8px;
}

.branding-icon {
  font-size: 20px;
  color: #ea4335;
}

.branding-text {
  display: flex;
  flex-direction: column;
}

.branding-title {
  font-size: 12px;
  font-weight: 700;
  color: #555;
  letter-spacing: 0.3px;
}

.branding-sub {
  font-size: 9px;
  color: #999;
}

.btn-verify {
  padding: 8px 24px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.2s;
}

.btn-verify:hover {
  background: #3a7bc8;
}

.btn-verify:active {
  background: #2d6ab5;
}

/* Error overlay */
.captcha-error-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 16px 24px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10;
  max-width: 280px;
}

.captcha-error-overlay.visible {
  opacity: 1;
}

/* ============================================
   Screen 3: Verification Complete
   ============================================ */
#screen-verified {
  background: #fff;
}

.verified-content {
  text-align: center;
}

/* Checkmark animation */
.checkmark-circle {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
}

.checkmark-svg {
  width: 80px;
  height: 80px;
}

.checkmark-circle-bg {
  stroke: #34a853;
  stroke-width: 2;
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
}

.checkmark-check {
  stroke: #34a853;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
}

.verified-title {
  font-size: 24px;
  font-weight: 400;
  color: #202124;
  margin-bottom: 8px;
  opacity: 0;
}

.verified-subtitle {
  font-size: 16px;
  color: #5f6368;
  opacity: 0;
}

/* Only animate when screen is active */
#screen-verified.active .checkmark-circle-bg {
  animation: circle-draw 0.6s ease forwards;
}

#screen-verified.active .checkmark-check {
  animation: check-draw 0.4s 0.5s ease forwards;
}

#screen-verified.active .verified-title {
  animation: fadeInUp 0.5s 0.7s ease forwards;
}

#screen-verified.active .verified-subtitle {
  animation: fadeInUp 0.5s 0.9s ease forwards;
}

/* ============================================
   Screen 4: The Reveal
   ============================================ */
#screen-reveal {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.reveal-content {
  text-align: center;
  max-width: 500px;
  width: 100%;
  padding: 40px 20px;
}

.reveal-message {
  margin-bottom: 32px;
}

.reveal-turkish {
  font-family: 'Caveat', cursive;
  font-size: 32px;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 24px;
  opacity: 0;
}

.reveal-english {
  font-family: 'Caveat', cursive;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
  opacity: 0;
}

.reveal-signature {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  color: #fff;
  opacity: 0;
}

.btn-continue {
  display: inline-block;
  margin-top: 40px;
  padding: 14px 40px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 30px;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s;
  opacity: 0;
}

/* Only animate when screen is active */
#screen-reveal.active .reveal-turkish {
  animation: heartbeat-in 1s 0.5s ease forwards;
}

#screen-reveal.active .reveal-english {
  animation: fadeInUp 0.8s 1.5s ease forwards;
}

#screen-reveal.active .reveal-signature {
  animation: fadeInUp 0.8s 2.3s ease forwards;
}

#screen-reveal.active .btn-continue {
  animation: fadeInUp 0.8s 3s ease forwards;
}

.btn-continue:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: #fff;
}

/* ============================================
   Screen 5: Acceptance
   ============================================ */
#screen-acceptance {
  background: #f9f9f9;
}

.valentine-ask {
  font-family: 'Caveat', cursive;
  font-size: 36px;
  color: #ea4335;
  margin-bottom: 24px;
}

.acceptance-content {
  text-align: center;
  max-width: 450px;
  width: 100%;
  padding: 20px;
}

.valentine-checkbox {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 2px solid #d3d3d3;
  border-radius: 3px;
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color 0.3s, box-shadow 0.3s;
  margin-bottom: 32px;
  user-select: none;
}

.valentine-checkbox:hover {
  border-color: #b0b0b0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.checkbox-box {
  width: 28px;
  height: 28px;
  border: 2px solid #c1c1c1;
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, background 0.3s;
}

.checkbox-heart {
  color: #ea4335;
  font-size: 18px;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.3s, transform 0.3s ease;
}

.valentine-checkbox.checked .checkbox-box {
  border-color: #ea4335;
  background: #fce8e6;
}

.valentine-checkbox.checked .checkbox-heart {
  opacity: 1;
  transform: scale(1);
}

.checkbox-label {
  font-size: 15px;
  color: #202124;
  cursor: pointer;
}

/* Receipt */
.receipt-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.receipt-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.receipt-header {
  background: linear-gradient(135deg, #ea4335, #e91e63);
  color: #fff;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.receipt-icon {
  font-size: 24px;
}

.receipt-header h3 {
  font-size: 20px;
  font-weight: 500;
}

.receipt-body {
  padding: 20px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.receipt-row:last-child {
  border-bottom: none;
}

.receipt-label {
  font-size: 14px;
  color: #5f6368;
}

.receipt-value {
  font-size: 14px;
  font-weight: 500;
  color: #202124;
}

.receipt-status {
  color: #ea4335;
}

.receipt-footer {
  padding: 16px 20px;
  background: #fafafa;
  text-align: center;
  border-top: 1px dashed #e0e0e0;
}

.receipt-footer p {
  font-size: 14px;
  color: #5f6368;
}

/* ============================================
   Animations
   ============================================ */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

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

@keyframes heartbeat-in {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1.05);
  }
  50% {
    transform: scale(0.95);
  }
  70% {
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes circle-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes check-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 480px) {
  .security-card {
    padding: 32px 24px 28px;
  }

  .security-title {
    font-size: 20px;
  }

  .captcha-prompt {
    font-size: 14px;
  }

  .reveal-turkish {
    font-size: 26px;
  }

  .reveal-english {
    font-size: 20px;
  }

  .reveal-signature {
    font-size: 24px;
  }

  .valentine-checkbox {
    padding: 14px 16px;
  }
}
