/* Tip page styles — minimal. Dark values mirror campaign.css's dark theme;
   data-theme is stamped by the theme controller. */
:root {
  --tip-bg: #f8f7f5;
  --tip-card: #ffffff;
  --tip-elevated: #f9fafb;
  --tip-border: #e5e3df;
  --tip-text-primary: #1a1a1e;
  --tip-text-secondary: #5c5c62;
  --tip-text-muted: #8c8c92;
  --tip-coral: #e85a4b;
  --tip-coral-hover: #d94a3b;
  --tip-green: #16a34a;
  --tip-green-bg: #f0fdf4;
  --tip-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --tip-bg: #12191c;
  --tip-card: #192226;
  --tip-elevated: #1f282c;
  --tip-border: #2a3a3f;
  --tip-text-primary: #fafafa;
  --tip-text-secondary: #c8cdd0;
  --tip-text-muted: #9ca3a7;
  --tip-coral: #ff6b5b;
  --tip-coral-hover: #ff5a47;
  --tip-green: #4ade94;
  --tip-green-bg: rgba(74, 222, 148, 0.12);
  --tip-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.tip-page {
  margin: 0;
  padding: 0;
  font-family: 'Instrument Sans', -apple-system, sans-serif;
  background: var(--tip-bg);
  color: var(--tip-text-primary);
  line-height: 1.6;
  min-height: 100vh;
  box-sizing: border-box;
}

/* Preview mode — embedded in creator settings sidebar */
.tip-page.tip-preview {
  min-height: 0;
  background: transparent;
}

.tip-page *,
.tip-page *::before,
.tip-page *::after {
  box-sizing: border-box;
}

/* Generic hidden utility — tip layout doesn't load Tailwind */
.tip-page .hidden {
  display: none;
}

.tip-page .page-wrapper {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.tip-page .top-bar {
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--tip-border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tip-page .powered-by {
  font-size: 12px;
  color: var(--tip-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tip-page .powered-by span {
  color: var(--tip-text-secondary);
  font-weight: 600;
}

/* Main content */
.tip-page .main-content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 48px;
}

.tip-page .tip-container {
  width: 100%;
  max-width: 480px;
  animation: tip-fadeInUp 0.5s ease-out;
}

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

/* Creator branding (shared across tip/link/giveaway pages) */
.tip-page .creator-branding {
  text-align: center;
  margin-bottom: 24px;
}

.tip-page .creator-branding-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
}

.tip-page .creator-branding-avatar-fallback {
  background: var(--tip-coral);
  color: white;
  font-size: 38px;
  font-weight: 700;
}

.tip-page .creator-branding-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 2px;
}

.tip-page .creator-branding-handle {
  font-size: 14px;
  color: var(--tip-text-muted);
}

/* Tip card */
.tip-page .tip-card {
  background: var(--tip-card);
  border: 1px solid var(--tip-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--tip-shadow);
}

.tip-page .tip-card-body {
  padding: 24px;
}

/* Creator message */
.tip-page .creator-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--tip-elevated);
  border-radius: 12px;
  border: 1px solid var(--tip-border);
}

.tip-page .heart-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--tip-coral);
  animation: tip-heartbeat 2s ease-in-out infinite;
}

@keyframes tip-heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
  60% { transform: scale(1); }
}

.tip-page .creator-message p {
  font-size: 14px;
  color: var(--tip-text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Amount buttons */
.tip-page .amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.tip-page .amount-btn {
  padding: 14px 8px;
  border: 2px solid var(--tip-border);
  border-radius: 12px;
  background: white;
  font-size: 16px;
  font-weight: 600;
  color: var(--tip-text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  text-align: center;
}

.tip-page .amount-btn:hover {
  border-color: var(--tip-coral);
  color: var(--tip-coral);
  background: rgba(232, 90, 75, 0.04);
}

.tip-page .amount-btn.selected {
  border-color: var(--tip-coral);
  background: var(--tip-coral);
  color: white;
}

/* Custom amount */
.tip-page .custom-amount-wrapper {
  display: flex;
  align-items: center;
  border: 2px solid var(--tip-border);
  border-radius: 12px;
  background: white;
  transition: border-color 0.15s ease;
}

.tip-page .custom-amount-wrapper:focus-within {
  border-color: var(--tip-coral);
}

.tip-page .custom-amount-prefix {
  padding-left: 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--tip-text-muted);
  line-height: 1;
  pointer-events: none;
  flex-shrink: 0;
}

.tip-page .custom-amount-input {
  width: 100%;
  padding: 14px 14px 14px 6px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--tip-text-primary);
  background: transparent;
  outline: none;
}

.tip-page .custom-amount-input::placeholder {
  color: var(--tip-text-muted);
  font-weight: 400;
}

.tip-page .amount-helper {
  font-size: 12px;
  color: var(--tip-text-muted);
  margin: 6px 0 20px;
}

/* Fan message */
.tip-page .fan-message-section {
  margin-bottom: 20px;
}

.tip-page .fan-message-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.tip-page .fan-message-label span {
  font-size: 13px;
  font-weight: 500;
  color: var(--tip-text-secondary);
}

.tip-page .fan-message-counter {
  font-size: 12px;
  color: var(--tip-text-muted);
}

.tip-page .fan-message-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--tip-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--tip-text-primary);
  background: white;
  outline: none;
  resize: none;
  transition: border-color 0.15s ease;
  min-height: 72px;
}

.tip-page .fan-message-input:focus {
  border-color: var(--tip-coral);
}

.tip-page .fan-message-input::placeholder {
  color: var(--tip-text-muted);
}

/* Fee breakdown */
.tip-page .fee-breakdown {
  background: var(--tip-elevated);
  border: 1px solid var(--tip-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.tip-page .fee-breakdown.hidden {
  display: block; /* override generic .hidden to allow animated show/hide */
  max-height: 0;
  opacity: 0;
  padding: 0 16px;
  margin-bottom: 0;
  border: none;
}

.tip-page .fee-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 4px 0;
}

.tip-page .fee-label {
  color: var(--tip-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tip-page .fee-value {
  color: var(--tip-text-primary);
  font-weight: 500;
}

.tip-page .fee-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--tip-green);
  background: var(--tip-green-bg);
  padding: 2px 8px;
  border-radius: 100px;
}

.tip-page .fee-badge svg {
  width: 12px;
  height: 12px;
}

.tip-page .fee-info-icon {
  width: 14px;
  height: 14px;
  color: var(--tip-text-muted);
  cursor: help;
}

.tip-page .fee-divider {
  height: 1px;
  background: var(--tip-border);
  margin: 8px 0;
}

.tip-page .fee-total .fee-label,
.tip-page .fee-total .fee-value {
  font-weight: 600;
  color: var(--tip-text-primary);
  font-size: 15px;
}

/* Cover-fee option (inside the calculator) */
.tip-page .cover-fee-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0 2px;
  cursor: pointer;
}

.tip-page .cover-fee-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: var(--tip-coral);
  cursor: pointer;
}

.tip-page .cover-fee-checkbox:disabled {
  cursor: default;
}

.tip-page .cover-fee-text {
  font-size: 14px;
  color: var(--tip-text-secondary);
  line-height: 1.4;
}

.tip-page .cover-fee-amount {
  color: var(--tip-text-muted);
  font-weight: 500;
  margin-left: 2px;
}

/* Anonymous option (inside the checkout form) */
.tip-page .anonymous-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  cursor: pointer;
}

.tip-page .anonymous-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: var(--tip-coral);
  cursor: pointer;
}

.tip-page .anonymous-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--tip-text-secondary);
  line-height: 1.4;
}

.tip-page .anonymous-hint {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--tip-text-muted);
  margin-top: 1px;
}

/* Pay button */
.tip-page .pay-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: var(--tip-coral);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.tip-page .pay-button:hover:not(:disabled) {
  background: var(--tip-coral-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232, 90, 75, 0.3);
}

.tip-page .pay-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tip-page .pay-button:not(:disabled) {
  background: linear-gradient(
    90deg,
    var(--tip-coral) 0%,
    var(--tip-coral) 40%,
    #ff8a7d 50%,
    var(--tip-coral) 60%,
    var(--tip-coral) 100%
  );
  background-size: 200% auto;
  animation: tip-shimmer 3s linear infinite;
}

@keyframes tip-shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.tip-page .pay-button svg {
  width: 16px;
  height: 16px;
}

/* Trust indicators */
.tip-page .trust-indicators {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--tip-text-muted);
}

.tip-page .trust-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tip-page .trust-item svg {
  width: 14px;
  height: 14px;
}

/* Footer */
.tip-page .page-footer {
  margin-top: auto;
  padding: 20px 24px;
  text-align: center;
  border-top: 1px solid var(--tip-border);
  font-size: 12px;
  color: var(--tip-text-muted);
}

.tip-page .page-footer a {
  color: var(--tip-text-secondary);
  text-decoration: none;
}

.tip-page .page-footer a:hover {
  text-decoration: underline;
}

.tip-page .page-footer-brand {
  margin-bottom: 4px;
}

.tip-page .page-footer-brand a {
  font-weight: 600;
}

/* Flash messages */
.tip-page .tip-flash {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  max-width: 320px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: tip-slideIn 0.3s ease-out;
}

.tip-page .tip-flash.alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

@keyframes tip-slideIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==========================================================================
   CONFIRMATION PAGE STYLES
   ========================================================================== */

/* Confirmed badge (header) */
.tip-page .confirmed-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--tip-green);
  font-weight: 600;
}

.tip-page .confirmed-badge svg {
  width: 16px;
  height: 16px;
}

/* Success hero */
.tip-page .success-hero {
  position: relative;
  background: linear-gradient(135deg, #fff1f0 0%, #fff7ed 50%, #fffbeb 100%);
  padding: 40px 24px;
  text-align: center;
  border-bottom: 1px solid #fed7aa;
  overflow: hidden;
}

.tip-page .success-hero-inner {
  position: relative;
  z-index: 1;
}

.tip-page .heart-circle {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--tip-coral) 0%, #f97316 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(232, 90, 75, 0.3);
  animation: tip-heartPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.tip-page .heart-circle svg {
  width: 40px;
  height: 40px;
  color: white;
}

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

.tip-page .success-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--tip-text-primary);
}

.tip-page .success-subtitle {
  font-size: 15px;
  color: var(--tip-text-secondary);
  margin: 0;
}

.tip-page .success-subtitle strong {
  color: var(--tip-text-primary);
}

/* Floating hearts */
@keyframes tip-floatUp {
  0% { transform: translateY(0) scale(1); opacity: 0.5; }
  100% { transform: translateY(-60px) scale(0.5); opacity: 0; }
}

.tip-page .float-heart {
  animation: tip-floatUp 2s ease-out forwards;
  position: absolute;
  pointer-events: none;
  color: rgba(232, 90, 75, 0.25);
  font-size: 20px;
  z-index: 0;
}

/* Fade-in animations */
@keyframes tip-fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tip-page .fade-in-1 { animation: tip-fadeIn 0.4s ease-out 0.3s forwards; opacity: 0; }
.tip-page .fade-in-2 { animation: tip-fadeIn 0.4s ease-out 0.5s forwards; opacity: 0; }
.tip-page .fade-in-3 { animation: tip-fadeIn 0.4s ease-out 0.7s forwards; opacity: 0; }

/* Receipt */
.tip-page .receipt-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--tip-border);
}

.tip-page .receipt-heading {
  font-size: 11px;
  font-weight: 600;
  color: var(--tip-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
}

.tip-page .receipt-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.tip-page .receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tip-page .receipt-label {
  color: var(--tip-text-secondary);
}

.tip-page .receipt-value-bold {
  font-weight: 600;
  color: var(--tip-text-primary);
}

.tip-page .receipt-total {
  padding-top: 10px;
  border-top: 1px solid var(--tip-border);
}

.tip-page .receipt-details {
  margin-top: 16px;
  padding: 12px;
  background: var(--tip-elevated);
  border-radius: 8px;
  font-size: 12px;
  color: var(--tip-text-muted);
}

.tip-page .receipt-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.tip-page .receipt-detail-value {
  color: var(--tip-text-secondary);
}

.tip-page .receipt-note {
  font-size: 12px;
  color: var(--tip-text-muted);
  margin: 12px 0 0;
}

.tip-page .receipt-note a {
  text-decoration: underline;
  color: var(--tip-text-secondary);
}

.tip-page .receipt-note a:hover {
  color: var(--tip-text-primary);
}

/* Fan message display */
.tip-page .fan-message-display {
  padding: 16px 24px;
  border-bottom: 1px solid var(--tip-border);
}

.tip-page .fan-message-bubble {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--tip-bg);
  border-radius: 12px;
}

.tip-page .fan-message-emoji {
  font-size: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}

.tip-page .fan-message-text {
  font-size: 14px;
  color: var(--tip-text-primary);
  font-style: italic;
  margin: 0 0 4px;
  line-height: 1.5;
}

.tip-page .fan-message-caption {
  font-size: 12px;
  color: var(--tip-text-muted);
  margin: 0;
}

/* Creator thank-you */
.tip-page .creator-thank-you {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--tip-border);
}

.tip-page .thank-you-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--tip-coral) 0%, #f97316 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tip-page .thank-you-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tip-page .thank-you-avatar span {
  color: white;
  font-size: 16px;
  font-weight: 700;
}

.tip-page .thank-you-bubble {
  background: var(--tip-elevated);
  border-radius: 12px;
  border-top-left-radius: 4px;
  padding: 12px 16px;
  flex: 1;
}

.tip-page .thank-you-text {
  font-size: 14px;
  color: var(--tip-text-primary);
  line-height: 1.6;
  margin: 0 0 6px;
}

.tip-page .thank-you-attribution {
  font-size: 12px;
  color: var(--tip-text-muted);
  margin: 0;
}

/* Share section */
.tip-page .share-section {
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(232, 90, 75, 0.05) 0%, #fff7ed 100%);
  border-top: 1px solid rgba(232, 90, 75, 0.1);
}

.tip-page .share-prompt {
  font-size: 14px;
  color: var(--tip-text-secondary);
  text-align: center;
  margin: 0 0 12px;
}

.tip-page .share-buttons {
  display: flex;
  gap: 8px;
}

.tip-page .share-btn-copy {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--tip-elevated);
  color: var(--tip-text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  border: 1px solid var(--tip-border);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tip-page .share-btn-copy:hover {
  background: var(--tip-border);
}

.tip-page .share-btn-copy svg {
  width: 16px;
  height: 16px;
}

/* Back to channel */
.tip-page .back-to-channel {
  margin-top: 24px;
  text-align: center;
}

.tip-page .back-to-channel a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--tip-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.tip-page .back-to-channel a:hover {
  color: var(--tip-text-primary);
}

.tip-page .back-to-channel svg {
  width: 20px;
  height: 20px;
  color: #ef4444;
}

/* Responsive */
@media (max-width: 500px) {
  .tip-page .main-content {
    padding: 24px 12px 40px;
  }

  .tip-page .tip-card-body {
    padding: 20px 16px;
  }

  .tip-page .amount-grid {
    gap: 8px;
  }

  .tip-page .amount-btn {
    padding: 12px 4px;
    font-size: 15px;
  }

  .tip-page .success-hero {
    padding: 32px 20px;
  }

  .tip-page .success-title {
    font-size: 22px;
  }

  .tip-page .receipt-section,
  .tip-page .fan-message-display,
  .tip-page .creator-thank-you,
  .tip-page .share-section {
    padding-left: 20px;
    padding-right: 20px;
  }

  .tip-page .share-buttons {
    flex-direction: column;
  }
}
