body:has(.stock-page) {
  overflow-y: auto !important;
  /* Page scroll if needed */
  height: auto !important;
}

body:has(.stock-page) .main-body,
body:has(.stock-page) .main-body-content {
  height: auto !important;
  max-height: 1600px !important;
  /* Cap here */
  overflow-y: auto !important;
}

/* body:has(.stock-page) {
  overflow-y: auto !important;
  /* Enable scroll */
height: auto !important;
/* Unconstrain */
}

body:has(.stock-page) .main-body-content {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

*/ .stock-page {

  margin: 10px;
  width: 100%;
  /* Full main-body-content */
  max-height: 1520px;
  /* Override base constraint */
  max-width: 800px;
}

.stock-header-top {
  margin-top: 10px;
  color: antiquewhite;
}

.stock-header-symbol {
  position: relative;
  top: -8px;
  font-size: 17px;
}

.stock-header-hr {
  border: none;
  /* remove default border */
  height: 2px;
  /* thickness */
  background-color: #2a2e39;
  position: relative;
  top: -4px;
  margin-bottom: 16px;
}

.stock-price {
  font-size: 28px;
  font-weight: 900;
  margin-right: 8px;
}

.stock-price-change {
  background: transparent !important;
  transition: background-color 0.3s ease, transform 0.3s ease;
  font-size: 18px;
  font-weight: 900;
}

.flash-green {
  animation: priceFlash 1s ease-out forwards !important;
  background-color: #4caf50 !important;
  /* Solid green */
  color: white !important;
}

.flash-red {
  animation: priceFlash 1s ease-out forwards !important;
  background-color: #f44336 !important;
  /* Solid red */
  color: white !important;
}

@keyframes priceFlash {
  0% {
    background-color: #4caf50 !important;
    /* Start solid */
    transform: scale(1.02);
  }

  100% {
    background-color: transparent !important;
    transform: scale(1);
  }
}

.stock-price-change {
  transition: all 0.3s ease;
}

.stock-chart {
  flex-grow: 2;
  margin-top: 14px;
  border: 2px solid #2a2e39;
  padding: 8px;
  min-height: 500px;
  max-height: 700px;
}

#tradingview_chart {
  width: 100% !important;
  height: 100% !important;
  /* Chart fills container */
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  /* spacing between items */
  margin-top: 40px;
  flex-grow: 1;
  /* 1/3 space */
  max-height: 600px;
  margin-bottom: 40px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  /* pushes spans apart */
  align-items: center;
  width: 100%;
}

.stats-row span:first-child {
  text-align: left;
}

.stats-row span:last-child {
  text-align: right;
  font-weight: bold;
}

.stats-item hr {
  margin: 6px 0;
  border: 1px dashed #2a2e39;
}

.company-card {
  border: 1px solid #2a2e39;
  border-radius: 8px;
  background: #0d141c;
  margin-top: 20px;
  overflow: hidden;
  max-height: 600px;
}

/* Header */
.company-header {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px;
  text-align: left;
  color: #e6e6e6;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  max-height: 600px;
}

.company-header:hover {
  background: #131c26;
}

.arrow {
  transition: transform 0.3s ease;
}

/* Content */
.company-content {
  display: none;
  padding: 20px;
  border-top: 1px solid #2a2e39;
}

.company-content.active {
  display: flex;
  justify-content: space-between;
  gap: 40px;
}

/* Left Side */
.company-left {
  flex: 2;
}

.company-left h3 {
  color: #6bbcff;
  margin-bottom: 16px;
}

.company-left p {
  line-height: 1.6;
  color: #c9d1d9;
}

.website a {
  color: #6bbcff;
  text-decoration: none;
}

.more-btn {
  margin-top: 16px;
  padding: 10px 18px;
  border-radius: 25px;
  background: #1a2330;
  border: 1px solid #2a2e39;
  color: #e6e6e6;
  cursor: pointer;
}

/* Right Side */
.company-right {
  flex: 1;
  display: grid;
  gap: 20px;
}

.fact strong {
  display: block;
  font-size: 20px;
  color: #ffffff;
}

.fact span {
  color: #9aa4b2;
  font-size: 14px;
}