/* CSS Variables for theming and consistency */
:root {
  --bg-light: #ffffff;
  --bg-dark: #fff;
  --body-bg-light: #f0f2f5;
  --text-primary-light: #000;
  --text-primary-dark: #002A77;
  --text-secondary-light: #002A77;
  --text-secondary-dark: #9ca3af;
  --border-light: #e5e7eb;
  --border-dark: #374151;
  --black: #000;
  --white: #fff;

  /* State Colors */
  --positive-color: #22c55e;
  --positive-bg-light: #dcfce7;
  --positive-bg-dark: rgba(34, 197, 94, 0.2);
  --negative-color: #AE1326;
  --negative-bg-light: #fee2e2;
  --negative-bg-dark: rgba(239, 68, 68, 0.2);
  --neutral-color: #6b7280;
  --neutral-bg-light: #f3f4f6;
  --neutral-bg-dark: rgba(107, 114, 128, 0.2);

  --brand-color: #06b6d4;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --shadow-hover-color: rgba(6, 182, 212, 0.2);
}

/* Keyframe animation for the 'ping' effect */
@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* General Body Styles */
body {
  font-family: "Saira", sans-serif;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  margin: 0;
  padding: 0.5rem 1rem;
  gap: 2rem;
}

/* Main Stock Card Container */
.stock-card {
  width: 100%;
  max-width: 56rem;
  background-color: var(--bg-light);
  border-radius: 1rem;
  padding: 0.5rem 1.5rem;
  /* box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1),
    0 -6px 12px -4px rgba(0, 0, 0, 0.1); */
  transition: box-shadow 0.3s ease-in-out;
}

/* .stock-card:hover {
  box-shadow: 0 0 25px var(--shadow-hover-color);
} */

/* Card Header */
.card-header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}
.card-header .status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.card-header .status-indicator {
  position: relative;
  display: flex;
  height: 0.75rem;
  width: 0.75rem;
}
.card-header .status-ping {
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
  position: absolute;
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  opacity: 0.75;
}
.card-header .status-dot {
  position: relative;
  display: inline-flex;
  border-radius: 9999px;
  height: 0.75rem;
  width: 0.75rem;
}
.card-header .status-text {
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: var(--text-primary-light);
}

.header-details {
  margin-top: 0.5rem;
}
.header-details .last-trade {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--text-primary-light);
  font-weight: 600; /* Made this bold */
}
.header-details .last-close {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--text-primary-light);
  margin-top: 0.25rem;
}

.last-close strong {
  color: var(--text-primary-dark);
}

/* Market Status Styles */
.status .status-word.open {
  color: var(--positive-color);
}
.status .status-ping,
.status .status-dot {
  background-color: var(--positive-color);
}

.status.closed .status-word.closed {
  color: var(--negative-color);
}
.status.closed .status-ping {
  display: none;
} /* Hide ping animation when closed */
.status.closed .status-dot {
  background-color: var(--negative-color);
}

/* Main Price Display Section */
.price-display {
  margin: 0 0;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
}
.price-display .current-price {
  font-size: 3.75rem;
  line-height: 1;
  font-weight: bold;
  color: var(--text-primary-light);
  margin-top: 0;
  margin-bottom: 10px; 
  
}
.price-display .price-change {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  margin-top: 1rem;
}
.price-display .price-change svg {
  height: 1.5rem;
  width: 1.5rem;
  stroke-width: 3;
}

/* DYNAMIC STATE STYLES */
.price-change.positive {
  color: var(--positive-color);
  background-color: var(--positive-bg-light);
}
.price-change.negative {
  color: var(--negative-color);
  background-color: var(--negative-bg-light);
}
.price-change.neutral {
  color: var(--neutral-color);
  background-color: var(--neutral-bg-light);
}

/* Day's Range Visualizer */
.range-visualizer {
  margin: 1.5rem;
}
.range-visualizer .labels,
.range-visualizer .values {
  display: flex;
  justify-content: space-between;
  align-items: center;
  
}
.range-visualizer .labels {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--text-primary-light);
  margin-bottom: 0.5rem;
}
.range-visualizer .values {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 700;
  color: var(--text-primary-dark);
  margin-top: 0.5rem;
}
.range-visualizer .range-bar {
  position: relative;
  height: 0.5rem;
  width: 100%;
  background-color: #e5e7eb;
  border-radius: 9999px;
}
.range-visualizer .range-gradient {
  height: 100%;
  background-image: linear-gradient(to right, var(--text-secondary-light), var(--text-primary-dark));
  border-radius: 9999px;
}
.range-visualizer .range-thumb {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  background-color: var(--bg-dark);
  border: 2px solid var(--text-primary-dark);
  border-radius: 9999px;
  box-shadow: 0 4px 6px -1px var(--shadow-color),
    0 2px 4px -2px var(--shadow-color);
  transition: left 0.3s ease-in-out;
}

/* Detailed Information Grid */
.details-grid {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 1rem;
}
.details-grid .detail-item {
  display: flex;
  flex-direction: column;
}
.details-grid .detail-item .label {
  font-size: 14px;
  line-height: 1.25rem;
  color: var(--black);
  font-weight: 500;
}
.details-grid .detail-item .value {
  font-size: 14px;
  line-height: 1.5rem;
  font-weight: 600;
  color: var(--text-primary-dark);
}

.detail-item {
  background-color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
}

.code {
    margin-bottom: 0;
    margin-top: 50px;
    font-size: 22px;
    color: var(--text-secondary);
}

/* --- Card Footer --- */
.card-footer {
    text-align: right;
    margin-top: 16px; /* 32px */
    font-size: 12px; /* 12px */
    color: var(--color-text-subtle);
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.poweredby img {
    height: 10px;
}

/* Responsive Design Breakpoints */
@media (min-width: 640px) {
  .card-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .header-details {
    margin-top: 0;
    text-align: right;
  }
  .price-display {
    flex-direction: row;
    align-items: center;
    margin-bottom: 0;
  }
  .price-display .price-change {
    margin-top: 0;
  }
  .details-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  
.price-display .current-price {
    margin-bottom: 40px;
    margin-top:0;
    font-weight: bold;
}
}
@media (min-width: 768px) {
  .price-display .current-price {
    font-size: 4.5rem;
    margin-top: 0;
    color: #002A77;
  }
  .details-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Dark Mode Styles */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #fff;
  }
  .stock-card {
    background-color: var(--bg-light);
    border: 0px solid var(--text-primary-dark);
  }
  .header-details .last-trade,
  .header-details .last-close {
    color: var(--text-secondary);
  }
  .card-header,
  .details-grid {
    border-color: var(--border-light);
  }
  .card-header .status-text,
  .range-visualizer .labels,
  .range-visualizer .values,
  .details-grid .detail-item .label,
  .details-grid .detail-item .value {
    color: var(--black);
  }
  .card-header .status-text,
  .range-visualizer .values,
  .details-grid .detail-item {
    color: var(--text-secondary);
    font-weight: 500;
  }

.details-grid .detail-item  .value,
.range-visualizer .values {
  color: var(--text-primary-dark);
}

  .price-change.positive {
    color: var(--positive-color);
    background-color: var(--positive-bg-dark);
  }
  .price-change.negative {
    color: #f87171;
    background-color: var(--negative-bg-dark);
  }
  .price-change.neutral {
    color: #9ca3af;
    background-color: var(--neutral-bg-dark);
  }
  .range-visualizer .range-bar {
    background-color: #374151;
  }
  .range-visualizer .range-thumb {
    background-color: var(--bg-dark);
  }
}