/*
Theme Name: GainWave
Theme URI: https://gainwave.local
Author: Volkan
Description: Lavender Light trading dashboard theme met invite-only registratie, Node.js engine koppeling, draggable widgets, live prijzen en crypto nieuws.
Version: 2.1.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: gainwave
*/

/* ---------- Tokens ---------- */
:root {
  --bg:         #f0eff6;
  --surface:    #ffffff;
  --ink:        #1e1b2e;
  --ink-soft:   #7a7390;
  --lav-50:     #faf5ff;
  --lav-100:    #f3e8ff;
  --lav-200:    #e9d5ff;
  --lav-300:    #d8b4fe;
  --lav-400:    #c084fc;
  --lav-500:    #a855f7;
  --lav-600:    #9333ea;
  --lav-700:    #7e22ce;
  --rose-200:   #fecdd3;
  --rose-300:   #fda4af;
  --mint:       #22c55e;
  --red:        #ef4444;
  --amber:      #f59e0b;
  --shadow-sm:  0 1px 3px rgba(126, 34, 206, 0.04), 0 1px 2px rgba(126, 34, 206, 0.02);
  --shadow:     0 4px 24px rgba(126, 34, 206, 0.06), 0 1px 4px rgba(126, 34, 206, 0.03);
  --shadow-md:  0 8px 32px rgba(126, 34, 206, 0.08), 0 2px 8px rgba(126, 34, 206, 0.04);
  --shadow-lg:  0 16px 48px rgba(126, 34, 206, 0.10), 0 4px 12px rgba(126, 34, 206, 0.05);
  --radius:     20px;
  --radius-sm:  14px;
  --font-body:  'Inter', system-ui, -apple-system, sans-serif;
  --font-pixel: 'Press Start 2P', monospace;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--lav-700); text-decoration: none; }
a:hover { text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--lav-400);
  outline-offset: 2px;
  border-radius: 4px;
}

img { max-width: 100%; height: auto; }

.gw-wrap { max-width: 1080px; margin: 0 auto; padding: 0 28px; }

/* ---------- Header ---------- */
.gw-header {
  background: transparent;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 20px 0;
}
.gw-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gw-logo {
  font-family: var(--font-pixel);
  font-size: 13px;
  color: var(--ink);
  letter-spacing: 1px;
  line-height: 1;
}
.gw-logo .accent { color: var(--lav-700); }
.gw-nav { display: flex; align-items: center; gap: 20px; }
.gw-nav a {
  color: rgba(30, 27, 46, 0.7);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.gw-nav a:hover {
  color: var(--ink);
  background: rgba(255,255,255,0.5);
}
.gw-nav a.gw-btn-nav {
  background: var(--surface);
  color: var(--lav-700);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(168, 85, 247, 0.15);
}
.gw-nav a.gw-btn-nav:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* ---------- Buttons ---------- */
.gw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--lav-500), var(--lav-600));
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.25), 0 1px 3px rgba(147, 51, 234, 0.15);
}
.gw-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(147, 51, 234, 0.35), 0 2px 6px rgba(147, 51, 234, 0.2);
}
.gw-btn:active:not(:disabled) {
  transform: translateY(0);
}
.gw-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.gw-btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  border: 1px solid rgba(122, 115, 144, 0.2);
}
.gw-btn-ghost:hover:not(:disabled) {
  background: var(--surface);
  border-color: rgba(168, 85, 247, 0.3);
  color: var(--lav-700);
  box-shadow: var(--shadow-sm);
}

.gw-btn-danger {
  background: linear-gradient(135deg, #fca5a5, var(--red));
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}
.gw-btn-danger:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
}

.gw-btn-sm {
  padding: 8px 16px;
  font-size: 12px;
  border-radius: 10px;
}

.gw-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: gw-spin 0.7s linear infinite;
}
@keyframes gw-spin { to { transform: rotate(360deg); } }

/* ---------- Cards ---------- */
.gw-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(168, 85, 247, 0.06);
}
.gw-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.gw-card h2, .gw-card h3 { margin-top: 0; }
.gw-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

/* ---------- Hero ---------- */
.gw-hero {
  position: relative;
  overflow: hidden;
  padding: 120px 0 0;
}
/* Wave layers */
.gw-hero::before {
  content: '';
  position: absolute;
  top: -80px; left: -10%; right: -10%;
  height: 420px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(216, 180, 254, 0.5) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(253, 164, 175, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse 70% 55% at 50% 10%, rgba(233, 213, 255, 0.45) 0%, transparent 60%);
  border-radius: 0 0 50% 50%;
  z-index: 0;
}
.gw-hero::after {
  content: '';
  position: absolute;
  top: 60px; left: 0; right: 0;
  height: 300px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23e9d5ff' fill-opacity='0.3' d='M0,160L48,170.7C96,181,192,203,288,186.7C384,171,480,117,576,101.3C672,85,768,107,864,128C960,149,1056,171,1152,165.3C1248,160,1344,128,1392,112L1440,96L1440,0L1392,0C1344,0,1248,0,1152,0C1056,0,960,0,864,0C768,0,672,0,576,0C480,0,384,0,288,0C192,0,96,0,48,0L0,0Z'%3E%3C/path%3E%3Cpath fill='%23fecdd3' fill-opacity='0.2' d='M0,224L48,213.3C96,203,192,181,288,181.3C384,181,480,203,576,224C672,245,768,267,864,250.7C960,235,1056,181,1152,165.3C1248,149,1344,171,1392,181.3L1440,192L1440,0L1392,0C1344,0,1248,0,1152,0C1056,0,960,0,864,0C768,0,672,0,576,0C480,0,384,0,288,0C192,0,96,0,48,0L0,0Z'%3E%3C/path%3E%3C/svg%3E") no-repeat center bottom;
  background-size: cover;
  z-index: 0;
  pointer-events: none;
}
.gw-hero-inner {
  position: relative;
  z-index: 1;
  padding: 40px 0 60px;
  text-align: center;
}
.gw-hero .gw-brand {
  font-family: var(--font-pixel);
  font-size: clamp(22px, 4vw, 36px);
  margin: 0 0 18px;
  line-height: 1.5;
}
.gw-hero p.lede {
  max-width: 480px;
  margin: 0 auto 28px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.7;
}
.gw-hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Stats ---------- */
.gw-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: -40px auto 0;
  position: relative;
  z-index: 2;
  padding: 0 28px;
  max-width: 1080px;
}
@media (max-width: 700px) {
  .gw-stats { grid-template-columns: repeat(2, 1fr); }
}
.gw-stat {
  text-align: center;
  padding: 24px 16px;
}
.gw-stat .num {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 4px;
}
.gw-stat .lbl {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Features ---------- */
.gw-section { padding: 60px 0 80px; }
.gw-section h2.gw-h {
  text-align: center;
  font-size: 22px;
  margin: 0 0 6px;
  font-weight: 700;
}
.gw-section p.gw-sub {
  text-align: center;
  color: var(--ink-soft);
  margin: 0 0 36px;
  font-size: 14px;
}
.gw-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 860px) {
  .gw-features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .gw-features { grid-template-columns: 1fr; }
}
.gw-feature {
  text-align: center;
  padding: 36px 24px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.gw-feature:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-5px);
}
.gw-feature .ico {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--lav-100), var(--lav-50));
  color: var(--lav-600);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}
.gw-feature:hover .ico {
  background: linear-gradient(135deg, var(--lav-200), var(--lav-100));
  transform: scale(1.05);
}
.gw-feature .ico svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gw-feature h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; color: var(--ink); }
.gw-feature p { font-size: 13px; color: var(--ink-soft); margin: 0; line-height: 1.5; }

/* ---------- Dashboard ---------- */
.gw-dash { padding: 32px 0 80px; }
.gw-dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.gw-dash-head h1 { font-size: 20px; margin: 0; font-weight: 700; }

.gw-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(168, 85, 247, 0.08);
}
.gw-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #d1d5db; }
.gw-badge.running .dot { background: var(--mint); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.gw-badge.running { color: #16a34a; }
.gw-badge.paused .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.gw-badge.paused { color: #b45309; }
.gw-badge.stopped .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
.gw-badge.stopped { color: #dc2626; }

/* Grid */
.gw-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.gw-col-4 { grid-column: span 4; }
.gw-col-6 { grid-column: span 6; }
.gw-col-8 { grid-column: span 8; }
.gw-col-12 { grid-column: span 12; }
@media (max-width: 860px) {
  .gw-col-4, .gw-col-6, .gw-col-8 { grid-column: span 12; }
}

.gw-metric .num { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gw-metric .sub { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }
.gw-mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 12px; word-break: break-all; color: var(--ink-soft); }

/* Controls */
.gw-controls { display: flex; gap: 10px; flex-wrap: wrap; }

.gw-mode-toggle {
  display: inline-flex;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  padding: 3px;
  gap: 3px;
}
.gw-mode-toggle button {
  border: 0;
  background: transparent;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.gw-mode-toggle button.active {
  background: var(--surface);
  color: var(--lav-700);
  box-shadow: var(--shadow-sm);
}
.gw-mode-toggle button:hover:not(.active):not(:disabled) { color: var(--ink); }
.gw-mode-toggle button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Form */
.gw-field { margin-bottom: 14px; }
.gw-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gw-field input, .gw-field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(168, 85, 247, 0.15);
  border-radius: 12px;
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  transition: all 0.25s ease;
}
.gw-field input:focus, .gw-field select:focus {
  border-color: var(--lav-400);
  outline: none;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.1);
}
.gw-field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* Tables */
.gw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.gw-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(168, 85, 247, 0.1);
}
.gw-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(168, 85, 247, 0.05);
  font-variant-numeric: tabular-nums;
}
.gw-table tr:last-child td { border-bottom: 0; }
.gw-table tbody tr {
  transition: background 0.2s ease;
}
.gw-table tbody tr:hover {
  background: rgba(168, 85, 247, 0.03);
  border-radius: 8px;
}
.gw-pos { color: var(--mint); font-weight: 700; }
.gw-neg { color: var(--red); font-weight: 700; }
.gw-empty { color: var(--ink-soft); text-align: center; padding: 32px 12px; font-size: 13px; }

/* Auth */
.gw-auth {
  min-height: calc(100vh - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.gw-auth .gw-card { width: 100%; max-width: 400px; padding: 40px; }
.gw-auth .gw-logo { display: block; text-align: center; margin-bottom: 24px; font-size: 15px; letter-spacing: 2px; }
.gw-notice {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.gw-notice.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.gw-notice.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.gw-notice.info { background: var(--lav-50); border-color: var(--lav-200); color: var(--lav-700); }

/* Footer */
.gw-footer {
  padding: 24px 0;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}
.gw-footer .gw-wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Content fallback */
.gw-content { padding: 48px 0; }

/* ---------- Live ticker ---------- */
.gw-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--mint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.gw-live-dot .pulse {
  width: 6px; height: 6px;
  background: var(--mint);
  border-radius: 50%;
  animation: gw-pulse 2s ease-in-out infinite;
}
@keyframes gw-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.65); }
}

.gw-ticker {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  align-items: center;
}
.gw-ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(168, 85, 247, 0.03);
  transition: background 0.2s;
}
.gw-ticker-item:hover { background: rgba(168, 85, 247, 0.07); }
.gw-ticker-name { font-weight: 700; color: var(--ink); min-width: 36px; }
.gw-ticker-price { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.gw-ticker-change { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }

/* ---------- P&L ---------- */
.gw-pnl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 640px) { .gw-pnl-grid { grid-template-columns: 1fr; } }
.gw-pnl-item {
  text-align: center;
  padding: 20px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: all 0.25s ease;
}
.gw-pnl-item:hover { background: rgba(168, 85, 247, 0.05); }
.gw-pnl-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin-bottom: 8px; }
.gw-pnl-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.gw-pnl-meta { font-size: 12px; color: var(--ink-soft); }

/* ---------- News ---------- */
.gw-news-item {
  display: flex;
  gap: 14px;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s ease;
  margin-bottom: 4px;
}
.gw-news-item:last-child { margin-bottom: 0; }
.gw-news-item:hover { background: var(--bg); text-decoration: none; }
.gw-news-img {
  width: 72px; height: 52px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}
.gw-news-body { flex: 1; min-width: 0; }
.gw-news-title { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; }
.gw-news-meta { font-size: 11px; color: var(--ink-soft); }
.gw-news-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid rgba(168, 85, 247, 0.08);
}

/* ---------- Activity log ---------- */
.gw-activity-item {
  display: flex; gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  transition: background 0.15s;
}
.gw-activity-item:hover { background: var(--bg); }
.gw-activity-item:last-child { border-bottom: 0; }
.gw-activity-time { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 110px; font-size: 11px; }
.gw-activity-msg { color: var(--ink); flex: 1; word-break: break-word; }

/* ---------- Pagination ---------- */
.gw-pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid rgba(168, 85, 247, 0.08);
}

/* ---------- Widget drag & drop ---------- */
.gw-widget { position: relative; }
.gw-widget-handle {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
  cursor: grab;
  user-select: none;
}
.gw-widget-handle:active { cursor: grabbing; }
.gw-widget-handle .gw-card-title { margin: 0; }
.gw-drag-hint {
  font-size: 11px;
  color: var(--ink-soft);
  opacity: 0.3;
  cursor: grab;
  letter-spacing: 1px;
  transition: opacity 0.2s;
  padding: 4px 8px;
  border-radius: 6px;
}
.gw-card:hover .gw-drag-hint { opacity: 0.6; }
.gw-drag-hint:hover { opacity: 1 !important; background: var(--bg); }
.gw-widget[draggable="true"] { cursor: default; }

/* Dragging state */
.gw-widget.is-dragging {
  opacity: 0.4;
  transform: scale(0.97) rotate(0.5deg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}
.gw-widget.is-drag-over {
  border: 2px dashed var(--lav-400) !important;
  background: var(--lav-50) !important;
  transform: translateY(2px);
}

/* Smooth transitions for all widgets during drag */
.gw-widget {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease,
              border-color 0.2s ease,
              background 0.2s ease;
}
.gw-widget.is-dragging,
.gw-widget.is-drag-over {
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.15s ease,
              opacity 0.15s ease;
}

/* Keyboard hints */
kbd {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  background: var(--bg);
  border: 1px solid rgba(168, 85, 247, 0.15);
  border-radius: 5px;
  box-shadow: 0 1px 0 rgba(168, 85, 247, 0.1);
  color: var(--ink-soft);
  line-height: 1.3;
}

/* Wallet deposit */
#gw-deposit-addr { transition: all 0.3s ease; }
