/* ============================================================
   CrowdFund dApp — emerald & amber "funding" theme
   Pure CSS, no framework. New motion language vs Project 01:
   rising coins, shimmer progress bars, live countdowns,
   staggered card entrances, spinning coin logo.
   ============================================================ */

:root {
  --bg: #0a100d;
  --bg-2: #0d1612;
  --card: rgba(16, 26, 21, 0.74);
  --card-border: rgba(148, 163, 184, 0.14);
  --text: #e7eee9;
  --muted: #93a49b;
  --accent-1: #10b981;  /* emerald */
  --accent-2: #f59e0b;  /* amber */
  --accent-grad: linear-gradient(135deg, #10b981 0%, #f59e0b 100%);
  --danger: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 16px;
  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", var(--font-ui);
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* aurora glow, slowly drifting */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(600px 420px at 12% 10%, rgba(16, 185, 129, 0.16), transparent 60%),
    radial-gradient(700px 520px at 88% 18%, rgba(245, 158, 11, 0.13), transparent 60%),
    radial-gradient(800px 600px at 50% 100%, rgba(16, 185, 129, 0.08), transparent 60%),
    var(--bg);
  animation: glowDrift 16s ease-in-out infinite alternate;
}
@keyframes glowDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-20px, 16px, 0) scale(1.05); }
}

/* rising coin particles */
.coins { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.coins i {
  position: absolute;
  bottom: -30px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  opacity: 0;
  animation: coinRise linear infinite;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}
@keyframes coinRise {
  0%   { transform: translateY(0) rotate(0deg) scale(0.7); opacity: 0; }
  12%  { opacity: 0.75; }
  85%  { opacity: 0.25; }
  100% { transform: translateY(-108vh) rotate(360deg) scale(1.1); opacity: 0; }
}

.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.accent { color: var(--accent-1); }

/* ===================== HEADER ===================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 16, 13, 0.74);
  border-bottom: 1px solid var(--card-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
  animation: coinSpin 6s ease-in-out infinite;
}
.brand-mark span { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #06251a; }
@keyframes coinSpin {
  0%, 78% { transform: rotateY(0deg); }
  88% { transform: rotateY(180deg); }
  100% { transform: rotateY(360deg); }
}

.brand h1 { font-family: var(--font-display); font-size: 19px; letter-spacing: 0.2px; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.chain-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--muted);
}
.chain-badge.ok { color: var(--success); border-color: rgba(16, 185, 129, 0.35); }

/* ===================== BUTTONS & FORMS ===================== */

.btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.2s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:not(:disabled):active { transform: translateY(0); }

.btn-primary { background: var(--accent-grad); color: #07130e; box-shadow: 0 6px 18px rgba(16, 185, 129, 0.28); }
.btn-accent { background: linear-gradient(135deg, #f59e0b, #f97316); box-shadow: 0 6px 18px rgba(245, 158, 11, 0.28); color: #1d0f02; }
.btn-ghost { background: rgba(148, 163, 184, 0.1); border: 1px solid var(--card-border); color: var(--text); }
.btn-ghost:hover { background: rgba(148, 163, 184, 0.18); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent-1);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-ui);
}
.link-btn:hover { text-decoration: underline; }

input, select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--text);
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12); }

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===================== BANNER / SETTINGS ===================== */

.banner { display: flex; gap: 16px; align-items: flex-start; margin-top: 22px; border-left: 3px solid var(--warning); }
.banner-icon { font-size: 26px; }
.banner h3 { font-family: var(--font-display); margin-bottom: 4px; }
.banner p { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.banner code, .settings-panel code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(148, 163, 184, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--accent-1);
}

.settings-panel { margin-top: 22px; }
.settings-panel h3 { font-family: var(--font-display); margin-bottom: 14px; }
.settings-panel .row { margin-top: 16px; }

/* ===================== CARDS / SECTIONS ===================== */

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.25s ease;
  animation: cardIn 0.5s ease both;
}
.card:hover { border-color: rgba(16, 185, 129, 0.32); transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.card-head h3 { font-family: var(--font-display); font-size: 16.5px; }
.card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent-1);
  font-size: 16px;
}
.card p { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.card form .btn { width: 100%; margin-top: 14px; }
.card .btn { margin-top: 10px; width: 100%; }

.section { margin-top: 46px; }
.section-title { font-family: var(--font-display); font-size: 20px; margin-bottom: 18px; }
.section-title .muted { font-size: 13px; font-weight: 400; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  vertical-align: middle;
}
.tag-admin { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }

/* ===================== HERO ===================== */

.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 28px;
  margin-top: 34px;
  align-items: center;
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }

.hero-text h2 { font-family: var(--font-display); font-size: 40px; letter-spacing: -0.5px; }
.hero-text h2 span { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-text p { font-size: 14.5px; margin-top: 10px; max-width: 52ch; }
.hero-links { margin-top: 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.hero-links a { color: var(--accent-1); text-decoration: none; }
.hero-links a:hover { text-decoration: underline; }
#hero-address { font-family: var(--font-mono); font-size: 12.5px; }

.stats-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.stat {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); }
.stat-value { font-family: var(--font-display); font-size: 21px; font-weight: 600; }

/* ===================== CREATE CAMPAIGN ===================== */

.create-card { border: 1px solid rgba(16, 185, 129, 0.28); }
.create-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: end; }
.create-row .btn { margin-top: 0; height: 42px; padding: 0 22px; }
.create-row label { margin: 0; }
@media (max-width: 760px) { .create-row { grid-template-columns: 1fr; } }

/* ===================== CAMPAIGN CARDS ===================== */

.campaign { display: flex; flex-direction: column; gap: 10px; }
.campaign-top { display: flex; justify-content: space-between; align-items: center; }
.campaign h3 { font-family: var(--font-display); font-size: 17px; }
.campaign .meta { font-size: 12.5px; color: var(--muted); }
.campaign .meta .mono { font-family: var(--font-mono); font-size: 12px; }

.status-pill {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
}
.status-Active { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
.status-Active .dot { animation: pulse 1.4s ease-in-out infinite; }
.status-Successful { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.status-Failed { background: rgba(244, 63, 94, 0.14); color: #fda4af; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 5px; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* progress bar with shimmer */
.progress { position: relative; height: 12px; border-radius: 999px; background: rgba(148, 163, 184, 0.12); overflow: hidden; }
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-grad);
  width: 0%;
  transition: width 1s cubic-bezier(0.25, 1, 0.35, 1);
  position: relative;
}
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.45) 50%, transparent 80%);
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

.campaign-numbers { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.campaign-countdown { font-family: var(--font-mono); font-size: 12px; color: var(--warning); }
.campaign-countdown.ended { color: var(--muted); }
.my-pledge { font-size: 12.5px; color: var(--accent-1); font-family: var(--font-mono); }

.campaign-actions { display: flex; gap: 8px; align-items: center; }
.campaign-actions input { flex: 1; }
.campaign-actions .btn { width: auto; margin: 0; white-space: nowrap; padding: 10px 14px; }
.creator-row { font-size: 12px; }

/* ===================== ACTIVITY TABLE ===================== */

.table-card { padding: 8px 20px 20px; overflow-x: auto; }
.activity-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.activity-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  padding: 14px 12px;
  border-bottom: 1px solid var(--card-border);
}
.activity-table td { padding: 12px; border-bottom: 1px solid rgba(148, 163, 184, 0.07); }
.activity-table tr:last-child td { border-bottom: none; }
.activity-table .mono { font-family: var(--font-mono); font-size: 12px; }
.activity-table a { color: var(--accent-1); text-decoration: none; }
.activity-table a:hover { text-decoration: underline; }

.ev-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
}
.ev-CampaignCreated { background: rgba(124, 58, 237, 0.16); color: #c4b5fd; }
.ev-Pledged { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
.ev-Claimed { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.ev-Refunded { background: rgba(6, 182, 212, 0.16); color: #67e8f9; }
.ev-FeeCredited, .ev-FeesWithdrawn { background: rgba(245, 158, 11, 0.14); color: #fcd34d; }

/* ===================== FOOTER ===================== */

.site-footer { margin-top: 60px; border-top: 1px solid var(--card-border); background: rgba(10, 16, 13, 0.6); }
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 22px 20px;
  font-size: 12.5px;
  color: var(--muted);
}
.footer-inner a { color: var(--accent-1); text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }
#footer-address { font-family: var(--font-mono); }

/* ===================== TOASTS ===================== */

.toast-container {
  position: fixed;
  top: 84px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  background: rgba(16, 26, 21, 0.96);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent-1);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  word-break: break-word;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent-1); }
.toast a { color: #6ee7b7; }
.toast.out { opacity: 0; transform: translateX(12px); transition: all 0.25s ease; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ===================== MISC ===================== */

[hidden] { display: none !important; }

.spin {
  display: inline-block;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

::selection { background: rgba(16, 185, 129, 0.4); }
