/* Reset & Core Styling */
:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --bg-dark: #07060c;
  --bg-deep: #0e0c18;
  --bg-card: rgba(22, 19, 39, 0.7);
  --bg-glass: rgba(14, 12, 24, 0.6);
  --border-neon: rgba(139, 92, 246, 0.25);
  --border-neon-active: rgba(139, 92, 246, 0.6);
  
  --neon-purple: #8b5cf6;
  --neon-cyan: #06b6d4;
  --neon-green: #10b981;
  --neon-orange: #f59e0b;
  --neon-red: #ef4444;
  
  --text-white: #ffffff;
  --text-gray: #94a3b8;
  --text-dim: #64748b;
  
  --shadow-glow: 0 0 15px rgba(139, 92, 246, 0.2);
  --shadow-glow-green: 0 0 15px rgba(16, 185, 129, 0.2);
}

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

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

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--border-neon);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--neon-purple);
}

/* Glowing background effects */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(150px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
}
.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--neon-purple);
  top: 10%;
  left: -100px;
}
.orb-2 {
  width: 500px;
  height: 500px;
  background: var(--neon-cyan);
  bottom: 10%;
  right: -100px;
}

/* Layout Containers */
.app-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-neon);
  margin-bottom: 25px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
}
.logo-icon {
  color: var(--neon-purple);
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
}
.brand-text h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--text-white) 30%, var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-text p {
  font-size: 0.75rem;
  letter-spacing: 3px;
  color: var(--neon-cyan);
  font-weight: 600;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 15px;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-deep);
  border: 1px solid var(--border-neon);
  padding: 8px 14px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-gray);
  letter-spacing: 0.5px;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
}
.status-badge.disconnected .pulse-dot {
  background: var(--neon-red);
  box-shadow: 0 0 8px var(--neon-red);
}

/* Metrics Dashboard Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 25px;
}
.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-neon);
  padding: 16px 20px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-glow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-neon-active);
}
.metric-card .label {
  font-size: 0.7rem;
  color: var(--text-gray);
  letter-spacing: 1px;
  font-weight: 600;
}
.metric-card .value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin-top: 6px;
  color: var(--text-white);
}
.metric-card .value.alert-on {
  color: var(--neon-red);
}
.metric-card .value.alert-active {
  color: var(--neon-green);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* App Workspace Grid */
.app-workspace {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 25px;
  align-items: start;
}

.workspace-section {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-neon);
  border-radius: 16px;
  padding: 24px;
  min-height: 600px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-neon);
  margin-bottom: 20px;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}
.section-header p {
  font-size: 0.8rem;
  color: var(--text-gray);
}

/* Custom Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  cursor: pointer;
  font-size: 0.85rem;
  user-select: none;
  color: var(--text-gray);
}
.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}
.checkmark {
  height: 18px;
  width: 18px;
  background-color: var(--bg-deep);
  border: 1px solid var(--border-neon);
  border-radius: 4px;
  display: inline-block;
  position: relative;
  transition: border-color 0.2s, background-color 0.2s;
}
.checkbox-container:hover input ~ .checkmark {
  border-color: var(--neon-purple);
}
.checkbox-container input:checked ~ .checkmark {
  background-color: var(--neon-purple);
  border-color: var(--neon-purple);
}
.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: var(--font-main);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--neon-purple), #7c3aed);
  color: var(--text-white);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
  background: linear-gradient(135deg, #9333ea, #6d28d9);
}
.btn-secondary {
  background: var(--bg-deep);
  border: 1px solid var(--border-neon);
  color: var(--text-white);
}
.btn-secondary:hover {
  border-color: var(--border-neon-active);
  background: rgba(139, 92, 246, 0.1);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--neon-red);
  color: var(--neon-red);
}
.btn-danger:hover {
  background: var(--neon-red);
  color: var(--text-white);
}
.btn-full {
  width: 100%;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

/* Feed Streams List */
.feed-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 700px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Token Listing Card */
.token-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-neon);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.token-card:hover {
  border-color: var(--border-neon-active);
  box-shadow: var(--shadow-glow);
  transform: scale(1.005) translateY(-2px);
}

.token-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.token-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.token-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-neon);
  background-color: var(--bg-deep);
  object-fit: cover;
}
.token-titles h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.token-address {
  font-family: monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  cursor: pointer;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 6px;
  border-radius: 4px;
}
.token-address:hover {
  color: var(--neon-cyan);
}

/* Score badge */
.score-badge {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  padding: 6px 12px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}
.score-high {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--neon-green);
  color: var(--neon-green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}
.score-medium {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}
.score-low {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--neon-orange);
  color: var(--neon-orange);
}
.score-fail {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--neon-red);
  color: var(--neon-red);
}
.score-badge .score-lbl {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

/* Security indicators */
.security-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.sec-pill {
  font-size: 0.65rem;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}
.sec-pill.safe {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--neon-green);
}
.sec-pill.danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--neon-red);
}

/* Token stats list */
.token-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}
.stat-box {
  display: flex;
  flex-direction: column;
}
.stat-box .lbl {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-box .val {
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 4px;
}
.pos-change {
  color: var(--neon-green);
}
.neg-change {
  color: var(--neon-red);
}

/* Interactive quick action links */
.token-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 10px;
  gap: 10px;
}
.trade-links {
  display: flex;
  gap: 6px;
}
.trade-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-neon);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-gray);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.trade-btn:hover {
  background: var(--neon-purple);
  border-color: var(--neon-purple);
  color: var(--text-white);
}

/* Loading States & Spinners */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  gap: 15px;
  color: var(--text-gray);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(139, 92, 246, 0.1);
  border-top-color: var(--neon-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: var(--shadow-glow);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 40px 10px;
  text-align: center;
}

/* Sidebar Tab Container */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-deep);
  border: 1px solid var(--border-neon);
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-gray);
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-main);
  transition: all 0.2s;
}
.tab-btn:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.02);
}
.tab-btn.active {
  background: var(--neon-purple);
  color: var(--text-white);
  box-shadow: var(--shadow-glow);
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Panels */
.border-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-neon);
  border-radius: 12px;
  padding: 20px;
}
.border-panel h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.border-panel .subtext {
  font-size: 0.75rem;
  color: var(--text-gray);
  margin-bottom: 15px;
}

/* Inputs & Forms */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.input-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-gray);
  letter-spacing: 0.5px;
}
.input-group input[type="text"],
.input-group input[type="url"],
.input-group input[type="number"],
.input-group input[type="password"] {
  background: var(--bg-deep);
  border: 1px solid var(--border-neon);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text-white);
  font-family: var(--font-main);
  font-size: 0.85rem;
  transition: all 0.2s;
}
.input-group input:focus {
  outline: none;
  border-color: var(--neon-purple);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.25);
}
.input-help {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.grid-inputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.grid-inputs .input-group {
  margin-bottom: 0;
}

/* Search Bar layout */
.search-bar {
  display: flex;
  flex-direction: row !important;
  gap: 8px;
  margin-bottom: 0;
}
.search-bar input {
  flex-grow: 1;
}

.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }

/* Watchlist Layout */
.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-title-row h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
}
#watchlist-state-status {
  font-size: 0.65rem;
  color: var(--neon-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
}

.watchlist-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
}

.watchlist-item {
  background: var(--bg-glass);
  border: 1px solid var(--border-neon);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.suspended-card {
  opacity: 0.7;
  border-color: rgba(239, 68, 68, 0.2) !important;
}
.suspended-card:hover {
  opacity: 0.9;
}
.watchlist-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.watchlist-token-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}
.watchlist-token-title .symbol {
  color: var(--neon-cyan);
  margin-left: 5px;
}
.watchlist-pricing {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 0.75rem;
}
.watchlist-price-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(255, 255, 255, 0.01);
  padding: 8px;
  border-radius: 6px;
  font-size: 0.7rem;
}
.watchlist-price-stats .stat {
  display: flex;
  flex-direction: column;
}
.watchlist-price-stats .stat span:first-child {
  color: var(--text-dim);
  font-size: 0.6rem;
}
.watchlist-price-stats .stat span:last-child {
  font-weight: 700;
}
.watchlist-rules-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  padding-top: 6px;
}
.rule-pill {
  font-size: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-gray);
  border: 1px dashed rgba(255,255,255,0.08);
}

/* Manual scan report styles */
.scan-report {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.score-gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.score-gauge-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-deep);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}
.score-gauge-fill {
  height: 100%;
  background: var(--neon-purple);
  width: 0%;
  transition: width 0.8s ease;
}

.warning-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.warning-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(239, 68, 68, 0.05);
  border-left: 3px solid var(--neon-red);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  font-size: 0.75rem;
}
.warning-icon {
  color: var(--neon-red);
  font-weight: bold;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.75rem;
}
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

/* Weight Sliders */
.weight-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-gray);
}
.weight-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-deep);
  border-radius: 3px;
  outline: none;
}
.weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--neon-purple);
  cursor: pointer;
  box-shadow: 0 0 5px var(--neon-purple);
  transition: transform 0.1s;
}
.weight-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 6, 12, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-overlay.active {
  display: flex;
  opacity: 1;
}
.modal-content {
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), var(--shadow-glow);
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.active .modal-content {
  transform: scale(1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-neon);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-gray);
  font-size: 1.5rem;
  cursor: pointer;
}
.close-modal-btn:hover {
  color: var(--text-white);
}
.dialog-token-info {
  font-size: 0.85rem;
  color: var(--text-gray);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Notification */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}
.toast {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-neon-active);
  box-shadow: var(--shadow-glow);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-white);
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  max-width: 320px;
}
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive Scaling */
@media (max-width: 1100px) {
  .app-workspace {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .app-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  .system-status {
    width: 100%;
    justify-content: space-between;
  }
}

#feed-search:focus {
  border-color: var(--neon-purple) !important;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.25);
}
