@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --primary: #87A878;
  --secondary: #A8C69F;
  --tertiary: #C4DEB5;
  --accent: #E8F0E3;
  --light: #4A5D4A;
  --bg: #FDF6F0;
  --white: #FFFFFF;
  --gray-50: #FAFAF9;
  --gray-100: #F5F5F4;
  --gray-200: #E7E5E4;
  --gray-300: #D6D3D1;
  --gray-400: #A8A29E;
  --gray-500: #78716C;
  --gray-600: #57534E;
  --gray-700: #44403C;
  --gray-800: #292524;
  --gray-900: #1C1917;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(191, 54, 12, 0.08);
  --shadow-lg: 0 8px 24px rgba(191, 54, 12, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

::selection {
  background: var(--accent);
  color: var(--white);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

.app-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  min-height: 100vh;
}

/* ======= HEADER ======= */
.app-header {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  animation: fadeIn 0.6s ease-out;
}

.header-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  animation: flicker 2s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.05); }
}

.app-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.app-subtitle {
  font-size: 0.95rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
  font-weight: 300;
}

/* ======= MAIN ======= */
.app-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ======= PROGRESS BAR ======= */
.progress-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
  animation: slideUp 0.5s ease-out;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.progress-raised {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.progress-goal {
  font-size: 0.85rem;
  color: var(--gray-500);
  font-weight: 400;
}

.progress-track {
  width: 100%;
  height: 28px;
  background: var(--light);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--tertiary), var(--accent));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  min-width: 0;
  position: relative;
}

.progress-percent {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--white);
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.progress-percent-outside {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
}

.goal-reached {
  text-align: center;
  margin-top: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  font-size: 1rem;
  animation: bounceIn 0.6s ease-out;
}

.goal-reached-icon {
  font-size: 1.2rem;
}

/* ======= STATS ======= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: slideUp 0.5s ease-out both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gray-800);
  font-family: 'Playfair Display', serif;
}

/* ======= DONATE BUTTON ======= */
.donate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 87, 34, 0.3);
  transition: all 0.2s ease;
  animation: slideUp 0.5s ease-out 0.25s both;
}

.donate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 87, 34, 0.4);
}

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

.donate-btn-icon {
  font-size: 1.3rem;
  font-weight: 300;
}

/* ======= MODAL ======= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 0.3s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-800);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

/* ======= FORM ======= */
.donation-form {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}

.optional-tag {
  font-weight: 400;
  color: var(--gray-400);
  font-size: 0.8rem;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--gray-400);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.preset-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-btn {
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--gray-700);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  border-color: var(--tertiary);
  color: var(--tertiary);
}

.preset-active {
  background: var(--light);
  border-color: var(--accent);
  color: var(--primary);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.btn-primary,
.btn-secondary {
  flex: 1;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  color: var(--white);
  border: none;
  box-shadow: 0 2px 8px rgba(255, 87, 34, 0.25);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.35);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--white);
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
}

.btn-secondary:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

/* ======= DONOR WALL ======= */
.donor-wall-section {
  animation: slideUp 0.5s ease-out 0.3s both;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 1rem;
}

.section-title-icon {
  font-size: 1.1rem;
}

.donor-count {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--light);
  color: var(--primary);
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
}

.donor-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.donor-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  border-left: 3px solid var(--tertiary);
  transition: all 0.2s ease;
  animation: cardFadeIn 0.4s ease-out both;
}

.donor-card:nth-child(1) { animation-delay: 0s; }
.donor-card:nth-child(2) { animation-delay: 0.05s; }
.donor-card:nth-child(3) { animation-delay: 0.1s; }
.donor-card:nth-child(4) { animation-delay: 0.15s; }
.donor-card:nth-child(5) { animation-delay: 0.2s; }
.donor-card:nth-child(6) { animation-delay: 0.25s; }
.donor-card:nth-child(7) { animation-delay: 0.3s; }
.donor-card:nth-child(8) { animation-delay: 0.35s; }
.donor-card:nth-child(9) { animation-delay: 0.4s; }
.donor-card:nth-child(10) { animation-delay: 0.45s; }

.donor-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.donor-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.donor-info {
  flex: 1;
  min-width: 0;
}

.donor-top-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.donor-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 0.95rem;
}

.donor-amount {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
  font-family: 'Playfair Display', serif;
  white-space: nowrap;
}

.donor-message {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-top: 0.3rem;
  font-style: italic;
  line-height: 1.5;
}

.donor-date {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
  display: block;
}

/* ======= EMPTY STATE ======= */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--gray-200);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.empty-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-600);
}

.empty-subtext {
  font-size: 0.85rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

/* ======= FOOTER ======= */
.app-footer {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  color: var(--gray-400);
  font-size: 0.85rem;
}

/* ======= SKELETONS ======= */
.progress-skeleton {
  padding: 1.5rem 0;
}

.skeleton-bar {
  width: 100%;
  height: 28px;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  border-radius: 14px;
  animation: shimmer 1.5s ease-in-out infinite;
}

.stat-skeleton {
  min-height: 72px;
}

.donor-skeleton {
  min-height: 64px;
  align-items: center;
}

.skeleton-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skeleton-text-sm {
  width: 40%;
  height: 12px;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-text-lg {
  width: 70%;
  height: 18px;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ======= ANIMATIONS ======= */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.8); }
  60% { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

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

/* ======= RESPONSIVE ======= */
@media (max-width: 480px) {
  .app-title {
    font-size: 1.6rem;
  }

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

  .stat-card {
    padding: 0.75rem 1rem;
  }

  .stat-value {
    font-size: 1.15rem;
  }

  .preset-amounts {
    gap: 0.4rem;
  }

  .preset-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .donor-card {
    padding: 0.85rem 1rem;
  }

  .progress-raised {
    font-size: 1.1rem;
  }
}

@media (min-width: 640px) {
  .app-container {
    padding: 0 2rem 3rem;
  }

  .app-header {
    padding: 3rem 1rem 2.5rem;
  }

  .app-title {
    font-size: 2.4rem;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to your Donation Tracker! This is where you'll track fundraising contributions and watch your progress toward the goal.", "view": "default", "highlight_selector": ".app-header", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "The progress bar shows how close you are to the $10,000 fundraising goal. It updates automatically as donations are added.", "view": "default", "highlight_selector": ".progress-section", "wait_for": "tap_to_continue"},
  {"step": 3, "narration": "Quick stats show total raised, number of donors, remaining amount, and average donation at a glance.", "view": "default", "highlight_selector": ".stats-grid", "wait_for": "tap_to_continue"},
  {"step": 4, "narration": "Tap 'Add Donation' to record a new contribution. Enter the donor's name, pick or type an amount, and optionally add a message.", "view": "default", "highlight_selector": ".donate-btn", "wait_for": "user_interaction"},
  {"step": 5, "narration": "The Donor Wall displays all contributions with names, amounts, messages, and timestamps — most recent first. Watch it grow!", "view": "default", "highlight_selector": ".donor-wall-section", "wait_for": "tap_to_continue"}
]
-->

.stat-card-wide {
  grid-column: span 2;
}

.stat-identity {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  line-height: 1.3;
}

@media (min-width: 640px) {
  .stat-card-wide {
    grid-column: span 2;
  }
}

.tab-nav {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.25rem;
}

.tab-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.tab-btn.active {
  background: rgba(255, 122, 0, 0.18);
  border-color: rgba(255, 122, 0, 0.45);
}

.tab-panel {
  width: 100%;
}

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

.chart-card {
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-header {
  margin-bottom: 0.75rem;
}

.chart-title {
  margin: 0;
}

.chart-subtitle {
  margin: 0.35rem 0 0;
  opacity: 0.75;
  font-size: 0.92rem;
}

.chart-loading,
.chart-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}

.campaign-share-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.campaign-share-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--gray-800);
  margin: 0;
}

.campaign-share-subtitle {
  margin-top: 0.25rem;
  color: var(--gray-500);
  font-size: 0.92rem;
}

.campaign-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.share-btn,
.share-option-btn,
.share-option-link {
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.share-btn {
  padding: 0.75rem 1rem;
}

.share-btn-primary {
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  color: var(--white);
}

.share-btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.share-btn:hover,
.share-option-btn:hover,
.share-option-link:hover {
  transform: translateY(-1px);
}

.share-options {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.share-option-btn,
.share-option-link {
  width: 100%;
  text-align: left;
  padding: 0.8rem 0.95rem;
  background: var(--white);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.share-option-link {
  display: block;
}

@media (min-width: 640px) {
  .campaign-share-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .campaign-share-copy {
    max-width: 60%;
  }

  .campaign-share-actions {
    justify-content: flex-end;
  }

  .share-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.donation-export-btn {
  white-space: nowrap;
}
