/* ==========================================================================
   FUTURE WAVE ANALYSIS — Reusable Markdown Analysis Page Stylesheet
   Theme: Precision Financial Dark Mode / Wave Structure / Responsive RTL-LTR
   ========================================================================== */

/* Page Wrapper */
.analysis-page-main {
  min-height: calc(100vh - 160px);
  padding-top: 2rem;
  padding-bottom: 4rem;
}

/* Breadcrumb & Top Bar */
.analysis-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.analysis-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--mist);
}

.analysis-breadcrumb a {
  color: var(--mist);
  text-decoration: none;
  transition: color 0.15s ease;
}

.analysis-breadcrumb a:hover {
  color: var(--tide);
}

.analysis-breadcrumb-sep {
  opacity: 0.5;
}

.analysis-breadcrumb-current {
  color: var(--foreground);
  font-weight: 600;
}

.analysis-top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-back-hub {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  color: var(--foreground-muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-back-hub:hover {
  border-color: var(--tide);
  color: var(--tide);
  background: var(--bg-panel-hover);
}

.btn-share-analysis {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--mist);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-share-analysis:hover {
  border-color: var(--line-highlight);
  color: var(--foreground);
}

/* Quick Ticker Switcher Strip */
.analysis-ticker-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow-x: auto;
  scrollbar-width: thin;
}

.ticker-strip-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mist-dim);
  white-space: nowrap;
  margin-inline-end: 0.5rem;
}

.ticker-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--bg-panel-subtle);
  border: 1px solid var(--line);
  color: var(--foreground-muted);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ticker-chip:hover {
  border-color: var(--line-strong);
  color: var(--foreground);
  background: var(--bg-panel-2);
}

.ticker-chip.active {
  background: var(--tide-bg);
  border-color: var(--tide);
  color: var(--tide);
  box-shadow: 0 0 12px var(--tide-glow);
}

/* Analysis Card / Article Shell */
.analysis-container-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
}

@media (max-width: 768px) {
  .analysis-container-card {
    padding: 1.5rem 1rem;
  }
}

/* Top Meta Header Box */
.analysis-meta-summary-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.analysis-meta-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.analysis-ticker-badge {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--tide-bg);
  color: var(--tide);
  border: 1px solid var(--tide-border);
  letter-spacing: 0.05em;
}

.analysis-company-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);
}

.analysis-meta-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.analysis-fullsize-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--foreground-muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.analysis-fullsize-btn:hover {
  color: var(--tide);
  border-color: var(--tide);
  background: var(--tide-bg);
}

.analysis-lang-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  color: var(--mist);
}

/* ==========================================================================
   Hero Stock Analysis Chart Image Container
   ========================================================================== */
.analysis-chart-hero-container {
  margin-bottom: 2.25rem;
  width: 100%;
}

.analysis-chart-card {
  position: relative;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

[data-theme="white"] .analysis-chart-card {
  background: #f8fafc;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.analysis-chart-card:hover {
  border-color: var(--tide);
  box-shadow: 0 6px 30px rgba(22, 199, 154, 0.16);
}

.analysis-chart-anchor {
  display: block;
  position: relative;
  text-decoration: none;
  cursor: zoom-in;
  overflow: hidden;
  background: #060b13;
}

[data-theme="white"] .analysis-chart-anchor {
  background: #ffffff;
}

.analysis-chart-image {
  display: block;
  width: 100%;
  max-height: 580px;
  object-fit: contain;
  margin: 0 auto;
  transition: transform 0.3s ease;
}

@media (max-width: 768px) {
  .analysis-chart-image {
    max-height: 380px;
  }
}

.analysis-chart-card:hover .analysis-chart-image {
  transform: scale(1.008);
}

/* Hover Zoom Overlay */
.analysis-chart-zoom-overlay {
  position: absolute;
  top: 1rem;
  inset-inline-end: 1rem;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.analysis-chart-card:hover .analysis-chart-zoom-overlay {
  opacity: 1;
  transform: translateY(-2px);
}

.analysis-chart-zoom-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(11, 20, 32, 0.88);
  color: var(--tide);
  border: 1px solid var(--tide-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

[data-theme="white"] .analysis-chart-zoom-pill {
  background: rgba(255, 255, 255, 0.94);
  color: var(--tide);
  border-color: var(--line-highlight);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* Markdown Rendered Content Area */
.analysis-content-body {
  color: var(--foreground-muted);
  font-size: 1rem;
  line-height: 1.75;
}

/* Markdown Headings */
.analysis-content-body h1 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--foreground);
  line-height: 1.35;
  margin-top: 0;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  letter-spacing: -0.015em;
}

@media (max-width: 768px) {
  .analysis-content-body h1 {
    font-size: 1.45rem;
  }
}

.analysis-content-body h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.4;
  margin-top: 2.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analysis-content-body h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.1em;
  background: var(--tide);
  border-radius: 2px;
}

.analysis-content-body h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.4;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

.analysis-content-body h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground-muted);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

/* Paragraphs */
.analysis-content-body p {
  margin-top: 0;
  margin-bottom: 1.25rem;
  color: var(--foreground-muted);
}

.analysis-content-body p:last-child {
  margin-bottom: 0;
}

.analysis-content-body strong {
  color: var(--foreground);
  font-weight: 600;
}

.analysis-content-body em {
  color: var(--foreground-muted);
  font-style: italic;
}

/* Blockquotes (Educational Callout / Note) */
.analysis-content-body blockquote {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: rgba(45, 212, 191, 0.05);
  border-inline-start: 4px solid var(--tide);
  border-radius: var(--radius-sm);
  color: var(--foreground-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
  position: relative;
}

.analysis-content-body blockquote p {
  margin: 0;
}

/* Lists */
.analysis-content-body ul,
.analysis-content-body ol {
  margin: 0 0 1.5rem 0;
  padding-inline-start: 1.75rem;
}

.analysis-content-body li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
}

.analysis-content-body li:last-child {
  margin-bottom: 0;
}

/* Tables */
.analysis-table-wrapper {
  margin: 2rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  overflow-x: auto;
  background: var(--bg-panel-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  -webkit-overflow-scrolling: touch;
}

.analysis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: start;
}

.analysis-table thead {
  background: var(--bg-panel-2);
  border-bottom: 2px solid var(--line-strong);
}

.analysis-table th {
  padding: 0.85rem 1rem;
  font-weight: 600;
  color: var(--foreground);
  text-transform: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.analysis-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--foreground-muted);
  vertical-align: top;
}

.analysis-table tbody tr:last-child td {
  border-bottom: none;
}

.analysis-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.analysis-table tbody tr:hover {
  background: var(--bg-panel-hover);
}

.analysis-table td:first-child {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--tide);
  white-space: nowrap;
}

/* Horizontal Rules */
.analysis-content-body hr {
  margin: 2.5rem 0;
  border: none;
  border-top: 1px solid var(--line);
}

/* Inline Code */
.analysis-content-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  color: var(--tide);
}

/* Links inside analysis */
.analysis-content-body a {
  color: var(--tide);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.analysis-content-body a:hover {
  color: var(--tide-hover);
}

/* Loading Skeleton */
.analysis-loading-skeleton {
  padding: 2rem 0;
}

.skeleton-line {
  height: 1.25rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-panel-2) 25%, var(--bg-panel-hover) 50%, var(--bg-panel-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-title {
  height: 2.25rem;
  width: 70%;
  margin-bottom: 1.75rem;
}

.skeleton-meta {
  height: 3rem;
  width: 100%;
  margin-bottom: 2rem;
}

.skeleton-p {
  width: 100%;
}

.skeleton-p-short {
  width: 60%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Unavailable State Card */
.analysis-unavailable-card {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-panel-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin: 1.5rem 0;
}

.unavailable-icon-wrapper {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  border-radius: var(--radius-full);
  background: var(--signal-bg);
  border: 1px solid var(--signal-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--signal);
}

.unavailable-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.unavailable-desc {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--mist);
  max-width: 34rem;
  margin: 0 auto 2rem;
}

.unavailable-available-list {
  margin: 2rem auto;
  max-width: 40rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.unavailable-list-heading {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mist);
  margin-bottom: 1rem;
}

.unavailable-chips-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

/* RTL Specific Overrides */
[dir="rtl"] .analysis-breadcrumb-sep {
  transform: scaleX(-1);
}

[dir="rtl"] .analysis-content-body h2::before {
  margin-inline-end: 0.5rem;
}

[dir="rtl"] .btn-back-hub svg,
[dir="rtl"] .btn-back-hub span.arrow {
  transform: scaleX(-1);
}

[dir="rtl"] .analysis-table th,
[dir="rtl"] .analysis-table td {
  text-align: right;
}

/* Light / White Theme Overrides */
[data-theme="white"] .analysis-container-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="white"] .analysis-ticker-strip {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="white"] .ticker-chip {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="white"] .ticker-chip:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

[data-theme="white"] .ticker-chip.active {
  background: rgba(13, 148, 136, 0.12);
  border-color: #0d9488;
  color: #0d9488;
  box-shadow: 0 0 10px rgba(13, 148, 136, 0.2);
}

[data-theme="white"] .analysis-meta-summary-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="white"] .analysis-table-wrapper {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="white"] .analysis-table thead {
  background: #f1f5f9;
  border-bottom-color: #cbd5e1;
}

[data-theme="white"] .analysis-table th {
  color: #0f172a;
}

[data-theme="white"] .analysis-table td {
  color: #334155;
  border-bottom-color: #e2e8f0;
}

[data-theme="white"] .analysis-table td:first-child {
  color: #0d9488;
}

[data-theme="white"] .analysis-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

[data-theme="white"] .analysis-table tbody tr:hover {
  background: #f1f5f9;
}

[data-theme="white"] .analysis-content-body blockquote {
  background: rgba(13, 148, 136, 0.06);
  border-inline-start-color: #0d9488;
  color: #334155;
}

[data-theme="white"] .analysis-unavailable-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}
