/* Stocks App - P/E Focused Terminal UI */
.stocks-app-full {
  height: 100%;
  background-color: #0d0d0d;
  color: #b0b0b0;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 1rem;
  overflow-y: auto;
}

/* Header */
.tui-header {
  border-bottom: 1px solid #333;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.tui-title {
  color: #f5f5f5;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.tui-subtitle {
  color: #666;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Add Ticker Section */
.tui-add-section {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.tui-add-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

/* Consistent input and button heights */
.tui-add-form input,
.tui-add-form button,
.tui-add-form input[type="submit"] {
  height: 36px;
  box-sizing: border-box;
}

.tui-ticker-input,
.tui-input.tui-ticker-input {
  width: 140px;
  padding: 0 0.75rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  color: #fbbf24;
  font-family: inherit;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.tui-ticker-input:focus {
  outline: none;
  border-color: #22d3ee;
}

/* Style the datalist dropdown */
.tui-ticker-input::-webkit-calendar-picker-indicator {
  display: none;
}

.tui-btn-add,
.tui-btn.tui-btn-add {
  padding: 0 1rem;
  background: #1a3a1a;
  border: 1px solid #22c55e;
  border-radius: 4px;
  color: #22c55e;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.tui-btn-add:hover {
  background: #22c55e;
  color: #000;
}

.tui-refresh-btn,
.tui-btn.tui-refresh-btn {
  width: 36px;
  padding: 0;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  color: #888;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tui-refresh-btn:hover {
  background: #2a2a2a;
  color: #22d3ee;
  border-color: #22d3ee;
}

/* Stock Card */
.tui-stock-card {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

/* Card Header */
.tui-stock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #2a2a2a;
  background: #0f0f0f;
}

.tui-stock-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.tui-ticker {
  color: #fbbf24;
  font-weight: 700;
  font-size: 1.1rem;
}

.tui-company-name {
  color: #777;
  font-size: 0.85rem;
}

.tui-stock-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.tui-price-badge {
  color: #22c55e;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 3px;
}

.tui-mktcap-badge {
  color: #888;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 3px;
}

.tui-action-btn {
  padding: 0.25rem 0.5rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 3px;
  color: #888;
  font-family: inherit;
  font-size: 0.75rem;
  text-decoration: none;
  cursor: pointer;
}

.tui-action-btn:hover {
  background: #2a2a2a;
  color: #fff;
}

.tui-action-btn--danger:hover {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #ef4444;
}

/* P/E Content - Two Column Layout */
.tui-pe-content {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, #0d0d0d 0%, #111 100%);
}

.tui-pe-left {
  flex: 0 0 auto;
  min-width: 280px;
  max-width: 320px;
}

.tui-pe-right {
  flex: 1;
  min-width: 0;
}

.tui-pe-hero-compact {
  margin-bottom: 0.5rem;
}

.tui-pe-value {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.tui-pe-label {
  color: #666;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tui-pe-number {
  color: #22d3ee;
  font-size: 2rem;
  font-weight: 700;
}

/* Percentile Bar */
.tui-pe-percentile {
  max-width: 300px;
}

.tui-percentile-bar {
  position: relative;
  height: 8px;
  background: linear-gradient(90deg, #166534 0%, #14532d 20%, #1a1a1a 20%, #1a1a1a 80%, #7f1d1d 80%, #991b1b 100%);
  border-radius: 4px;
  margin-bottom: 0.4rem;
}

.tui-percentile-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: transparent;
  border-radius: 4px;
}

.tui-percentile-marker {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 14px;
  background: #22d3ee;
  border-radius: 2px;
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.5);
}

.tui-percentile-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
}

.tui-percentile-low {
  color: #22c55e;
}

.tui-percentile-high {
  color: #ef4444;
}

.tui-percentile-text {
  color: #888;
}

.tui-signal-strong {
  color: #22c55e;
  font-weight: 600;
}

.tui-signal-good {
  color: #4ade80;
}

.tui-signal-warn {
  color: #ef4444;
  font-weight: 600;
}

.tui-signal-caution {
  color: #f97316;
}

.tui-signal-neutral {
  color: #888;
}

/* P/E Trend Inline */
.tui-pe-trend-inline {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.tui-trend-item {
  color: #888;
}

.tui-trend-item.tui-down {
  color: #22c55e;
}

.tui-trend-item.tui-up {
  color: #ef4444;
}

/* Decomposition Compact */
.tui-decomposition-compact {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.tui-decomp-title {
  color: #666;
  margin-right: 0.5rem;
}

.tui-decomp-inline {
  display: inline-flex;
  gap: 0.75rem;
}

.tui-earnings-up {
  color: #22c55e;
}

.tui-earnings-down {
  color: #ef4444;
}

.tui-price-down {
  color: #4ade80;
}

.tui-price-up {
  color: #f97316;
}

/* P/E Chart */
.tui-pe-chart-container {
  width: 100%;
  height: 100%;
  min-height: 100px;
}

.tui-pe-svg-chart {
  width: 100%;
  height: 100%;
  min-height: 100px;
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
}

.tui-pe-line {
  fill: none;
  stroke: #22d3ee;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tui-pe-current-marker {
  fill: #22d3ee;
  stroke: #0d0d0d;
  stroke-width: 2;
}

.tui-pe-current-label {
  fill: #22d3ee;
  font-size: 10px;
  font-weight: 600;
}

.tui-chart-label {
  fill: #555;
  font-size: 9px;
}

.tui-chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  color: #444;
  font-size: 0.8rem;
}

/* Signal Inline */
.tui-signal-inline {
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  font-size: 0.8rem;
  display: inline-block;
}

.tui-signal-strong_buy {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
  color: #22c55e;
}

.tui-signal-buy {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid #4ade80;
  color: #4ade80;
}

.tui-signal-caution_buy {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid #fbbf24;
  color: #fbbf24;
}

.tui-signal-wait {
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid #f97316;
  color: #f97316;
}

/* No P/E State */
.tui-no-pe {
  padding: 1.5rem;
  text-align: center;
  color: #666;
}

.tui-no-pe-note {
  font-size: 0.8rem;
  color: #555;
  margin-top: 0.5rem;
}

.tui-price-only {
  margin-top: 1rem;
  color: #888;
}

/* Footer */
.tui-stock-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #0a0a0a;
  border-top: 1px solid #2a2a2a;
  font-size: 0.75rem;
  color: #555;
}

.tui-footer-item {
  margin-right: 1rem;
}

.tui-footer-date {
  margin-left: auto;
}

/* AI Explanation Section */
.tui-ai-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #2a2a2a;
}

.tui-explain-btn {
  padding: 0.4rem 0.75rem;
  background: #1a1a2e;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  color: #a0a0c0;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tui-explain-btn:hover:not(:disabled) {
  background: #2a2a4e;
  border-color: #6a6a9a;
  color: #c0c0e0;
}

.tui-explain-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.tui-ai-response {
  margin-top: 0.5rem;
}

.tui-ai-text {
  padding: 0.75rem;
  background: #0f0f1a;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  color: #c0c0d0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.tui-ai-loading {
  padding: 0.5rem 0.75rem;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid #0e7490;
  border-radius: 4px;
  color: #22d3ee;
  font-size: 0.8rem;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.tui-ai-error {
  padding: 0.5rem 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #7f1d1d;
  border-radius: 4px;
  color: #ef4444;
  font-size: 0.8rem;
}

/* Empty State */
.tui-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}

.tui-empty-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.tui-empty-text {
  font-size: 0.9rem;
}
