/* ==========================================================================
   star.460001.xyz - A-Share Morningstar Moat Query System
   Graphite Slate Theme (High Density, Pure Dark Aesthetic)
   ========================================================================== */

:root {
  --bg-main: #0c0f14;
  --bg-card: #141922;
  --bg-card-hover: #19202c;
  --bg-input: #0f131a;
  --border-card: #232c3b;
  --border-subtle: #1c2330;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-gold: #f59e0b;
  --accent-gold-bg: rgba(245, 158, 11, 0.1);
  --accent-emerald: #10b981;
  --accent-emerald-bg: rgba(16, 185, 129, 0.1);
  --accent-rose: #f43f5e;
  --accent-rose-bg: rgba(244, 63, 94, 0.1);
  --accent-cyan: #06b6d4;
  --accent-cyan-bg: rgba(6, 182, 212, 0.1);
  --accent-blue: #3b82f6;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
}

.nav-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.nav-title span {
  color: var(--accent-gold);
  font-weight: 600;
  font-size: 16px;
}

.nav-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.domain-tag {
  color: var(--accent-cyan);
  font-weight: 600;
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.update-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
}

.btn-refresh {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-refresh:hover {
  background: var(--bg-card-hover);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Search Hero Section */
.search-hero-section {
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(20, 25, 34, 0.6) 100%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.search-input-wrapper {
  display: flex;
  width: 100%;
  max-width: 760px;
  gap: 12px;
}

.search-input-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 14px 44px 14px 48px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
}

.search-input-box input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
  background: #111620;
}

.clear-query {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: none;
}

.btn-search-action {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, #0284c7 100%);
  color: #041019;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 24px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-search-action:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

/* Empty State Card */
.empty-state-card {
  background: var(--bg-card);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state-card h3 {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-state-card p {
  font-size: 13px;
  line-height: 1.7;
  max-width: 680px;
  margin: 0 auto;
  color: var(--text-muted);
}

/* Detailed Moat Result Card */
.result-card-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s ease-in-out;
}

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

.result-top-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 14px;
}

.result-title-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.result-ticker-tag {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 20px;
  color: var(--accent-cyan);
  background: var(--accent-cyan-bg);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.result-company-title h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.result-company-title p {
  font-size: 12px;
  color: var(--text-muted);
}

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

.btn-copy-share {
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-copy-share:hover {
  background: var(--bg-card-hover);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Layer Boxes */
.layer-box {
  background: #0f131a;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.layer-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.layer-box-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.layer-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
}

/* Grid Metrics */
.grid-metrics-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 768px) {
  .grid-metrics-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sub-metric {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
}

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

.s-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

/* 5 Pillars Bars */
.pillars-bars-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.pillar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.pillar-name {
  width: 120px;
  color: var(--text-secondary);
  font-weight: 500;
}

.pillar-bar-bg {
  flex: 1;
  height: 6px;
  background: #1e2634;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.pillar-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-gold));
  border-radius: var(--radius-full);
}

.pillar-score-text {
  width: 35px;
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

/* Anti-fragility Quadrants */
.anti-quadrants-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 640px) {
  .anti-quadrants-grid {
    grid-template-columns: 1fr;
  }
}

.quadrant-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quadrant-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quadrant-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.quadrant-score {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
}

.quadrant-reason {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Callout Box */
.llm-callout {
  background: rgba(6, 182, 212, 0.05);
  border-left: 3px solid var(--accent-cyan);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Colors & Accents */
.text-gold { color: var(--accent-gold) !important; }
.text-emerald { color: var(--accent-emerald) !important; }
.text-rose { color: var(--accent-rose) !important; }
.text-cyan { color: var(--accent-cyan) !important; }
.text-blue { color: var(--accent-blue) !important; }

/* Collapsible Pool Section */
.pool-overview-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 14px 20px;
}

.pool-overview-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.pool-overview-section .section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pool-overview-section .section-title h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.pool-toggle-btn {
  font-size: 12px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.pool-item-card {
  background: #0f131a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s;
}

.pool-item-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
}

.pool-item-t {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-cyan);
}

.pool-item-n {
  font-size: 11px;
  color: var(--text-secondary);
}

.pool-item-p {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

/* Footer */
.app-footer {
  margin-top: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.footer-schedule {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  padding: 6px 18px;
  border-radius: var(--radius-full);
}

.footer-schedule strong {
  color: var(--accent-cyan);
}

.footer-links {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent-cyan);
}

.footer-divider {
  color: var(--border-card);
}

.footer-note {
  max-width: 800px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
}
