/* 
  Stock Detail V2 - Yahoo Finance Inspired UI (Dark Theme Primary)
  Refined Proportions for Professional Financial UI
*/

:root {
  --y-bg: #000000; 
  --y-surface: #0f1216;
  --y-surface-light: #1b2228;
  --y-border: #21262d; 
  --y-text-primary: #ffffff;
  --y-text-secondary: #767d85;
  --y-accent: #0081f1;
  --y-up: #008a00;
  --y-up-bg: rgba(0, 138, 0, 0.1);
  --y-down: #ff3333;
  --y-down-bg: rgba(255, 51, 51, 0.1);
  --y-radius: 4px;
  --y-sidebar-width: 160px;
}

body {
  background-color: var(--y-bg);
  color: var(--y-text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
  font-size: 13px; /* Yahoo uses smaller base font */
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Layout Container */
.yahoo-detail-layout {
  display: flex;
  max-width: 1440px; /* Wider layout for 3 columns */
  margin: 0 auto;
  padding: 20px;
  gap: 30px;
}

/* LEFT NAVIGATION SIDEBAR */
.y-nav-sidebar {
  width: var(--y-sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  height: fit-content;
}

.y-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.y-nav-item a {
  display: block;
  padding: 6px 12px;
  color: var(--y-text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  border-radius: 4px;
  transition: all 0.15s;
}

.y-nav-item a:hover {
  color: var(--y-text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.y-nav-item.active a {
  color: var(--y-accent);
  font-weight: 700;
  background: rgba(0, 129, 241, 0.1);
}

/* CENTRAL CONTENT */
.y-main-column {
  flex-grow: 1;
  min-width: 0;
}

/* HEADER SECTION */
.y-stock-header {
  margin-bottom: 20px;
}

.y-symbol-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.y-symbol-line h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
}

.y-company-name {
  font-size: 14px;
  color: var(--y-text-secondary);
  margin-bottom: 12px;
}

.y-price-container {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.y-last-price {
  font-size: 36px;
  font-weight: 700;
}

.y-change-info {
  font-size: 20px;
  font-weight: 600;
}

.y-change-info.up { color: var(--y-up); }
.y-change-info.down { color: var(--y-down); }

.y-market-status {
  font-size: 11px;
  color: var(--y-text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

/* CHART BOX */
.y-chart-box {
  background: var(--y-surface);
  border: 1px solid var(--y-border);
  margin-bottom: 24px;
  padding-bottom: 10px;
}

/* SUMMARY STATS GRID */
.y-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-bottom: 24px;
}

.y-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--y-border);
}

.y-stat-row:nth-child(odd) {
  padding-right: 20px;
}
.y-stat-row:nth-child(even) {
  padding-left: 20px;
}

.y-stat-label {
  color: var(--y-text-secondary);
  font-size: 13px;
}

.y-stat-value {
  font-weight: 700;
  font-size: 13px;
  color: var(--y-text-primary);
}

/* CARDS */
.y-card {
  margin-bottom: 24px;
}

.y-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--y-border);
}

/* RIGHT SIDEBAR */
.y-right-sidebar {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  height: fit-content;
}

.y-widget {
  margin-bottom: 30px;
}

.y-widget-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--y-border);
  padding-bottom: 6px;
}

.y-ticker-list {
  display: flex;
  flex-direction: column;
}

.y-ticker-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-decoration: none !important;
}

.y-ticker-sym {
  font-weight: 700;
  color: var(--y-accent);
}

.y-ticker-price {
  font-weight: 700;
}

/* Live Pulse & Toolbar */
.y-chart-toolbar {
    display: flex;
    justify-content: flex-start;
    padding: 10px;
    gap: 5px;
}

.y-chart-toolbar .btn {
    font-size: 11px;
    font-weight: 700;
    color: var(--y-text-secondary) !important;
    background: transparent !important;
    padding: 2px 8px;
    border: none !important;
}

.y-chart-toolbar .btn.active {
    color: var(--y-text-primary) !important;
    background: rgba(255,255,255,0.1) !important;
    border-radius: 2px;
}

.pulse-icon {
    width: 6px;
    height: 6px;
    background-color: #00c805;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 200, 5, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(0, 200, 5, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 200, 5, 0); }
}

@media (max-width: 1024px) {
    .y-right-sidebar { display: none; }
}

@media (max-width: 768px) {
  .y-nav-sidebar { display: none; }
  .yahoo-detail-layout { padding: 10px; }
  .y-stats-grid { grid-template-columns: 1fr; }
  .y-stat-row:nth-child(even) { padding-left: 0; }
  .y-stat-row:nth-child(odd) { padding-right: 0; }
}

/* SUB-NAV TABS (Yahoo Style) */
.y-sub-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--y-border);
  margin-bottom: 24px;
}

.y-sub-tabs a {
  padding: 8px 12px;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 600;
  color: var(--y-text-secondary);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.y-sub-tabs a.active {
  color: var(--y-text-primary);
  border-bottom-color: var(--y-accent);
}

.y-sub-tabs a:hover:not(.active) {
  color: var(--y-text-primary);
}

/* HISTORICAL DATA TABLE */
.y-history-table {
  width: 100%;
  border-collapse: collapse;
}

.y-history-table th {
  text-align: right;
  padding: 12px 10px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--y-text-secondary);
  border-bottom: 1px solid var(--y-border);
  font-weight: 600;
}

.y-history-table th:first-child,
.y-history-table td:first-child {
  text-align: left;
}

.y-history-table td {
  text-align: right;
  padding: 12px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--y-border);
  color: var(--y-text-primary);
}

.y-history-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.y-history-table .font-weight-bold {
  font-weight: 700;
}

/* MARKET PAGE SPECIFIC */
.y-market-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.y-index-card {
  background: var(--y-surface);
  border: 1px solid var(--y-border);
  border-radius: var(--y-radius);
  padding: 16px;
}

.y-index-table {
  width: 100%;
  font-size: 13px;
}

.y-index-table td {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.y-index-name {
  font-weight: 600;
  color: var(--y-text-primary);
}

.y-index-price {
  text-align: right;
  font-weight: 700;
}

.y-index-change {
  text-align: right;
  width: 80px;
}

/* Trending Cards */
.y-trending-row {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  padding-bottom: 15px;
  margin-bottom: 30px;
}

.y-trending-card {
  min-width: 200px;
  background: var(--y-surface);
  border: 1px solid var(--y-border);
  border-radius: var(--y-radius);
  padding: 15px;
  text-decoration: none !important;
}

.y-trending-card:hover {
  border-color: var(--y-accent);
}

/* Heatmap Placeholder */
.y-sector-heatmap {
  height: 300px;
  border-radius: var(--y-radius);
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
}

.y-heatmap-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(0,0,0,0.2);
  transition: opacity 0.2s;
}

.y-heatmap-item:hover {
  opacity: 0.8;
}

.y-market-banner {
  background: linear-gradient(90deg, #12171c 0%, #000 100%);
  padding: 40px;
  border-radius: 8px;
  margin-bottom: 30px;
  border: 1px solid var(--y-border);
}

/* PIXEL PERFECT YAHOO REFINEMENTS */
.y-ticker-tape {
  height: 44px;
  background: #000;
  border-bottom: 1px solid var(--y-border);
  display: flex;
  align-items: center;
}

.y-ticker-item-mini {
  padding: 0 20px;
  border-right: 1px solid var(--y-border);
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
}

.y-ticker-item-mini .sparkline {
  width: 50px;
  height: 24px;
}

/* TREEMAP (Sectors) */
.y-sector-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
  margin-bottom: 30px;
}

.y-treemap-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 80px;
  gap: 4px;
}

.y-tree-node {
  padding: 8px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.y-tree-node.large { grid-column: span 2; grid-row: span 2; font-size: 14px; }
.y-tree-node.med { grid-column: span 1; grid-row: span 2; }

/* SECTOR LIST (Left side) */
.y-sector-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--y-border);
}

.y-sector-label { flex: 1; font-weight: 600; font-size: 13px; }
.y-sector-bar-bg { width: 100px; height: 18px; background: rgba(255,255,255,0.05); border-radius: 2px; overflow: hidden; position: relative; }
.y-sector-bar { height: 100%; }

/* STATS TABLE HEADERS */
.y-index-table thead th {
  font-size: 11px;
  color: var(--y-text-secondary);
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--y-border);
}

.y-index-table td {
  border-bottom: 1px solid #1a1e23;
}

/* TRENDING CARDS REFINED */
.y-trending-card {
  min-width: 220px;
  background: var(--y-surface);
  border: 1px solid var(--y-border);
  padding: 16px;
  transition: transform 0.2s, border-color 0.2s;
}

.y-trending-card:hover {
  transform: translateY(-2px);
  border-color: #444c56;
}

.y-trending-card .spark-mini {
  height: 40px;
  margin: 10px 0;
}
