/* Stockytron Terminal Stylesheet */

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --panel-bg: rgba(255, 255, 255, 0.85);
  --panel-border: rgba(15, 23, 42, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --accent-color: #0ea5e9;
  --accent-color-rgb: 14, 165, 233;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  --otter-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  
  --bullish-color: #0f766e;
  --bearish-color: #be123c;
  --warning-color: #b45309;
  --neutral-color: #64748b;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 10% 10%, rgba(14, 165, 233, 0.05) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(13, 148, 136, 0.05) 0px, transparent 50%),
    radial-gradient(at 50% 10%, rgba(124, 58, 237, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Glassmorphism Panel Utilities */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
  transition: var(--transition);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-lg);
}

/* Header */
.app-header {
  background: rgba(248, 250, 252, 0.8);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mascot-img-container {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid var(--accent-color);
  overflow: hidden;
  box-shadow: 0 0 15px rgba(0, 229, 160, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mascot-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-text h1 {
  font-size: 1.4rem;
  line-height: 1.2;
}

.logo-text .subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.header-stats {
  display: flex;
  gap: 24px;
}

.header-stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.header-stat-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-stat-card .value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}

.change-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

.change-badge.positive {
  background: rgba(16, 185, 129, 0.15);
  color: var(--bullish-color);
}

.change-badge.negative {
  background: rgba(239, 68, 68, 0.15);
  color: var(--bearish-color);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neutral-color);
}

.status-indicator .dot.open {
  background-color: var(--bullish-color);
  box-shadow: 0 0 8px var(--bullish-color);
}

.status-indicator .dot.pre {
  background-color: var(--warning-color);
  box-shadow: 0 0 8px var(--warning-color);
}

.status-indicator .dot.closed {
  background-color: var(--bearish-color);
  box-shadow: 0 0 8px var(--bearish-color);
}

.status-indicator .text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Main Layout */
.main-content {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.section-title {
  font-size: 1.35rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title .badge {
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 20px;
  color: var(--text-secondary);
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: -12px;
  margin-bottom: 20px;
  max-width: 800px;
}

/* Mascot Commentary Speech Bubble */
.commentary-section {
  display: flex;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(241, 245, 249, 0.6) 100%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.commentary-container {
  display: flex;
  width: 100%;
  padding: 24px;
  gap: 24px;
}

.commentary-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  width: 120px;
}

.avatar-large {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--accent-color);
  box-shadow: 0 0 20px rgba(0, 229, 160, 0.2);
  background: #e2e8f0;
}

.avatar-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--otter-gradient);
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.commentary-bubble {
  flex-grow: 1;
  position: relative;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.commentary-bubble::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 34px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 10px solid rgba(0, 0, 0, 0.02);
}

.bubble-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bubble-header h3 {
  font-size: 1.1rem;
  color: var(--accent-color);
}

.bubble-header .timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bubble-text {
  font-size: 1.05rem;
  color: var(--text-primary);
  font-style: italic;
  line-height: 1.6;
}

.spy-ticker {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
}

.spy-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.spy-val {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
}

.spy-pct {
  font-weight: 600;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 32px;
}

.stats-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.02);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  margin: 2px 0;
}

.stat-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.canvas-container {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.equity-canvas-container {
  height: 260px;
  margin-top: 16px;
}

/* Current Positions Section */
.positions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.position-row {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(241, 245, 249, 0.6) 100%);
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--accent-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.position-row:hover {
  transform: translateX(4px);
  border-color: rgba(0, 229, 160, 0.3);
  box-shadow: var(--shadow-sm);
}

.pos-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pos-ticker {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.pos-details {
  display: flex;
  flex-direction: column;
}

.pos-details .shares {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.pos-details .cost-basis {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pos-metrics {
  display: flex;
  gap: 24px;
  text-align: right;
}

.pos-val-area {
  display: flex;
  flex-direction: column;
}

.pos-val {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.pos-alloc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pos-pnl-area {
  display: flex;
  flex-direction: column;
  width: 90px;
}

.pos-pnl {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.pos-pnl-pct {
  font-size: 0.75rem;
  font-weight: 600;
}

.confidence-indicator {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
  color: var(--text-secondary);
}

.confidence-indicator span {
  font-weight: 700;
  color: var(--accent-color);
  margin-left: 4px;
}

/* Watchlist Grid */
.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.watchlist-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(241, 245, 249, 0.6) 100%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: var(--transition);
}

.watchlist-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-header .ticker-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
}

.card-header .price-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.card-header .price {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.card-header .regime {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.badge-row {
  display: flex;
  gap: 8px;
}

.badge-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-pill.bullish {
  background: rgba(16, 185, 129, 0.15);
  color: var(--bullish-color);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-pill.neutral {
  background: rgba(148, 163, 184, 0.15);
  color: var(--neutral-color);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-pill.bearish {
  background: rgba(239, 68, 68, 0.15);
  color: var(--bearish-color);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.xgb-conf-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.xgb-conf-bar .bar-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.xgb-conf-bar .bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.xgb-conf-bar .bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  width: 0%;
  transition: width 1s ease-out;
}

.card-thesis {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 6px;
  padding: 12px;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  font-style: italic;
  flex-grow: 1;
}

.card-parameters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
  padding-top: 12px;
  font-size: 0.8rem;
}

.card-parameters div {
  display: flex;
  flex-direction: column;
}

.card-parameters .label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.card-parameters .val {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--text-primary);
}

.card-structural-levels {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-secondary);
}

.level-row {
  display: flex;
  justify-content: space-between;
}

.level-row .level-name {
  color: var(--text-muted);
}

.level-row .level-val {
  font-family: monospace;
  font-weight: bold;
}

/* History and Ledger Grid */
.history-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 32px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.view-all-btn {
  font-size: 0.8rem;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid rgba(0, 229, 160, 0.2);
  padding: 4px 10px;
  border-radius: 4px;
  transition: var(--transition);
}

.view-all-btn:hover {
  background: rgba(0, 229, 160, 0.05);
  border-color: var(--accent-color);
}

.table-container {
  width: 100%;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.ledger-table th {
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  background: #f1f5f9;
  z-index: 10;
}

.ledger-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: top;
}

.ledger-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.015);
}

.ledger-table .timestamp-cell {
  white-space: nowrap;
  color: var(--text-muted);
}

.ledger-table .ticker-cell {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
}

.ledger-table .action-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
}

.ledger-table .action-badge.buy {
  background: rgba(16, 185, 129, 0.15);
  color: var(--bullish-color);
}

.ledger-table .action-badge.sell {
  background: rgba(239, 68, 68, 0.15);
  color: var(--bearish-color);
}

.ledger-table .reason-cell {
  color: var(--text-secondary);
  line-height: 1.4;
  min-width: 200px;
}

.chart-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stats-summary-footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 20px;
  margin-top: 20px;
}

.stat-footer-item {
  display: flex;
  flex-direction: column;
}

.stat-footer-item .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-footer-item .val {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

/* Colors and states */
.positive { color: var(--bullish-color) !important; }
.negative { color: var(--bearish-color) !important; }
.warning { color: var(--warning-color) !important; }

.loading-state {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 32px 0;
  grid-column: 1 / -1;
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
  font-size: 0.9rem;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--panel-border);
  background: rgba(241, 245, 249, 0.9);
  margin-top: 60px;
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  gap: 40px;
}

.footer-left {
  flex: 2;
}

.footer-right {
  flex: 1;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.disclaimer {
  line-height: 1.6;
}

.schedule-info {
  color: var(--text-secondary);
}

/* Responsiveness */
@media (max-width: 1024px) {
  .dashboard-grid, .history-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .header-stats {
    width: 100%;
    justify-content: space-between;
  }
  
  .commentary-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .commentary-avatar {
    width: 100%;
  }
  
  .commentary-bubble::before {
    display: none;
  }
  
  .footer-container {
    flex-direction: column;
    gap: 24px;
    text-align: left;
  }
  
  .footer-right {
    text-align: left;
  }
}
