/* ====== Relay4AI Design System v3 — "Code Canvas" ====== */
:root {
  --accent: #00d4ff;
  --accent2: #00ff41;
  --accent-dim: rgba(0, 212, 255, 0.08);
  --accent-glow: rgba(0, 212, 255, 0.15);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.08);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.08);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.08);

  --bg: #090d14;
  --surface: #0f131c;
  --surface2: #151a24;
  --border: #1b2332;
  --border-light: #263040;

  --text: #e4e8ee;
  --text-dim: #8894a6;
  --text-muted: #5a6577;

  --font-body: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', 'Fira Code', monospace;

  --radius: 8px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: 0 0;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

/* Subtle top glow */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 300px;
  background: radial-gradient(ellipse at 50% 0%, rgba(0, 212, 255, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ====== Page load animation ====== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.main-content > * {
  animation: fadeInUp 0.4s ease both;
}
.main-content > *:nth-child(1) { animation-delay: 0s; }
.main-content > *:nth-child(2) { animation-delay: 0.06s; }
.main-content > *:nth-child(3) { animation-delay: 0.12s; }
.main-content > *:nth-child(4) { animation-delay: 0.18s; }
.main-content > *:nth-child(5) { animation-delay: 0.24s; }

/* ====== Sidebar ====== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 220px;
  background: rgba(15, 19, 28, 0.85);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.sidebar-logo:hover { color: var(--accent); text-decoration: none; }
.sidebar-logo span { color: var(--accent2); }
.sidebar-cursor { display: none; }
.sidebar-prompt { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar-section-label {
  padding: 0.75rem 0.75rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  transition: all var(--transition);
}
.sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.6; }
.sidebar-item:hover {
  background: var(--accent-dim);
  color: var(--accent);
  text-decoration: none;
}
.sidebar-item:hover svg { opacity: 1; }
.sidebar-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}
.sidebar-item.active svg { opacity: 1; }
.sidebar-item-cta {
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(0,255,65,0.1));
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: var(--accent);
  font-weight: 600;
  margin-top: 0.5rem;
}
.sidebar-item-cta:hover {
  background: linear-gradient(135deg, rgba(0,212,255,0.22), rgba(0,255,65,0.15));
  border-color: rgba(0, 212, 255, 0.4);
  color: var(--accent);
}
.sidebar-item-subtle {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.sidebar-item-subtle:hover { color: var(--text-dim); }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  background: none;
  border: 1px solid var(--border);
  width: 100%;
  font-family: var(--font-body);
}
.lang-switch svg { width: 14px; height: 14px; flex-shrink: 0; }
.lang-switch:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

.sidebar-user {
  text-align: center;
  padding: 0.25rem 0 0.5rem;
}
.sidebar-user-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
}
.sidebar-logout {
  display: block;
  text-align: center;
  padding: 0.35rem;
  margin-top: 0.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
}
.sidebar-logout:hover {
  color: var(--red);
  background: var(--red-dim);
  text-decoration: none;
}

/* ====== Main Layout ====== */
.main-wrapper {
  margin-left: 220px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}
.main-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
}

.site-footer {
  text-align: center;
  padding: 1.5rem 2rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  border-top: 1px solid var(--border);
  letter-spacing: 0.01em;
}
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }

/* ====== Stats Grid ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.bonus-balance {
  font-size: 0.8rem;
  color: var(--green);
  font-weight: 500;
  margin-top: 0.15rem;
}
.stat-card small {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ====== Plan Status ====== */
.plan-status {
  background: linear-gradient(135deg, rgba(0,212,255,0.05) 0%, rgba(0,255,65,0.03) 100%);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.plan-status .badge {
  background: var(--accent);
  color: var(--bg);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ====== Announcement Banner ====== */
.announcement-banner {
  background: var(--amber-dim);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}
.announcement-banner strong { color: var(--amber); }

/* ====== Tables ====== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
thead th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(27, 35, 50, 0.6);
  color: var(--text-dim);
}
tbody tr {
  transition: background var(--transition);
}
tbody tr:hover { background: rgba(255, 255, 255, 0.015); }
td code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(0,0,0,0.2);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ====== Forms ====== */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-dim);
}
input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 12px rgba(0, 212, 255, 0.06);
}
input::placeholder { color: var(--text-muted); }
select { cursor: pointer; }
textarea { resize: vertical; min-height: 80px; }

/* ====== Buttons ====== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.86rem;
  font-weight: 600;
  font-family: var(--font-body);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #00b8e6);
  color: #05080f;
  box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.3);
}
.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
  text-decoration: none;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { opacity: 0.85; }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

/* ====== Login / Register pages ====== */
.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}
.landing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.3);
}
.landing-card-header {
  text-align: center;
  margin-bottom: 1.25rem;
}
.landing-card-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}
.landing-card-header p {
  font-size: 0.84rem;
  color: var(--text-dim);
  margin: 0;
}

.landing-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.landing-feature-item {
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  letter-spacing: -0.01em;
}
.landing-feature-item::before {
  content: '\2022';
  color: var(--green);
  margin-right: 0.35rem;
  font-weight: 700;
}

.login-form { margin-top: 0.75rem; }
.login-form .field { margin-bottom: 1rem; }
.captcha-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.captcha-img {
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
}
.captcha-refresh {
  font-size: 0.78rem;
  color: var(--accent);
  white-space: nowrap;
}
.captcha-input { width: 140px !important; }

.btn-submit {
  width: 100%;
  padding: 0.7rem;
  background: linear-gradient(135deg, var(--accent), #00b8e6);
  color: #05080f;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: -0.01em;
}
.btn-submit:hover {
  opacity: 0.92;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
  transform: translateY(-1px);
}

/* ====== Flash Messages ====== */
.flash-container { margin-bottom: 1rem; }
.flash {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash.success { background: var(--green-dim); color: var(--green); border-color: rgba(34, 197, 94, 0.15); }
.flash.error { background: var(--red-dim); color: var(--red); border-color: rgba(239, 68, 68, 0.15); }
.flash.info { background: var(--accent-dim); color: var(--accent); border-color: rgba(0, 212, 255, 0.15); }

/* ====== Page headings ====== */
h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.75rem; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 1.75rem 0 0.75rem; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 0.5rem; color: var(--text-dim); }
p { margin: 0.5rem 0; color: var(--text-dim); }

/* ====== Cards ====== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-light); }

/* ====== Key display ====== */
.key-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
}
.key-row code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: rgba(0,0,0,0.2);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  word-break: break-all;
}

/* ====== Code ====== */
code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: rgba(0,0,0,0.2);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ====== Tabs ====== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.tabs a, .tabs span {
  padding: 0.5rem 1rem;
  font-size: 0.84rem;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  font-weight: 500;
}
.tabs a:hover, .tabs span:hover { color: var(--text); text-decoration: none; }
.tabs a.active, .tabs span.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ====== Deposit ====== */
.deposit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.qr-row { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.qr-col { flex-shrink: 0; }
.qr-img {
  width: 140px; height: 140px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff; padding: 4px;
}
.qr-info { flex: 1; min-width: 220px; }
.qr-info strong { display: block; margin-bottom: 0.4rem; }
.address-code {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(0,0,0,0.2);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  word-break: break-all;
  margin: 0.4rem 0;
  color: var(--text);
}
.amount-row { display: flex; gap: 0.5rem; margin: 0.5rem 0; }
.amount-row input { flex: 1; }
.amount-row button {
  padding: 0.6rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), #00b8e6);
  color: #05080f;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-body);
}
.amount-row button:hover { opacity: 0.92; }

/* ====== Badges ====== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-pending { background: var(--amber-dim); color: var(--amber); }
.badge-confirmed { background: var(--green-dim); color: var(--green); }
.badge-rejected { background: var(--red-dim); color: var(--red); }

/* ====== Info banners ====== */
.price-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: var(--accent-dim);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}
.price-info-banner strong { color: var(--accent); }

.history-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ====== Utilities ====== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ====== Glow button effect for CTAs ====== */
.glow-on-hover {
  position: relative;
  overflow: hidden;
}
.glow-on-hover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.1) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.glow-on-hover:hover::after { opacity: 1; }

/* ====== Mobile ====== */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem;
    gap: 0.25rem;
    align-items: center;
    background: rgba(15, 19, 28, 0.95);
  }
  .sidebar-brand { border-bottom: none; padding: 0.25rem 0.5rem; }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.25rem;
    gap: 0;
  }
  .sidebar-section-label { display: none; }
  .sidebar-item { font-size: 0.76rem; padding: 0.3rem 0.5rem; }
  .sidebar-item svg { width: 14px; height: 14px; }
  .sidebar-footer { display: none; }
  .sidebar-user { display: none; }
  .sidebar-logout { font-size: 0.7rem; }

  .main-wrapper { margin-left: 0; }
  .main-content { padding: 1rem 1rem 2rem; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .landing-features { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }

  table { font-size: 0.76rem; }
  thead th, tbody td { padding: 0.4rem 0.5rem; }

  body::before { width: 100%; height: 200px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .plan-status { flex-direction: column; align-items: flex-start; }
  .flex-between { flex-direction: column; align-items: flex-start; }
}
