/* ==========================================
   CSS Variables
========================================== */
:root {
  /* Layout & Spacing */
  --page-top-spacing: 12px;
  --top-header-height: 100px;
  --logo-width: 200px;
  --logo-padding-left: 0px;
  --header-strip-width: 1180px;  
  --content-width: 1200px;  
  --footer-depth: 40px;

  /* Colors - Backgrounds */
  --page-background-color: #e6f0fa;
  --top-header-bg: #ffffff;
  --header-row-bg-color: #001f3f;
  --footer-bg-color: #002f5f;

  /* Colors - Text */
  --header-text-color: #ffffff;
  --ticker-text-color: #0772bf;
  --footer-text-color: #ffffff;
  --footer-muted-text-color: #cccccc;

  /* Colors - Indicators */
  --percent-positive-color: #2ecc71;
  --percent-negative-color: #e74c3c;

  /* Typography */
  --base-font-size: 12px;
}

/* ==========================================
   Base Styles
========================================== */
body {
  font-family: Arial, sans-serif;
  font-size: var(--base-font-size);
  margin: 0;
  padding: 0;
  background-color: var(--page-background-color);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  /*display: flex; See if this restores horizonatl scrolling*/
  flex-direction: column;
}

/* ==========================================
   Container to align table and header
========================================== */
.page-container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 20px;
  margin-top: calc(var(--top-header-height) + var(--page-top-spacing));
  flex: 1 0 auto; /* This lets it expand */
  min-height: 1000px; /* 👈 Ensure minimum vertical space */
}

/* ==========================================
   Top Header Strip
========================================== */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  background-color: var(--top-header-bg);
  height: var(--top-header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  padding: 0 20px 0 0px;
  border-top: 0 solid black;
}

.top-header-inner {
  max-width: var(--content-width);
  width: 100%;
  display: flex;
  align-items: center;
  padding-left: var(--logo-padding-left);
  justify-content: space-between
}

.top-header-site-logo {
  max-width: var(--logo-width);
  height: auto;
}

/* ==========================================
   Table Core Styles
========================================== */
table {
  border-collapse: collapse;
}

/* ==========================================
   Table Wrapper
========================================== */
.table-wrapper {
  border: 1cm solid #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: auto;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  background-color: white;
}

/* Base table cell styling */
th, td {
  border: 1px 0px solid #ddd;
  padding: 8px;
  text-align: left;
}

td:nth-child(2),
th:nth-child(2) {
  padding-left: 16px; /* or a higher value if needed */
}

/* Header cell styling */
th {
  background-color: #003366;
  color: white;
  font-weight: bold;
}


tr:nth-child(even) {
  background-color: #edf4fa;
}

tr td:first-child{
  border: 0px 0px solid #ddd;  
  position: sticky;
  left:0;
  z-index: 100;
  filter: drop-shadow(3px 0px 1px rgba(100, 100, 100, 0.8));
}

tr th:first-child{
  border: 0px 0px solid #ddd;  
  position: sticky;
  left:0;
  z-index: 100;
  filter: drop-shadow(3px 0px 1px rgba(100, 100, 100, 0.8));
}

tbody tr:nth-child(even) td:first-child {
  background-color: #edf4fa;
}


tbody tr:nth-child(odd) td:first-child {
  background-color: #ffffff;
}


/* Sortable columns */
th.sortable {
  position: relative;
  padding-right: 25px;
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  filter: brightness(1.1);
}

th.sortable::after {
  content: "↕";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.5;
}

th.sortable.asc::after {
  content: "↑";
  opacity: 1;
}

th.sortable.desc::after {
  content: "↓";
  opacity: 1;
}

/* ========================================
   Table Minimum Column Widths
======================================== */
  th:nth-child(1), td:nth-child(1) { min-width: 40px; }   /* Code */
  th:nth-child(2), td:nth-child(2) { min-width: 200px; }   /* Company */
  th:nth-child(3), td:nth-child(3) { min-width: 40px; }   /* Price */
  th:nth-child(4), td:nth-child(4) { min-width: 40px; }   /* % Chg */
  th:nth-child(5), td:nth-child(5) { min-width: 40px; }   /* Sector */
  th:nth-child(6), td:nth-child(6) { min-width: 50px; }   /* Mkt Cap */
  th:nth-child(7), td:nth-child(7) { min-width: 40px; }   /* Volume */
  th:nth-child(8), td:nth-child(8) {
  min-width: 300px;
  width: 100%;
  white-space: normal; /* Allow wrapping in Analysis */
}

/* ==========================================
   % Change Color
========================================== */
span.negative {
  color: var(--percent-negative-color);
  font-weight: bold;
}

/* ==========================================
   % Introduction Text
========================================== */
.site-intro {
  margin-bottom: 30px;
  padding: 16px 20px 8px 20px; /* top, right, bottom, left */
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

.site-intro h2 {
  margin-top: 0;
  margin-bottom: -5px; /* smaller gap after heading */
  font-size: 18px;
  color: var(--header-row-bg-color);
}

.site-intro p {
  margin-bottom: 12px;
}

/* ==========================================
   % Footer
========================================== */
.site-footer {
    background-color: var(--footer-bg-color);
    padding: 20px 40px;
    font-size: 14px;
    text-align: center;
    color: var(--footer-muted-text-color);
    border-top: 1px solid #ccc;
    line-height: 1.6;
    flex-shrink: 0; /* Prevents shrinking */
}

.site-footer .footer-inner {
    max-width: var(--content-width);
    margin: 0 auto;
}

.site-footer p {
    margin-bottom: 10px;
    color: var(--footer-muted-text-color);
}

.contact-email {
    color: var(--footer-muted-text-color);
    font-weight: normal;
    margin-bottom: 10px;
}

.site-footer .copyright {
    margin-top: 10px;
    font-size: 13px;
    color: var(--footer-muted-text-color);
}

/* Button group on the right */
.buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button.view-btn {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: #fff;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 123, 255, 0.4);
}

button.view-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.6);
}

button.view-btn {
  font-size: 0.95rem;
  padding: 10px 16px;
}

button.view-btn.active {
  background: #003f7f;
}

.sector-buttons-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.sector-btn {
  padding: 6px 12px;
  background-color: #Dbebfb;
  border: 1px solid #b7e0f9;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s;
  color: #0c5d8f;
}

.sector-btn:hover,
.sector-btn.active {
  background-color: #ecf7fd;
  border-color: #ccc;
  color: #74c3f3;
}

.sector-button-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}

.sector-btn.active {
  background-color: #ceddee;
  color: white;
}

/* Responsive: Hide sector filters on narrow screens */
@media (max-width: 1100px) {
  .sector-button-group {
    display: none;
  }
}

/* Target all cells in even/odd rows */
tr.even td {
  background-color: #edf4fa !important;
}

tr.odd td {
  background-color: #ffffff !important;
}

/* Explicitly override sticky first column too */
tr.even td:first-child {
  background-color: #edf4fa !important;
}

tr.odd td:first-child {
  background-color: #ffffff !important;
}

