/* ────────────────────────────────────────────────────────────────
   CashClaw Dashboard - Dark Theme (Enhanced)
   Colors: #1A1A2E bg, #FF6B35 orange, #16C784 green
   ──────────────────────────────────────────────────────────────── */

:root {
  --bg-primary: #1A1A2E;
  --bg-secondary: #16213E;
  --bg-card: #1E2A45;
  --bg-card-gradient: linear-gradient(135deg, #1E2A45 0%, #1A2540 100%);
  --bg-hover: #253555;
  --orange: #FF6B35;
  --orange-glow: rgba(255, 107, 53, 0.25);
  --orange-dim: #CC5529;
  --green: #16C784;
  --green-glow: rgba(22, 199, 132, 0.2);
  --green-dim: #12A96D;
  --red: #E74C3C;
  --yellow: #F39C12;
  --blue: #3498DB;
  --text-primary: #E8E8E8;
  --text-secondary: #8892A4;
  --text-muted: #5A6678;
  --border: #2A3A5C;
  --border-hover: #3A5080;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-lg: rgba(0, 0, 0, 0.5);
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-pill: 100px;
}

/* ─── Global Reset & Base ───────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
}

::selection {
  background: var(--orange);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

code, pre, .monospace {
  font-family: var(--font-mono);
}

#app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Animations ────────────────────────────────────────────────── */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 4px var(--green-glow); }
  50% { box-shadow: 0 0 12px var(--green-glow), 0 0 24px var(--green-glow); }
}

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

/* ─── Header ────────────────────────────────────────────────────── */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.logo {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--orange) 0%, #FF8F65 50%, var(--orange) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 8px var(--orange-glow));
}

.version {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.3px;
}

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

.agent-name {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--green);
  display: inline-block;
  box-shadow: 0 0 6px var(--green-glow);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.offline {
  background-color: var(--red);
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.3);
  animation: none;
}

/* ─── Cards ─────────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card-gradient);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  border: 1px solid var(--border);
  transition:
    border-color var(--transition-base),
    transform var(--transition-smooth),
    box-shadow var(--transition-smooth);
  animation: fadeInUp 0.4s ease both;
}

.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }
.card:nth-child(4) { animation-delay: 0.18s; }

.card:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow), 0 0 0 1px var(--orange-glow);
}

.card-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
}

.card-total {
  border-top: 3px solid var(--green);
  background: linear-gradient(135deg, #1E2A45 0%, #1A3040 100%);
}

.card-total .card-value {
  color: var(--green);
}

.card-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Main Grid ─────────────────────────────────────────────────── */

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-panel {
  grid-column: 1 / -1;
}

/* ─── Panels ────────────────────────────────────────────────────── */

.panel {
  background: var(--bg-card-gradient);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  border: 1px solid var(--border);
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base);
  animation: fadeIn 0.5s ease both;
}

.panel:hover {
  border-color: var(--border-hover);
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 3px solid var(--orange);
}

.badge {
  background: var(--orange);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  min-width: 22px;
  text-align: center;
}

/* ─── Chart ─────────────────────────────────────────────────────── */

.chart-container {
  width: 100%;
  height: 200px;
  position: relative;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ─── Missions List ─────────────────────────────────────────────── */

.missions-list {
  max-height: 320px;
  overflow-y: auto;
}

.mission-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.mission-item:hover {
  background: var(--bg-hover);
}

.mission-item:last-child {
  border-bottom: none;
}

.mission-info {
  flex: 1;
}

.mission-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.mission-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.mission-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
  margin-left: 16px;
  font-family: var(--font-mono);
}

.mission-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-left: 12px;
  text-transform: uppercase;
  transition: transform var(--transition-fast);
}

.status-created { background: var(--blue); color: white; }
.status-in_progress { background: var(--yellow); color: var(--bg-primary); }
.status-completed { background: var(--green); color: var(--bg-primary); }
.status-cancelled { background: var(--red); color: white; }
.status-paid { background: var(--green); color: var(--bg-primary); }

/* ─── Services List ─────────────────────────────────────────────── */

.service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.service-item:hover {
  background: var(--bg-hover);
}

.service-item:last-child {
  border-bottom: none;
}

.service-name {
  font-size: 14px;
  font-weight: 500;
}

.service-prices {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ─── Skills List ───────────────────────────────────────────────── */

.skill-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.skill-item:hover {
  background: var(--bg-hover);
}

.skill-item:last-child {
  border-bottom: none;
}

.skill-name {
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-mono);
}

.skill-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  transition: transform var(--transition-fast);
}

.skill-installed {
  background: var(--green);
  color: var(--bg-primary);
}

.skill-available {
  background: var(--border);
  color: var(--text-secondary);
}

/* ─── Recent Earnings ───────────────────────────────────────────── */

.recent-list {
  max-height: 320px;
  overflow-y: auto;
}

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.recent-item:hover {
  background: var(--bg-hover);
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-info {
  flex: 1;
}

.recent-service {
  font-size: 13px;
  color: var(--text-primary);
}

.recent-date {
  font-size: 11px;
  color: var(--text-muted);
}

.recent-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  font-family: var(--font-mono);
}

/* ─── Agent Info ────────────────────────────────────────────────── */

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.info-row:hover {
  background: var(--bg-hover);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 13px;
  color: var(--text-muted);
}

.info-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.info-value.connected {
  color: var(--green);
}

.info-value.disconnected {
  color: var(--yellow);
}

/* ─── Empty State ───────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 0.2px;
  line-height: 1.6;
}

/* ─── Footer ────────────────────────────────────────────────────── */

.footer {
  text-align: center;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.footer a {
  color: var(--orange);
  text-decoration: none;
  text-underline-offset: 3px;
  transition:
    color var(--transition-fast),
    text-underline-offset var(--transition-base);
}

.footer a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
  color: #FF8F65;
}

.footer-sep {
  margin: 0 8px;
  opacity: 0.3;
}

/* ─── Scrollbar (minimal) ───────────────────────────────────────── */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ─── HYRVE Marketplace ─────────────────────────────────────────── */

.hyrve-panel {
  grid-column: 1 / -1;
}

.hyrve-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.hyrve-section {
  margin-bottom: 16px;
}

.hyrve-section h3 {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* HYRVE badge pulse when connected */
.hyrve-panel .badge {
  transition: all var(--transition-base);
}

.hyrve-panel .badge.badge-success {
  animation: glowPulse 2.5s ease-in-out infinite;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-dim);
  box-shadow: 0 4px 12px var(--green-glow);
}

.btn-secondary {
  background: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border-hover);
}

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

.btn-outline:hover {
  border-color: var(--green);
  color: var(--green);
}

.badge-success { background: var(--green) !important; }
.badge-warning { background: var(--yellow) !important; }

/* ─── HYRVE Job Items ───────────────────────────────────────────── */

.hyrve-section .mission-item,
.hyrve-section .service-item {
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.hyrve-section .mission-item:hover,
.hyrve-section .service-item:hover {
  background: var(--bg-hover);
}

.hyrve-section .btn-sm:hover {
  transform: translateY(-1px);
}

/* ─── Wallet ────────────────────────────────────────────────────── */

.wallet-panel {
  grid-column: 1 / -1;
}

.wallet-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.wallet-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  border: 1px solid var(--border);
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base);
}

.wallet-card:hover {
  border-color: var(--border-hover);
}

.wallet-card .card-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wallet-card .card-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
  font-family: var(--font-mono);
}

.wallet-available {
  border-color: rgba(22, 199, 132, 0.25);
  box-shadow: 0 0 12px var(--green-glow), inset 0 1px 0 rgba(22, 199, 132, 0.08);
}

.wallet-available:hover {
  border-color: rgba(22, 199, 132, 0.45);
  box-shadow: 0 0 20px var(--green-glow), inset 0 1px 0 rgba(22, 199, 132, 0.12);
}

.wallet-available .card-value { color: var(--green); }
.wallet-pending .card-value { color: var(--yellow); }
.wallet-total .card-value { color: var(--text-primary); }

/* ─── Wallet Transactions ───────────────────────────────────────── */

.wallet-transactions .recent-item::before,
.wallet-transactions .mission-item::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 10px;
  flex-shrink: 0;
}

/* ─── Modal ─────────────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow:
    0 24px 48px var(--shadow-lg),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: fadeInUp 0.25s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-body label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  box-sizing: border-box;
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base);
}

.modal-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}

.modal-input::placeholder {
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn-primary:hover {
  transform: scale(1.02);
}

/* ─── Order Status Badges ───────────────────────────────────────── */

.order-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-info { background: rgba(52, 152, 219, 0.15); color: var(--blue); }
.badge-danger { background: rgba(231, 76, 60, 0.15); color: var(--red); }

/* ─── Small Buttons ─────────────────────────────────────────────── */

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  margin-left: 8px;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

/* ─── Responsive ────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-value {
    font-size: 22px;
  }

  .header {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

@media (max-width: 480px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .wallet-cards {
    grid-template-columns: 1fr !important;
  }

  .hyrve-actions {
    flex-direction: column;
  }
}

/* ─── High Contrast / Reduced Motion ───────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}
