/* ============================================
   Send The Love 💌 — Styles
   ============================================ */

:root {
  --bg-deep: #1a0a2e;
  --bg-mid: #2d1b4e;
  --bg-rose: #3a1538;
  --accent-pink: #ff6b9d;
  --accent-rose: #c44569;
  --accent-hot: #ff4081;
  --accent-gold: #ffd700;
  --text-primary: #fff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 107, 157, 0.2);
  --input-bg: rgba(255, 255, 255, 0.08);
  --input-border: rgba(255, 255, 255, 0.15);
  --input-focus: rgba(255, 107, 157, 0.5);
  --glow-pink: rgba(255, 107, 157, 0.4);
  --glow-rose: rgba(196, 69, 105, 0.3);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

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

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

body {
  font-family: var(--font-body);
  background: linear-gradient(145deg, var(--bg-deep) 0%, var(--bg-mid) 40%, var(--bg-rose) 100%);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.floating-heart {
  position: absolute;
  bottom: -40px;
  opacity: 0;
  font-size: 20px;
  animation: floatUp linear forwards;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(0) rotate(0deg) scale(0.5);
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
    transform: translateY(-100vh) rotate(360deg) scale(1);
  }
}

/* ============================================
   App Container
   ============================================ */
#app {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: 424px;
  margin: 0 auto;
  overflow: hidden;
}

/* ============================================
   Screen System
   ============================================ */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(30px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.screen.exit-left {
  opacity: 0;
  transform: translateX(-30px);
}

.screen-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  padding-bottom: 40px;
}

/* ============================================
   Screen Header
   ============================================ */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.btn-back {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.1);
}

.screen-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  flex: 1;
}

.step-indicator {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--card-bg);
  padding: 4px 10px;
  border-radius: 12px;
  flex-shrink: 0;
}

/* ============================================
   Landing Screen
   ============================================ */
.landing-content {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.landing-icon {
  font-size: 72px;
  animation: pulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 30px var(--glow-pink));
}

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

.landing-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 8px;
}

.landing-title .accent {
  color: var(--accent-pink);
  font-style: italic;
}

.landing-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 320px;
  margin: 0 auto;
}

.token-highlight {
  color: var(--accent-pink);
  font-weight: 600;
}

.landing-stats {
  display: flex;
  gap: 32px;
  margin-top: 16px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent-pink);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 28px;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
  width: 100%;
  margin-top: auto;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-rose));
  color: white;
  box-shadow: 0 4px 20px var(--glow-rose);
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--glow-pink);
}

.btn-primary:not(:disabled):active {
  transform: translateY(0);
}

.btn-glow {
  animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {
  0%, 100% { box-shadow: 0 4px 20px var(--glow-rose); }
  50% { box-shadow: 0 4px 35px var(--glow-pink), 0 0 60px rgba(255, 107, 157, 0.15); }
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-icon {
  font-size: 18px;
}

.btn-send {
  margin-top: 20px;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

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

.form-input:focus,
.form-textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.15);
}

.form-textarea {
  resize: none;
  line-height: 1.6;
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.char-min {
  color: var(--accent-pink);
  font-weight: 500;
}

/* ============================================
   Amount Screen
   ============================================ */
.amount-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: center;
}

.amount-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.preset-btn {
  padding: 12px 8px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: rgba(255, 107, 157, 0.15);
  border-color: var(--accent-pink);
}

.preset-btn.active {
  background: linear-gradient(135deg, rgba(255, 107, 157, 0.25), rgba(196, 69, 105, 0.25));
  border-color: var(--accent-pink);
  box-shadow: 0 0 15px rgba(255, 107, 157, 0.15);
}

.custom-amount-wrapper {
  margin-bottom: 20px;
}

.custom-amount-wrapper.hidden {
  display: none;
}

.amount-display {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}

.amount-tokens-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-pink);
  display: block;
  word-break: break-all;
}

.amount-tokens-label {
  font-size: 13px;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

.amount-usd {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.buy-love-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 215, 0, 0.1);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.buy-love-info a {
  color: var(--accent-pink);
  text-decoration: none;
  font-weight: 500;
}

.buy-love-info a:hover {
  text-decoration: underline;
}

.burn-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.burn-icon {
  font-size: 16px;
}

/* ============================================
   Letter Card (Preview)
   ============================================ */
.letter-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  padding: 2px;
  margin-bottom: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3), 0 0 60px rgba(255, 107, 157, 0.08);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.letter-card-inner {
  background: linear-gradient(170deg, rgba(45, 27, 78, 0.9), rgba(58, 21, 56, 0.9));
  border-radius: calc(var(--radius-xl) - 2px);
  padding: 28px 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.letter-to {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.letter-to span {
  color: var(--accent-pink);
  font-style: italic;
}

.letter-body {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  flex: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.letter-from {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  color: var(--text-secondary);
}

.letter-from-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  color: var(--accent-pink);
  margin-top: 4px;
}

.letter-burn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   Sending Screen
   ============================================ */
.sending-content {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.sending-animation {
  position: relative;
  font-size: 64px;
  margin-bottom: 24px;
}

.sending-heart {
  animation: sendPulse 1.5s ease-in-out infinite;
}

.sending-flames {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 32px;
  animation: flicker 0.5s ease-in-out infinite alternate;
}

@keyframes sendPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  75% { transform: scale(0.95) rotate(5deg); }
}

@keyframes flicker {
  from { opacity: 0.6; transform: translateX(-50%) scale(1); }
  to { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.sending-title {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 8px;
}

.sending-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ============================================
   Success Screen
   ============================================ */
.success-content {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.success-icon {
  font-size: 64px;
  animation: celebratePulse 1s ease-in-out;
}

@keyframes celebratePulse {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

.success-title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--accent-pink);
}

.success-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.success-details {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  width: 100%;
  margin: 8px 0;
}

.success-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.success-detail + .success-detail {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-label {
  font-size: 13px;
  color: var(--text-muted);
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
}

.detail-link {
  color: var(--accent-pink);
  text-decoration: none;
}

.detail-link:hover {
  text-decoration: underline;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.success-actions .btn {
  margin-top: 0;
}

/* ============================================
   Error Screen
   ============================================ */
.error-content {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.error-icon {
  font-size: 56px;
}

.error-title {
  font-family: var(--font-display);
  font-size: 24px;
}

.error-message {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 300px;
}

.error-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.error-actions .btn {
  margin-top: 0;
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* ============================================
   Scrollbar
   ============================================ */
.screen::-webkit-scrollbar {
  width: 4px;
}

.screen::-webkit-scrollbar-track {
  background: transparent;
}

.screen::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-height: 650px) {
  .landing-icon { font-size: 56px; }
  .landing-title { font-size: 28px; }
  .landing-stats { margin-top: 12px; padding-top: 12px; }
  .btn { padding: 14px 24px; }
}

/* ============================================
   User Search
   ============================================ */
.user-search-wrapper {
  position: relative;
}

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.user-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(26, 10, 46, 0.95);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 4px;
}

.user-search-results.hidden {
  display: none;
}

.user-search-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-search-item:last-child {
  border-bottom: none;
}

.user-search-item:hover {
  background: rgba(255, 107, 157, 0.1);
}

.user-search-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-search-info {
  flex: 1;
}

.user-search-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.3;
}

.user-search-username {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
}

.selected-user {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 107, 157, 0.1);
  border: 1px solid var(--accent-pink);
  border-radius: var(--radius-md);
  margin-top: 8px;
}

.selected-user.hidden {
  display: none;
}

.selected-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.selected-user-info {
  flex: 1;
}

.selected-user-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.3;
}

.selected-user-username {
  color: var(--accent-pink);
  font-size: 13px;
  line-height: 1.3;
}

.selected-user-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.selected-user-remove:hover {
  background: rgba(255, 107, 157, 0.2);
  color: var(--accent-pink);
}

/* Love Balance & Buy Section */
.love-balance {
  background: rgba(255, 107, 157, 0.1);
  border: 1px solid rgba(255, 107, 157, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
}

.balance-check {
  font-size: 14px;
  color: var(--text-secondary);
}

.balance-amount {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-pink);
  margin-top: 4px;
}

.balance-low {
  color: #ff9500;
}

.balance-none {
  color: #ff3b30;
}

.send-help {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

.buy-love-section {
  margin-top: 20px;
}

.buy-love-card {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.buy-love-card h3 {
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 16px;
}

.buy-love-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--accent-pink);
  color: var(--accent-pink);
  padding: 12px 24px;
  text-decoration: none;
  display: inline-block;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--accent-pink);
  color: var(--bg-deep);
}

@media (min-width: 425px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
  }

  #app {
    height: 695px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
  }

  .hearts-bg {
    border-radius: 16px;
  }
}
