/* CSS Variables for theming and consistency */
:root {
  --bg-light: #ffffff;
  --bg-dark: #fff;
  --body-bg-light: #f0f2f5;
  --text-primary-light: #000;
  --text-primary-dark: #000;
  --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: #ef4444;
  --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: #000;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --shadow-hover-color: rgba(6, 182, 212, 0.2);
}

@font-face {
  font-family: 'arial_mt_stdlight';
  src: url('fonts/arialmtstd-light.eot');
  src: url('fonts/arialmtstd-light.eot?#iefix') format('embedded-opentype'),
    url('fonts/arialmtstd-light.woff2') format('woff2'),
    url('fonts/arialmtstd-light.woff') format('woff'),
    url('fonts/arialmtstd-light.ttf') format('truetype'),
    url('fonts/arialmtstd-light.svg#arial_mt_stdlight') format('svg');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'arial-mt-std';
  src: url('fonts/Arial-MT-Std.ttf') format('truetype');
}

/* Keyframe animation for the 'ping' effect */
@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* General Body Styles */
body {
  font-family: 'arial-mt-std', Arial, Helvetica, sans-serif;
  /* background-color: rgba(255, 255, 255, 0.7); */
  display: flex;
  /* flex-direction: column; */
  align-items: center;
  /* justify-content: center; */
  margin: 0;
  padding: 1rem;
}

/* Main Stock Card Container */
.stock-card {
  width: 100%;
  max-width: 1100px;
  background-color: var(--bg-light);
  border-radius: 6px;
  padding: 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: 16px;
  line-height: 1.25rem;
  color: var(--text-primary-light);
  font-weight: 600; /* Made this bold */
}
.header-details .last-close {
  font-size: 16px;
  line-height: 1.25rem;
  color: var(--text-primary-light);
  margin-top: 0.25rem;
}

/* 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: 6px;
  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: 16px;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--text-primary-light);
  margin-bottom: 0.5rem;
}
.range-visualizer .values {
  font-size: 16px;
  line-height: 1.25rem;
  font-weight: 700;
  color: var(--text-primary-light);
  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, #f0e9db, #000);
  border-radius: 9999px;
}
.range-visualizer .range-thumb {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  background-color: var(--bg-light);
  border: 2px solid var(--brand-color);
  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;
  transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy, noticeable slide */
}

/* Pulse animation for UP movement (GREEN) */
@keyframes thumbPriceChangeUp {
    0% {
        box-shadow: 0 4px 6px -1px var(--shadow-color);
        transform: translateY(-50%) scale(1);
        border-color: var(--brand-color);
    }
    30% {
        box-shadow: 0 0 20px var(--positive-color);
        transform: translateY(-50%) scale(1.2);
        border-color: var(--positive-color);
    }
    70% {
        box-shadow: 0 0 10px var(--positive-color);
        transform: translateY(-50%) scale(1.1);
        border-color: var(--positive-color);
    }
    100% {
        box-shadow: 0 4px 6px -1px var(--shadow-color);
        transform: translateY(-50%) scale(1);
        border-color: var(--brand-color);
    }
}

/* Pulse animation for DOWN movement (RED) */
@keyframes thumbPriceChangeDown {
    0% {
        box-shadow: 0 4px 6px -1px var(--shadow-color);
        transform: translateY(-50%) scale(1);
        border-color: var(--brand-color);
    }
    30% {
        box-shadow: 0 0 20px var(--negative-color);
        transform: translateY(-50%) scale(1.2);
        border-color: var(--negative-color);
    }
    70% {
        box-shadow: 0 0 10px var(--negative-color);
        transform: translateY(-50%) scale(1.1);
        border-color: var(--negative-color);
    }
    100% {
        box-shadow: 0 4px 6px -1px var(--shadow-color);
        transform: translateY(-50%) scale(1);
        border-color: var(--brand-color);
    }
}

.range-thumb-price-change-up {
    animation: thumbPriceChangeUp 3s ease-out;
}

.range-thumb-price-change-down {
    animation: thumbPriceChangeDown 3s ease-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;
}

@media (max-width: 425px) {
  .details-grid {
    grid-template-columns: 1fr; /* Stack items vertically on small screens */
  }
}

.details-grid .detail-item {
  display: flex;
  flex-direction: column;
}
.details-grid .detail-item .label {
  font-size: 16px;
  line-height: 1.25rem;
  color: var(--black);
  font-weight: 500;
}
.details-grid .detail-item .value {
  font-size: 16px;
  line-height: 1.5rem;
  font-weight: 600;
  color: var(--black);
}

.detail-item {
  background-color: #f0e9db;
  padding: 1rem;
  border-radius: 6px;
}

.code {
    margin-bottom: 0;
    margin-top: 50px;
    font-size: 22px;
    color: var(--text-primary-dark);
}

/* --- Card Footer --- */
.card-footer {
    text-align: right;
    margin-top: 2rem; /* 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;
}
}
@media (min-width: 768px) {
  .price-display .current-price {
    font-size: 4.5rem;
    margin-top: 0;
  }
  .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-primary-dark);
    font-weight: 600;
  }
  .card-header,
  .details-grid {
    border-color: var(--border-light);
  }
  .card-header .status-text,
  .price-display .current-price,
  .range-visualizer .labels,
  .range-visualizer .values,
  .details-grid .detail-item .label,
  .details-grid .detail-item .value {
    color: var(--black);
  }
  .card-header .status-text,
  .price-display .current-price,
  .range-visualizer .values,
  .details-grid .detail-item .value {
    color: var(--text-primary-dark);
    font-weight: bold;
  }
  .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);
  }
}
/* Update these animation durations in your CSS */

.price-flash {
    animation: priceFlash 3s ease-in-out; /* Changed from 0.5s to 3s */
}

.price-up {
    animation: priceUpPulse 3s ease-in-out; /* Changed from 0.5s to 3s */
}

.price-down {
    animation: priceDownPulse 3s ease-in-out; /* Changed from 0.5s to 3s */
}

/* Update the keyframe animations to be more gradual */
@keyframes priceFlash {
    0% { background-color: transparent; }
    15% { background-color: rgba(255, 255, 0, 0.3); } /* Adjusted timing */
    50% { background-color: rgba(255, 255, 0, 0.2); }
    85% { background-color: rgba(255, 255, 0, 0.1); }
    100% { background-color: transparent; }
}

@keyframes priceUpPulse {
    0% { color: inherit; transform: scale(1); }
    20% { color: var(--positive-color); transform: scale(1.02); }
    80% { color: var(--positive-color); transform: scale(1.01); }
    100% { color: inherit; transform: scale(1); }
}

@keyframes priceDownPulse {
    0% { color: inherit; transform: scale(1); }
    20% { color: var(--negative-color); transform: scale(0.98); }
    80% { color: var(--negative-color); transform: scale(0.99); }
    100% { color: inherit; transform: scale(1); }
}

/* Grey text animation for no price change */
@keyframes priceGreyText {
    0% { color: inherit; }
    30% { color: #6b7280; } /* Grey color */
    70% { color: #6b7280; }
    100% { color: inherit; }
}

.price-grey {
    animation: priceGreyText 1s ease-in-out;
}