html {
  scroll-behavior: smooth;
}
html, body {
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: rgb(20, 20, 20);
  color: rgb(10, 10, 10);
}

.link-button,
.link-button:visited {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 10px;
  background-color: rgb(48, 148, 255);
  color: rgb(218, 218, 218) !important;
  text-decoration: none !important;
  font: inherit;
  cursor: pointer;
  margin-bottom: 10px;
}
.link-button:hover {
  background-color: rgb(20, 20, 20);
}
.link-button:active {
  background-color: rgb(48, 148, 255);
}

/* Fixed top bar with title, search, and categories */
.top-bar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: rgb(20, 20, 20);
  border-bottom: 2px solid rgb(48, 148, 255);
  z-index: 1000;
}

.top-bar .header-container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 clamp(30px, 5vw, 50px);
  padding-top: 10px;
  box-sizing: border-box;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  line-height: 1;
  padding: clamp(8px, 1.5vw, 12px) 0 clamp(4px, 1vw, 6px) 0;
  padding-bottom: 0;
}

@font-face {
  font-family: 'Header';
  src: url('FuturisticText.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

.header-top h1 {
  margin: 0;
  font-family: 'Header', sans-serif;
  font-size: clamp(16px, 3vw, 32px);
  font-weight: 600;
  letter-spacing: 2px;
  color: rgb(218, 218, 218);
}

.search-box {
  position: relative;
  width: clamp(200px, 40%, 60vw);
  max-width: 500px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px clamp(32px, 5vw, 40px);
  border: 2px solid rgb(45, 45, 47);
  border-radius: 10px;
  font-size: 16px !important;
  box-sizing: border-box;
  background-color: rgb(20, 20, 20);
  color: rgb(218, 218, 218);
}

.search-icon {
  filter: invert(1) brightness(22%);
}

input:focus {
  outline: none;
  box-shadow: none;
}

.search-box img.search-icon {
  position: absolute;
  top: 50%;
  left: clamp(8px, 2vw, 10px);
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.categories-nav {
  position: relative;
  display: flex;
  overflow-x: auto;
  padding: 0;
  gap: 0;
  box-sizing: border-box;
}

.categories-wrapper {
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
}
.categories-wrapper .categories-nav {
  display: flex;
  overflow-x: auto;
  padding: 0;
  gap: 0;
  box-sizing: border-box;
}
.categories-wrapper::before,
.categories-wrapper::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1;
}
.categories-wrapper::before {
  left: 0;
  width: 15px;
  background: linear-gradient(to right, rgb(20, 20, 20) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
}
.categories-wrapper::after {
  right: 0;
  width: 40px;
  background: linear-gradient(to left, rgb(20, 20, 20) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
}
.categories-wrapper.scrolled:not(.at-start)::before {
  opacity: 1;
}
.categories-wrapper:not(.at-end)::after {
  opacity: 1;
}

.categories-nav::-webkit-scrollbar {
  display: none;
}

.categories-nav button {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: clamp(6px, 1.5vw, 12px) clamp(8px, 2vw, 16px);
  font-size: clamp(12px, 2.5vw, 18px);
  cursor: pointer;
  white-space: nowrap;
  color: rgb(218, 218, 218);
  background-color: rgb(45, 45, 47);
  border: none;
  border-radius: 10px;
  margin: 0 clamp(6px, 1vw, 10px); 

}

.categories-nav button.selected {
  background-color: rgb(48, 148, 255);
}
.categories-nav button:first-child {
  margin-left: 0;
}
.categories-nav button:last-child {
  margin-right: 0;
}

/* Main content area shifts below fixed top-bar */
main {
  max-width: 1500px;
  margin: 0 auto;
  padding-top: calc(clamp(10px, 2vw, 20px) + clamp(36px, 4vw, 48px) + clamp(30px, 4vw, 40px) + 45px);
  box-sizing: border-box;
}

/* Responsive cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  justify-content: center;
  gap: 20px;
  padding: 0 clamp(30px, 5vw, 40px);
  box-sizing: border-box;
  margin: 0;
  list-style: none;
  margin-top: 10px;
  margin-bottom: 15px;
}

.card {
  background-color: rgb(45, 45, 47);
  border-radius: 10px;
  box-shadow: 0  0 12px 2px rgba(45, 45, 47, 0.3);
  height: auto;
  padding-top: 0;
  position: relative;
  transition: transform 0.2s, background-color 0.2s;
  cursor: pointer;
}

.card:hover {
  background-color: rgb(10, 10, 10);
}
.card:active {
  transform: translateY(-2px);
  background-color: rgb(45, 45, 47);
}

.card-content {
  position: static;
  width: auto;
  height: auto;
  padding: 15px;
  box-sizing: border-box;
  overflow-y: hidden;
  overscroll-behavior: contain;
  display: block;
}
.information {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  gap: 10px;
  grid-template-areas:
    "details visual";
  row-gap: 10px;
}
.information .visual {
  justify-self: center;
  align-self: center;;
}

/* hide the one you’re not using */
.card .visual { display: none; }
.card.mode-prediction .visual.prediction { display: flex; }
.card.mode-countdown  .visual.countdown  { display: flex; }


/* 1) lay out logo + text side by side */
.header-row {
  grid-area: header;
  justify-content: header;
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

/* 2) give the logo some breathing room */
.header-row .logo img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  margin-right: 0.75rem;
}

/* 3) stack the name/ticker vertically */
.header-row .header {
  display: flex;
  flex-direction: column;
}

/* 4) tweak text */
.header-row .company {
  margin: 0;
  color: rgb(218, 218, 218);
  font-size: 1.1rem;
  line-height: 1.2;
}

.header-row .ticker {
  color: rgb(190, 190, 190);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* common .visual styles */
.visual {
  grid-area: visual;
  align-self: center;
  justify-self: center;
  justify-content: center;
  align-items: center;
}
/* gauge sizing */
.visual.prediction {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 95px;
  height: 47.5px;
  background-color: rgb(48, 148, 255);
  border-radius: 10px;
  padding: 12px 8px 24px;
}
.visual.prediction .percent {
  position: absolute;
  left: 50%;
  top: 65%;
  transform: translate(-50%, -50%);
  font-size: 1.175rem;
  pointer-events: none;
  color: rgb(218, 218, 218);
}

.gauge {
  width: 95px;
  height: 47.5px;
  overflow: visible;
  color: rgb(218, 218, 218);
}
.gauge .bg {
  stroke: rgb(218, 218, 218);
  stroke-width: 7;
  stroke-linecap: round;
}
.gauge .fg.green {
  stroke: #10b981;
  stroke-width: 7;
  stroke-linecap: round;
}
.gauge .fg.yellow {
  stroke: #facc15;
  stroke-width: 7;
  stroke-linecap: round;
}
.gauge .fg.red {
  stroke: #ef4444;
  stroke-width: 7;
  stroke-linecap: round;
}

/* countdown sizing */
.visual.countdown {
  flex-direction: column;
  background: rgb(48, 148, 255);
  color: rgb(218, 218, 218);
  border-radius: 10px;
  padding: 12px 16px;
}
.visual.countdown .count {
  font-size: 2rem;
  line-height: 1;
  padding-bottom: 2px;
  color: rgb(218, 218, 218);
}
.visual.countdown .until {
  font-size: 0.8rem;
  color: rgb(218, 218, 218);
  white-space: nowrap;
}
.visual.countdown .days {
  font-size: 1.2rem;
  color: rgb(218, 218, 218);
}
.visual.countdown .count-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Stack company and ticker vertically, with no gap */
.card .header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.card .header .company,
.card .header .ticker {
  margin: 0;
  padding: 0;
}

/* Keep extra breathing room below ticker */
.card .details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: clamp(12px, 3vw, 20px);
}
.card .details .info {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgb(30, 30, 30);
  padding: 4px 10px;
  border-radius: 10px;
  white-space: nowrap;
  font-size: clamp(12px, calc(20px - 1vw), 16px);
}
.card .details .label {
  font-weight: 600;
  color: rgb(218, 218, 218);
}
.card .details .value {
  color: rgb(190, 190, 190);
}
.card .details .info {
  height: 32px;
}

.card-content .logo img {
  width: 55px;
  height: 55px;
  object-fit: contain;
  box-sizing: border-box;
  padding: 5px;
  border-radius: 10px;
  background-color: rgb(218, 218, 218);
  box-shadow: 0 0 3px rgba(218,218,218,0.3);
}

/* search dropdown panel attached to the search box */
.search-container {
  position: relative;
  width: clamp(200px, 40%, 60vw);
  max-width: 500px;
  margin-bottom: 1rem;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background: rgb(20, 20, 20);
  border: 2px solid rgb(45, 45, 47);
  border-top: none;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  z-index: 1001;
}

.search-results::-webkit-scrollbar {
  width: 6px;
}
.search-results::-webkit-scrollbar-thumb {
  background-color: rgb(48, 148, 255);
  border-radius: 3px;
}

.search-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: clamp(12px, 2.5vw, 16px);
  color: rgb(218, 218, 218);
  border-bottom: 2px solid rgb(45, 45, 47);
}
.search-item:last-child {
  border-bottom: none;
}
.search-item .item-name {
  color: rgb(190, 190, 190);
}
.search-item:hover {
  background: rgb(10, 10, 10);
}
.search-container {
  width: clamp(200px, 40%, 60vw);
  max-width: 500px;
  position: relative;
}
.search-box {
  width: 100%;
}
.search-results:empty {
  display: none;
}

.details .info {
  color: rgb(218, 218, 218);
  font-size: clamp(
    12px,
    calc(18px - 0.75vw),
    18px
  );
  margin-bottom: 0.25rem;
  word-break: break-all;
  overflow-wrap: break-word;
}
.details .info:last-child {
  margin-bottom: 0;
}

.content {
  display: grid;
  grid-template-areas: "slot";
}
.cards-grid  { grid-area: slot; }
.search-stock { 
  grid-area: slot;
  display: none;
}
.content.show-search .cards-grid  {
  display: none;
}
.content.show-search .search-stock {
  display: block;
}

.search-stock {
  /* match your main padding/margins */
  max-width: 1500px;
  margin: 0 auto 2rem;
  padding: 0 clamp(30px, 5vw, 50px);
  box-sizing: border-box;
  color: rgb(218, 218, 218);
  background-color: rgb(20, 20, 20);
}

/* Back button */
.search-stock .back-btn {
  background: none;
  border: none;
  color: rgb(218, 218, 218);
  background-color: rgb(45, 45, 47);
  border-radius: 10px;
  font-size: clamp(10px, 2.5vw, 12px);
  margin-top: 15px;
  margin-bottom: 1rem;
  cursor: pointer;
  padding: clamp(12px, 2vw, 16px);
}
.search-stocks .back-btn:hover {
  background-color: rgb(48, 148, 255);
}
.search-stocks .back-btn:active {
  background-color: rgb(20, 20, 20);
}

/* Header: logo + company + countdown */
.search-stock .detail-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: clamp(10px, 2vw, 20px);
  margin-bottom: 2rem;
}

.search-stock .company-info {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 20px);
}

.search-stock .company-info .logo {
  width: 80px;
  height: 80px;
  object-fit: contain;;
  background-color: rgb(218, 218, 218);
  box-shadow: 0 0 3px rgba(218,218,218,0.3);
  padding: 5px;
  border-radius: 10px;
}
.search-stock .company-info .logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Company name + ticker */
.search-stock h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  color: rgb(218, 218, 218);
}
.search-stock .ticker {
  font-size: clamp(16px, 2.5vw, 20px);
  color: rgb(190, 190, 190);
  margin-left: 0.5rem;
}

/* Sector / Industry tags */
.search-stock .tags {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
}
.search-stock .tag {
  background: rgb(45, 45, 47);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: clamp(12px, 2vw, 14px);
  color: rgb(218, 218, 218);
}

/* Big countdown widget */
.search-stock .countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgb(48, 148, 255);
  border-radius: 10px;
  padding: 20px;
  min-width: 160px;
  color: rgb(218, 218, 218);
}
.search-stock .days-number {
  font-size: 3rem;
  line-height: 1;
  color: rgb(218, 218, 218);
}
.search-stock .days-label {
  font-size: 1.5rem;
  color: rgb(218, 218, 218);
}
.search-stock .days-sub {
  font-size: 1rem;
  color: rgb(218, 218, 218);
}

/* Metrics grid */
.search-stock .metrics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 2vw, 24px);
  margin-bottom: 2rem;
}
.search-stock .metrics-grid div {
  background: rgb(45, 45, 47);
  padding: clamp(12px, 2vw, 16px);
  border-radius: 8px;
  font-size: clamp(14px, 2vw, 16px);
  color: rgb(218, 218, 218);
}
.search-stock .metrics-grid > div {
  flex: 0 1 auto;
  white-space: nowrap;
}
.search-stock .metrics-grid .label {
  font-weight: 600;
  margin-right: 0.25rem;
}

/* Description box */
.search-stock .description {
  background: rgb(45, 45, 47);
  padding: clamp(16px, 2.5vw, 24px);
  border-radius: 8px;
  line-height: 1.5;
  font-size: clamp(14px, 2vw, 16px);
  position: relative;
}
.search-stock .description p {
  margin: 0;
  overflow-wrap: break-word;
}

/* Read‐more toggle */
.search-stock .toggle-btn {
  background: none;
  border: none;
  color: rgb(48, 148, 255);
  font-size: clamp(14px, 2vw, 16px);
  margin-top: 0.75rem;
  cursor: pointer;
  padding: 0;
}

.content {
  display: grid;
  grid-template-areas: "slot";
}
.cards-grid  { grid-area: slot; }
.search-stock { grid-area: slot; display: none; }
.content.show-search .cards-grid  { display: none; }
.content.show-search .search-stock { display: block; }

.card .details {
  grid-area: details;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.card .details .info {
  display: inline-flex !important;
}
.card.mode-prediction .visual.prediction {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem auto 0;
}
.card.mode-countdown .visual.countdown {
  display: flex;
  width: fit-content;
  margin: 1rem auto 0;
}
.percent {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  color: rgb(218, 218, 218);
  font-weight: 600;
}
/* ─── Detail‐page gauge variant ─── */
.detail-visual.prediction {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 175px;
  background-color: rgb(48, 148, 255);
  border-radius: 10px;
  padding: 28px 16px 44px;
}

.detail-visual.prediction .bg,
.detail-visual.prediction .fg {
  stroke-width: 8;
}
.detail-visual.prediction .gauge {
  width: 175px;
  height: auto;
}
.detail-visual.prediction .bg,
.detail-visual.prediction .fg {
  stroke-width: 8;
}
.detail-visual.prediction .percent {
  top: 70%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
}
.footer {
  font-size: 0.9rem;
  color: rgb(190, 190, 190);
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 clamp(30px, 5vw, 50px);
  box-sizing: border-box;   
}

/* One card per row on small screens */
@media (max-width: 600px) {
  .header-top {
    flex-wrap: nowrap;
  }
  .header-top h1 {
    width: auto;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .search-box input::placeholder {
    font-size: 10px;
  }
  .information {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      "details"
      "visual";
    gap: 10px;
  }
  .card.mode-prediction .visual.prediction {
    margin-bottom: 1.5rem;
  }
  .search-stock .detail-header {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
  }
  .search-stock .detail-header .visual {
    margin-top: 1rem;
  }
}
@media (max-width: 500px) { 
  .search-box {
    width: 175px;
    margin: 0;
    margin-left: auto;
    max-width: none;
    align-items: end;
  }
}