@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg: #080b10;
  --surface: #0e1219;
  --border: #1e2535;
  --accent-green: #00f0a0;
  --accent-blue: #0090ff;
  --text: #e8edf5;
  --muted: #5a6478;
  --card: #111722;
  --gold: #f5c542;
  --red: #ff4757;
  --font-display: 'Syne', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ─── NOISE OVERLAY ─────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.35;
}

/* ─── ANIMATED BLOB BACKGROUNDS ─────────────────── */
.blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: blobFloat 12s ease-in-out infinite;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-green);
  top: -150px;
  left: -100px;
  animation-delay: 0s;
  animation-duration: 14s;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-blue);
  bottom: -100px;
  right: -80px;
  animation-delay: -5s;
  animation-duration: 11s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: var(--accent-green);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -3s;
  animation-duration: 16s;
  opacity: 0.06;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 15px) scale(1.02); }
}

/* ─── LAYOUT ─────────────────────────────────────── */
.page-content {
  position: relative;
  z-index: 1;
}

/* ─── TYPOGRAPHY ─────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

p {
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ─── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover::after { opacity: 0.06; }
.btn:active::after { opacity: 0.12; }

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

.btn:disabled::after { display: none; }

.btn-primary {
  background: var(--accent-green);
  color: #080b10;
}

.btn-primary:hover {
  box-shadow: 0 0 24px rgba(0, 240, 160, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--muted);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.btn-gold {
  background: var(--gold);
  color: #1a1200;
  font-weight: 700;
}

.btn-gold:hover {
  box-shadow: 0 0 20px rgba(245, 197, 66, 0.35);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(255, 71, 87, 0.12);
  color: var(--red);
  border: 1px solid rgba(255, 71, 87, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 71, 87, 0.2);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1rem;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ─── CARDS ──────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ─── INPUTS ─────────────────────────────────────── */
.input,
textarea.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.95rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: none;
}

.input:focus,
textarea.input:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(0, 240, 160, 0.1);
}

.input::placeholder,
textarea.input::placeholder {
  color: var(--muted);
}

/* ─── NAVBAR ─────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(8, 11, 16, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  gap: 16px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.navbar-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #080b10;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.navbar-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.navbar-title span {
  color: var(--accent-green);
}

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

/* ─── CREDITS BADGE ──────────────────────────────── */
.credits-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(245, 197, 66, 0.08);
  border: 1px solid rgba(245, 197, 66, 0.2);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  position: relative;
}

.credits-badge:hover {
  background: rgba(245, 197, 66, 0.14);
  border-color: rgba(245, 197, 66, 0.35);
}

.credits-badge .coin-icon {
  font-size: 14px;
}

/* ─── AVATAR ─────────────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #080b10;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar:hover {
  border-color: var(--accent-green);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ─── DROPDOWN ───────────────────────────────────── */
.dropdown-wrapper {
  position: relative;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 260px;
  padding: 8px;
  z-index: 200;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: all 0.18s ease;
}

.dropdown-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-display);
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-item .item-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: var(--muted);
}

.dropdown-item .item-ext {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.dropdown-header {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropdown-header .user-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.dropdown-header .user-email {
  font-size: 0.775rem;
  color: var(--muted);
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(245, 197, 66, 0.12);
  border: 1px solid rgba(245, 197, 66, 0.25);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── CREDITS DROPDOWN CONTENT ───────────────────── */
.credits-panel-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.credits-panel-header h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
}

.credits-big {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
  font-family: var(--font-mono);
  line-height: 1;
}

.credits-breakdown {
  padding: 12px 16px;
}

.credits-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.825rem;
  color: var(--muted);
}

.credits-row .value {
  color: var(--text);
  font-weight: 600;
  font-family: var(--font-mono);
}

.credits-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.credits-footer p {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ─── SPINNER ────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

/* ─── LOADING OVERLAY ────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 16, 0.96);
  backdrop-filter: blur(12px);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.loading-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-green);
  letter-spacing: -0.02em;
}

.terminal-lines {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  min-width: 360px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.terminal-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.4s ease;
}

.terminal-line.visible {
  opacity: 1;
  transform: translateY(0);
  color: var(--text);
}

.terminal-line.done {
  color: var(--accent-green);
}

.terminal-line .prefix {
  color: var(--accent-green);
  width: 20px;
  text-align: center;
  animation: termSpin 0.8s linear infinite;
}

.terminal-line.done .prefix {
  animation: none;
}

@keyframes termSpin {
  0% { content: '⠸'; }
  25% { content: '⠼'; }
  50% { content: '⠴'; }
  75% { content: '⠦'; }
}

/* ─── MODAL ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.modal-box h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.modal-box p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ─── BADGE ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green {
  background: rgba(0, 240, 160, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(0, 240, 160, 0.2);
}

.badge-blue {
  background: rgba(0, 144, 255, 0.1);
  color: var(--accent-blue);
  border: 1px solid rgba(0, 144, 255, 0.2);
}

/* ─── PILL BUTTONS ───────────────────────────────── */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--muted);
}

.pill.active {
  background: rgba(0, 240, 160, 0.1);
  color: var(--accent-green);
  border-color: rgba(0, 240, 160, 0.35);
}

/* ─── TAG ────────────────────────────────────────── */
.type-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(0, 144, 255, 0.1);
  border: 1px solid rgba(0, 144, 255, 0.2);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--accent-blue);
  font-weight: 600;
}

/* ─── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 768px) {
  .navbar-title {
    display: none;
  }

  .dropdown-panel {
    min-width: 220px;
  }
}