/* ==========================================================================
   Stocks 360 - Main Stylesheet (styles.css)
   Clean, modern FinTech aesthetic with WCAG AA/AAA Accessibility Focus
   ========================================================================== */

/* ---------- CSS VARIABLES ---------- */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --border-light: #e2e8f0;
  --border-focus: #3b82f6;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.07);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ---------- RESET & BASE ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.96rem + 0.25vw, 1.125rem); /* Fluid 16px-18px across devices */
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

button, a, input, select, textarea {
  touch-action: manipulation;
}

/* Accessible focus visible outlines */
:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
}

/* Common container */
.container {
  width: 92%;
  max-width: 1140px;
  margin: 0 auto;
}

/* ---------- SKIP LINK ---------- */
.skip-link {
  position: absolute;
  top: -60px;
  left: 15px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  font-weight: 700;
  z-index: 9999;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-focus);
  box-shadow: var(--shadow-md);
  transition: top 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease;
}

.skip-link:focus {
  top: 14px;
}

/* ---------- TOP REGULATORY DISCLAIMER ---------- */
.top-disclaimer {
  background-color: var(--warning-bg);
  color: #92400e;
  padding: 12px 16px;
  font-size: 0.98rem;
  border-bottom: 1px solid #fde68a;
  text-align: center;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.top-disclaimer strong {
  color: #78350f;
}

.footer-disclaimer {
  margin: 0;
  font-size: 0.98rem;
  color: #e2e8f0;
  text-align: center;
}

/* ---------- TOP BAR & BRAND ---------- */
.top-bar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.top-bar-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-img {
  width: 46px;
  height: 46px;
  display: block;
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}

.brand-group:hover .brand-logo-img {
  transform: scale(1.06) rotate(4deg);
  box-shadow: var(--shadow-md);
}

.brand-text-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-logo, .brand-title a {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  text-decoration: none;
  letter-spacing: -0.5px;
  transition: color 0.2s ease;
}

.brand-logo .brand-accent {
  color: var(--primary);
}

.brand-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-top: 2px;
}

.footer-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.footer-logo-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

/* ---------- ACCESSIBILITY TOGGLE BUTTON ---------- */
.a11y-toggle-btn, #accessibility-toggle {
  background-color: #0f172a;
  color: #ffffff;
  border: 2px solid #334155;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.a11y-toggle-btn:hover, #accessibility-toggle:hover {
  background-color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ---------- TOP SEARCH FOR STOCKS SECTION ---------- */
.top-search-section {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  padding: 22px 0 14px 0;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.25s ease;
}

.top-search-section .stock-search-card {
  margin-bottom: 0;
  padding: 22px 26px;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.top-search-section .stock-search-card:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

/* ---------- STOCK 360 AI / ASK 360 AI BAR (BEFORE MAIN LINKS) ---------- */
.stock360-ai-section {
  background-color: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  padding: 14px 0;
  transition: background-color 0.25s ease;
}

.stock360-ai-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 14px 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.stock360-ai-banner:hover {
  box-shadow: var(--shadow-md);
}

.stock360-ai-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.ai-pill-badge {
  background: var(--primary);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  letter-spacing: 0.2px;
}

.stock360-ai-desc {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 500;
  margin: 0;
}

.btn-ask360-ai {
  background-color: var(--primary);
  color: #ffffff;
  border: 2px solid var(--primary);
  padding: 10px 22px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.btn-ask360-ai:hover,
.btn-ask360-ai:focus {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.stock360-ai-drawer {
  margin-top: 14px;
  margin-bottom: 0;
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-md);
  transition: all 0.25s ease;
}

.stock360-ai-drawer .search-input-wrapper {
  margin-bottom: 10px;
}

.stock360-ai-drawer .search-input-wrapper input {
  width: auto;
  margin-right: 0;
}

.ask360-error {
  color: var(--danger);
  font-weight: 600;
  margin-top: 8px;
}

/* ---------- NAVIGATION BAR ---------- */
#main-navigation {
  background-color: #0f172a; /* Deep navy */
  padding: 0;
  border-bottom: 3px solid var(--primary);
  box-shadow: var(--shadow-sm);
}

#main-navigation ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  gap: 4px;
}

#main-navigation li a {
  display: block;
  color: #e2e8f0;
  text-decoration: none;
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 600;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

#main-navigation li a:hover,
#main-navigation li a:focus {
  color: #ffffff;
  background-color: #1e293b;
}

#main-navigation li a.active,
#main-navigation li a[aria-current="page"] {
  color: #ffffff;
  background-color: var(--primary);
}

#main-navigation li.admin-portal-link {
  margin-left: auto;
}

#main-navigation li.admin-portal-link a {
  background-color: #334155;
  color: #f8fafc;
}

#main-navigation li.admin-portal-link a:hover {
  background-color: var(--primary);
}

/* ---------- MARKET INDICES TICKER ---------- */
.market-ticker-bar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 8px 0;
  font-size: 0.95rem;
}

.ticker-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ticker-name {
  font-weight: 700;
  color: var(--text-primary);
}

.ticker-val {
  font-weight: 600;
  color: var(--text-secondary);
}

.ticker-change.up, .stat-positive {
  color: var(--success);
  font-weight: 700;
}

.ticker-change.down, .stat-negative {
  color: var(--danger);
  font-weight: 700;
}

/* ---------- HERO & STOCK SEARCH ---------- */
.hero-search-section {
  padding: 40px 0 30px 0;
}

.hero-text-block h1 {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #0f172a;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 800px;
  margin-bottom: 30px;
}

.stock-search-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}

.search-label {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.search-input-wrapper {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.search-input-wrapper input {
  flex: 1;
  padding: 14px 18px;
  font-size: 1.1rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #f8fafc;
  color: var(--text-primary);
}

.search-input-wrapper input:focus {
  border-color: var(--primary);
  background: #ffffff;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  padding: 14px 26px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #e2e8f0;
  color: #1e293b;
  border: none;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

.quick-tickers-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.suggest-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

.quick-ticker-pill {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-ticker-pill:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ---------- STOCK RESULT CARD ---------- */
.stock-result-card {
  background: var(--bg-surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  margin-top: 25px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.result-header h2 {
  font-size: 1.9rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.exchange-badge {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.live-price-box {
  text-align: right;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--success);
  margin-bottom: 4px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.main-price {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.price-change-pill {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.price-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  margin: 25px 0;
}

.metric-box {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
}

.metric-box .label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.metric-box .val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.historical-control-box {
  margin-top: 20px;
}

.historical-control-box label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.historical-control-box select {
  padding: 10px 16px;
  font-size: 1rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.historical-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.historical-table th, .historical-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.historical-table th {
  background-color: #f1f5f9;
  font-weight: 700;
}

/* ---------- HOME FEATURES SECTION ---------- */
.home-features-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 25px;
  margin: 45px 0;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  font-size: 2.2rem;
  margin-bottom: 15px;
}

.feature-card h2,
.feature-card h3 {
  font-size: 1.35rem;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 20px;
}

.feature-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.feature-link:hover {
  text-decoration: underline;
}

/* ---------- ACCESSIBILITY SHORTCUT BANNER ---------- */
.a11y-helper-banner {
  background: #0f172a;
  color: #f8fafc;
  padding: 16px 22px;
  border-radius: var(--radius-md);
  margin: 30px 0;
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.a11y-helper-banner code {
  background: #334155;
  color: #38bdf8;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* ---------- NEWS & NEWSLETTER CARDS ---------- */
.news-headings-list {
  list-style: none;
  padding: 0;
  margin: 25px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.public-news-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.public-news-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.news-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.news-tag {
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.news-tag.newsletter-tag {
  background: #fef3c7;
  color: #92400e;
}

.news-date {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.news-card-heading {
  font-size: 1.4rem;
  line-height: 1.4;
  margin-bottom: 8px;
}

.news-card-heading a {
  color: var(--text-primary);
  text-decoration: none;
}

.news-card-heading a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.news-card-author {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.news-card-synopsis {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.news-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.read-time-pill {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.read-article-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95rem;
}

.read-article-link:hover {
  text-decoration: underline;
}

/* ---------- ARTICLE DETAIL VIEW ---------- */
.detail-container {
  max-width: 820px;
  margin: 30px auto;
  padding: 20px 0;
}

.back-link {
  display: inline-block;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 20px;
  font-size: 1.05rem;
}

.back-link:hover {
  text-decoration: underline;
}

.news-article-view h1, .lesson-article-view h1 {
  font-size: 2.2rem;
  line-height: 1.3;
  margin-bottom: 14px;
}

.article-meta-line {
  font-size: 0.98rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 6px;
}

.news-article-view .ask360-trigger-btn {
  margin-top: 12px;
}

.news-glossary h2,
.lesson-takeaways-card h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.article-main-body, .lesson-body-content {
  font-size: 1.15rem;
  line-height: 1.75;
  color: #1e293b;
  margin: 25px 0;
}

.article-main-body p, .lesson-body-content p {
  margin-bottom: 16px;
}

.news-synopsis {
  background: #f0fdf4;
  border-left: 4px solid var(--success);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 1.1rem;
  color: #166534;
  margin-bottom: 20px;
}

.news-glossary, .lesson-takeaways-card {
  background: #eff6ff;
  border-left: 4px solid var(--primary);
  padding: 18px 22px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 25px 0;
  font-size: 1.05rem;
  color: #1e40af;
}

.news-keywords {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 15px;
}

/* ---------- ASK 360 INLINE DRAWER ---------- */
.ask360-trigger-btn {
  background: #ede9fe;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.15s ease;
}

.ask360-trigger-btn:hover {
  background: #ddd6fe;
}

.ask360-box {
  background: #f5f3ff;
  border: 2px solid #c4b5fd;
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 25px;
}

.ask360-box input {
  width: calc(100% - 210px);
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  margin-right: 8px;
}

.ask360-ai-card {
  background: #ffffff;
  border: 1px solid #c4b5fd;
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 15px;
  box-shadow: var(--shadow-sm);
}

/* ---------- LISTEN TO THE ARTICLE BUTTON & FULL AUDIO CONTROLS ---------- */
.article-listen-wrapper {
  margin: 14px 0 22px 0;
}

.listen-article-trigger-btn {
  background-color: var(--primary);
  color: #ffffff;
  border: 2px solid var(--primary);
  padding: 10px 22px;
  font-size: 0.98rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.listen-article-trigger-btn:hover,
.listen-article-trigger-btn:focus-visible {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.news-audio-player-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  border: 2px solid #334155;
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  margin: 0;
  box-shadow: var(--shadow-md);
}

.audio-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #334155;
}

.audio-player-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-wave-icon {
  font-size: 1.35rem;
}

.audio-player-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.2px;
}

.audio-voice-badge {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.audio-controls-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.audio-transport-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.18s ease;
}

.audio-btn-play {
  background: var(--primary);
  color: #ffffff;
  border: 2px solid #60a5fa;
  padding: 10px 20px;
  font-size: 0.98rem;
  min-width: 138px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.audio-btn-play:hover,
.audio-btn-play:focus-visible {
  background: #3b82f6;
  transform: translateY(-1px);
}

.audio-btn-play[data-state="playing"] {
  background: #16a34a;
  border-color: #4ade80;
}

.audio-btn-skip {
  background: #1e293b;
  color: #e2e8f0;
  border: 1.5px solid #475569;
  padding: 9px 14px;
  font-size: 0.9rem;
}

.audio-btn-skip:hover,
.audio-btn-skip:focus-visible {
  background: #334155;
  color: #ffffff;
  border-color: #94a3b8;
}

.audio-seek-group {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-time-label {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
  min-width: 38px;
  text-align: center;
}

.audio-seek-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 8px;
  border-radius: 9999px;
  background: linear-gradient(
    to right,
    #38bdf8 0%,
    #38bdf8 var(--seek-fill, 0%),
    #334155 var(--seek-fill, 0%),
    #334155 100%
  );
  outline: none;
  cursor: pointer;
}

.audio-seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #2563eb;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}

.audio-seek-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.audio-seek-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #2563eb;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.audio-speed-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.audio-speed-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
}

.audio-speed-select {
  background: #1e293b;
  color: #f8fafc;
  border: 1.5px solid #475569;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.audio-speed-select:hover,
.audio-speed-select:focus-visible {
  border-color: #38bdf8;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- LEARN MODULES CARDS ---------- */
.units-grid {
  list-style: none;
  padding: 0;
  margin: 25px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 25px;
}

.unit-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.unit-badge {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  align-self: flex-start;
}

.unit-card h2 {
  font-size: 1.45rem;
  margin-bottom: 10px;
}

.unit-card h2 a {
  color: var(--text-primary);
  text-decoration: none;
}

.unit-desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 20px;
  flex-grow: 1;
}

.unit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid var(--border-light);
}

.lesson-count-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.start-unit-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.subunits-list-wrapper {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-list-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.lesson-list-item:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}

.lesson-heading-link {
  display: flex;
  align-items: center;
  padding: 18px 22px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
}

.lesson-num {
  width: 32px;
  height: 32px;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  margin-right: 15px;
}

.lesson-pagination {
  display: flex;
  justify-content: space-between;
  margin: 30px 0;
}

/* Discussion Comments */
.lesson-comments-section {
  margin-top: 35px;
}

.learner-comment-card {
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  padding: 12px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
}

.comment-author-name {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.comment-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 8px;
}

.comment-body {
  font-size: 1.05rem;
  color: var(--text-secondary);
}

.comment-input-box {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
  background: #ffffff;
}

/* Contact Cards */
.contact-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px;
  margin: 25px 0;
}

.contact-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  overflow-wrap: anywhere;
}

.contact-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.contact-highlight a {
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.faq-grid {
  display: grid;
  gap: 15px;
  margin-top: 20px;
}

.faq-item {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
}

.faq-item h3 {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

/* Styled Bullet Lists */
.styled-bullet-list {
  margin: 15px 0 25px 25px;
}

.styled-bullet-list li {
  margin-bottom: 10px;
  list-style-type: disc !important;
}

/* ---------- FOOTER ---------- */
footer {
  background-color: #0f172a;
  color: #94a3b8;
  padding: 40px 0 30px 0;
  margin-top: 60px;
  border-top: 1px solid #1e293b;
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
}

.footer-grid h4 {
  color: #f8fafc;
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: #94a3b8;
  text-decoration: none;
}

.footer-links a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* ==========================================================================
   HIGH-CONTRAST MODE (WCAG AAA - 7:1 Minimum Contrast)
   ========================================================================== */
body.high-contrast {
  background-color: #000000 !important;
  color: #ffffff !important;
}

body.high-contrast * {
  border-color: #facc15 !important; /* Stark contrast yellow borders */
}

body.high-contrast a,
body.high-contrast .brand-logo,
body.high-contrast .brand-logo .brand-accent {
  color: #38bdf8 !important; /* Cyan links & brand */
}

body.high-contrast .top-bar,
body.high-contrast .top-search-section,
body.high-contrast .stock360-ai-section,
body.high-contrast .stock360-ai-banner,
body.high-contrast .stock360-ai-drawer,
body.high-contrast #main-navigation,
body.high-contrast .market-ticker-bar,
body.high-contrast .stock-search-card,
body.high-contrast .stock-result-card,
body.high-contrast .feature-card,
body.high-contrast .public-news-card,
body.high-contrast .unit-card,
body.high-contrast .contact-card,
body.high-contrast .faq-item,
body.high-contrast .detail-container,
body.high-contrast footer {
  background: #000000 !important;
  background-color: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

body.high-contrast .top-disclaimer {
  background-color: #000000 !important;
  color: #facc15 !important;
  border: 2px solid #facc15 !important;
}

body.high-contrast input,
body.high-contrast textarea,
body.high-contrast select {
  background-color: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

body.high-contrast .btn-primary,
body.high-contrast .btn-ask360-ai,
body.high-contrast .a11y-toggle-btn,
body.high-contrast .listen-article-trigger-btn,
body.high-contrast .audio-btn-play {
  background-color: #facc15 !important;
  color: #000000 !important;
  border: 2px solid #ffffff !important;
  font-weight: 800 !important;
}

body.high-contrast .news-audio-player-card,
body.high-contrast .audio-btn-skip,
body.high-contrast .audio-speed-select {
  background: #000000 !important;
  background-color: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #facc15 !important;
}

body.high-contrast .ticker-change.up,
body.high-contrast .stat-positive {
  color: #4ade80 !important; /* Vivid green */
}

body.high-contrast .ticker-change.down,
body.high-contrast .stat-negative {
  color: #f87171 !important; /* Vivid red */
}

/* ---------- ARTICLE TABLES & MEDIA RESPONSIVENESS ---------- */
.article-main-body img,
.lesson-body-content img,
.article-main-body video,
.article-main-body iframe {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.article-main-body table,
.lesson-body-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.article-main-body th,
.article-main-body td,
.lesson-body-content th,
.lesson-body-content td {
  border: 1px solid var(--border-light);
  padding: 10px 14px;
  text-align: left;
}

.article-main-body th,
.lesson-body-content th {
  background-color: var(--bg-subtle);
  font-weight: 700;
}

/* ==========================================================================
   MULTI-DEVICE RESPONSIVE ARCHITECTURE
   Covers:
   1. MacBook Pro 14"/16" Retina & Large Laptops / Desktops (>= 1441px)
   2. MacBook Air 13"/15" & Standard Windows Laptops (1025px - 1440px)
   3. Apple iPads (Mini, Air, Pro) & Android Tablets (600px - 1024px)
   4. iPhones & Android Smartphones (<= 767px & <= 599px)
   5. Compact Mobile Viewports (<= 380px)
   ========================================================================== */

/* 1. Large Laptops, MacBook Pro 14"/16" & Widescreen Displays (>= 1441px) */
@media (min-width: 1441px) {
  .container {
    width: 88%;
    max-width: 1240px;
  }

  .detail-container {
    max-width: 860px;
  }

  .news-article-view h1,
  .lesson-article-view h1 {
    font-size: 2.35rem;
  }
}

/* 2. MacBook Air 13", MacBook Pro 13"/14" & Windows Laptops (1025px - 1440px) */
@media (min-width: 1025px) and (max-width: 1440px) {
  .container {
    width: 90%;
    max-width: 1140px;
  }

  .top-bar {
    padding: 12px 0;
  }

  .stock360-ai-section {
    padding: 10px 0;
  }

  .detail-container {
    max-width: 820px;
    margin: 22px auto;
  }
}

/* 3. Apple iPads (iPad Mini, iPad Air, iPad Pro) & Android Tablets (600px - 1024px) */
@media (min-width: 600px) and (max-width: 1024px) {
  .container {
    width: 92%;
    max-width: 960px;
  }

  .detail-container {
    max-width: 100%;
    margin: 20px auto;
    padding: 12px 0;
  }

  #main-navigation ul {
    justify-content: flex-start;
    gap: 2px;
  }

  #main-navigation li a {
    padding: 12px 15px;
    font-size: 0.98rem;
  }

  .units-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .contact-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .news-article-view h1,
  .lesson-article-view h1,
  #page-heading {
    font-size: 1.9rem;
  }

  /* Tablet audio player bar: transport + speed on row 1, full-width seek slider on row 2 */
  .audio-controls-bar {
    gap: 12px;
  }

  .audio-seek-group {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    padding-top: 4px;
  }

  .audio-speed-group {
    margin-left: auto;
  }

  .ask360-box input {
    width: calc(100% - 205px);
  }
}

/* 4. All Mobile & Portrait Phablet Viewports (<= 767px) */
@media (max-width: 767px) {
  .container {
    width: 92%;
  }

  .top-bar {
    padding: 12px 0;
  }

  .top-bar-flex,
  .result-header,
  .ticker-flex,
  .footer-grid {
    flex-direction: column;
    align-items: stretch;
  }

  .top-controls {
    width: 100%;
  }

  .a11y-toggle-btn,
  #accessibility-toggle {
    width: 100%;
    justify-content: center;
    text-align: center;
    min-height: 46px;
    padding: 11px 16px;
  }

  .stock360-ai-banner {
    padding: 12px 14px;
  }

  .stock360-ai-actions {
    width: 100%;
  }

  .btn-ask360-ai {
    width: 100%;
    justify-content: center;
    text-align: center;
    line-height: 1.35;
    min-height: 46px;
    padding: 11px 16px;
    border-radius: var(--radius-md);
  }

  .stock360-ai-drawer {
    padding: 16px;
  }

  .search-input-wrapper {
    flex-direction: column;
    gap: 10px;
  }

  .search-input-wrapper input,
  .stock360-ai-drawer .search-input-wrapper input {
    width: 100%;
    font-size: 16px; /* Prevents iOS Safari zoom on input focus */
  }

  .search-input-wrapper button {
    width: 100%;
    min-height: 46px;
  }

  /* Inline Ask 360 Box on articles, newsletters, and lessons */
  .ask360-trigger-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    min-height: 44px;
    border-radius: var(--radius-md);
    line-height: 1.35;
  }

  .ask360-box {
    padding: 16px;
  }

  .ask360-box input {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
    font-size: 16px;
  }

  .ask360-box > button,
  .ask360-box .btn-primary {
    width: 100%;
    min-height: 46px;
  }

  .live-price-box {
    text-align: left;
  }

  .hero-text-block h1,
  .news-article-view h1,
  .lesson-article-view h1,
  #page-heading {
    font-size: clamp(1.5rem, 1.25rem + 1.5vw, 1.85rem);
    line-height: 1.3;
  }

  .detail-container {
    margin: 18px auto;
    padding: 8px 0;
  }

  .public-news-card,
  .unit-card,
  .contact-card {
    padding: 18px;
  }

  .news-card-heading {
    font-size: 1.22rem;
  }

  .article-main-body,
  .lesson-body-content {
    font-size: 1.06rem;
    line-height: 1.7;
  }

  .lesson-heading-link {
    padding: 14px 16px;
    font-size: 1.05rem;
  }

  .lesson-num {
    flex-shrink: 0;
  }

  .lesson-pagination {
    flex-direction: row;
    gap: 10px;
  }

  .lesson-pagination button {
    flex: 1;
    min-height: 46px;
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .historical-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  footer {
    padding: 28px 0 calc(24px + env(safe-area-inset-bottom, 0px)) 0;
    margin-top: 40px;
  }
}

/* 5. iPhones (SE, 13/14/15/16, Pro Max) & Android Smartphones (<= 599px) */
@media (max-width: 599px) {
  #main-navigation .container {
    width: 94%;
    padding: 6px 0;
  }

  #main-navigation ul {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  #main-navigation li a {
    padding: 10px 8px;
    font-size: 0.92rem;
    text-align: center;
    border-radius: var(--radius-sm);
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
  }

  /* Mobile Audio Player Card Optimization */
  .listen-article-trigger-btn {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border-radius: var(--radius-md);
  }

  .news-audio-player-card {
    padding: 14px 16px;
    border-radius: var(--radius-md);
  }

  .audio-controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .audio-transport-group {
    width: 100%;
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr;
    gap: 8px;
  }

  .audio-btn-play {
    min-width: 0;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .audio-btn-skip {
    width: 100%;
    min-height: 44px;
    padding: 10px 8px;
    font-size: 0.88rem;
  }

  .audio-seek-group {
    width: 100%;
    min-width: 0;
    gap: 8px;
  }

  .audio-speed-group {
    width: 100%;
    justify-content: space-between;
    padding-top: 4px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
  }

  .audio-speed-select {
    min-height: 40px;
    padding: 6px 14px;
    font-size: 16px; /* Prevents iOS Safari auto-zoom */
  }

  .units-grid,
  .contact-cards-grid,
  .home-features-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .unit-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .comment-input-box .btn-primary,
  .public-form .btn-primary {
    width: 100%;
    min-height: 46px;
  }
}

/* 6. Compact Smartphones (iPhone SE / Fold Cover / 320px - 380px) */
@media (max-width: 380px) {
  #main-navigation ul {
    grid-template-columns: repeat(2, 1fr);
  }

  .audio-transport-group {
    grid-template-columns: 1fr 1fr;
  }

  .audio-btn-play {
    grid-column: 1 / -1;
  }

  .lesson-pagination {
    flex-direction: column;
  }
}

/* 7. Touch Device Ergonomics (iPhones, iPads, Android Phones & Tablets) */
@media (hover: none) and (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: max(16px, 1rem);
  }

  .audio-seek-slider {
    height: 10px;
  }

  .audio-seek-slider::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  .audio-seek-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }
}

