/* Research workspace — scoped to the report-generation page. */
body.research-page {
  background:
    radial-gradient(ellipse at 14% 0%, rgba(59, 130, 246, 0.06), transparent 38rem),
    var(--bg-secondary, #0a0e17);
  font-family: "DM Sans", system-ui, sans-serif;
}

body.research-page > .container.my-5 {
  width: min(100% - 2rem, 1440px);
  max-width: 1440px;
  margin-top: clamp(1.2rem, 3vw, 2.5rem) !important;
  margin-bottom: 2.6rem !important;
}

body.research-page .page-header {
  position: relative;
  overflow: hidden;
  min-height: 160px;
  padding: clamp(1.35rem, 3.2vw, 2.5rem);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: linear-gradient(112deg, rgba(20, 31, 49, 0.98), rgba(17, 29, 49, 0.95));
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.16), inset 0 1px rgba(255, 255, 255, 0.035);
}

body.research-page .page-header::after {
  position: absolute;
  top: -150px;
  right: 12%;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(0, 232, 157, 0.09);
  content: "";
  filter: blur(58px);
  pointer-events: none;
}

body.research-page .page-header > .d-flex { position: relative; z-index: 1; }
body.research-page .page-header h1 { color: #eff6fd; font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 750; letter-spacing: -0.045em; }
body.research-page .page-header p { color: #91a2b7 !important; font-size: 0.9rem; }
body.research-page .research-hero-icon { display: inline-flex; vertical-align: middle; filter: drop-shadow(0 6px 14px rgba(62, 207, 142, 0.14)); }
body.research-page .header-illustration { border: 1px solid rgba(148, 163, 184, 0.09); border-radius: 12px; background: rgba(255, 255, 255, 0.018); }

body.research-page .research-input-card,
body.research-page .research-report-card {
  border: 1px solid rgba(110, 139, 173, 0.18);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(20, 31, 49, 0.98), rgba(16, 26, 42, 0.98));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14), inset 0 1px rgba(255, 255, 255, 0.025);
}

body.research-page .research-input-card {
  margin-bottom: 1.2rem;
  padding: 0;
}

body.research-page .research-input-card .card-body { padding: clamp(1rem, 2.4vw, 1.65rem); }
body.research-page #research-form .row { --bs-gutter-x: 1rem; --bs-gutter-y: 0.95rem; }

body.research-page #research-form .form-label {
  margin-bottom: 0.45rem;
  color: #b7c5d5;
  font-size: 0.76rem;
  font-weight: 700 !important;
  letter-spacing: 0.025em;
}

body.research-page #ticker-input,
body.research-page #provider-select,
body.research-page #prompt-type-select {
  min-height: 46px;
  border: 1px solid rgba(148, 163, 184, 0.19);
  border-radius: 9px;
  color: #e4edf7;
  background-color: rgba(13, 22, 37, 0.86);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.02);
  font-size: 0.86rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

body.research-page #ticker-input::placeholder { color: #77889e; }
body.research-page #ticker-input:focus,
body.research-page #provider-select:focus,
body.research-page #prompt-type-select:focus {
  border-color: rgba(0, 232, 157, 0.52);
  box-shadow: 0 0 0 3px rgba(0, 232, 157, 0.1);
}

body.research-page #ticker-input { font: 650 0.95rem ui-monospace, "Cascadia Code", monospace; letter-spacing: 0.035em; }
body.research-page #ticker-input::placeholder { font: 400 0.83rem "DM Sans", system-ui, sans-serif; letter-spacing: 0; }

body.research-page #generate-btn {
  min-height: 46px;
  border: 1px solid rgba(0, 232, 157, 0.45);
  border-radius: 9px;
  color: #06271d;
  background: linear-gradient(105deg, #19c997, #09d4a0);
  box-shadow: 0 7px 18px rgba(0, 211, 156, 0.15);
  font-size: 0.87rem;
  font-weight: 750;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

body.research-page #generate-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 10px 23px rgba(0, 211, 156, 0.22);
}

body.research-page #generate-btn:focus-visible { outline: 3px solid rgba(0, 232, 157, 0.35); outline-offset: 2px; }

body.research-page .research-input-card .card-body > .mt-3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  margin-top: 1.15rem !important;
  padding-top: 0.95rem;
  border-top: 1px solid rgba(148, 163, 184, 0.11);
}

body.research-page .research-input-card .card-body > .mt-3 > small {
  margin-right: 0.35rem !important;
  color: #8596ab !important;
  font-size: 0.72rem;
  font-weight: 650;
}

body.research-page #quick-select-container { display: contents; }

body.research-page .quick-select-btn {
  min-width: 64px;
  min-height: 36px;
  margin: 0 0.12rem 0.12rem 0 !important;
  padding: 0.38rem 0.85rem;
  border: 1px solid rgba(0, 232, 157, 0.16) !important;
  border-radius: 999px;
  color: #55d7af !important;
  background: rgba(0, 232, 157, 0.035) !important;
  font: 700 0.76rem ui-monospace, "Cascadia Code", monospace;
  letter-spacing: 0.035em;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

body.research-page .quick-select-btn:hover,
body.research-page .quick-select-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 232, 157, 0.44) !important;
  color: #dffff5 !important;
  background: rgba(0, 232, 157, 0.12) !important;
  box-shadow: 0 0 0 3px rgba(0, 232, 157, 0.07);
}

body.research-page .research-report-card { min-height: 230px; margin-top: 1rem; padding: 0; }
body.research-page .research-report-card > .card-body { padding: clamp(1rem, 2.4vw, 1.8rem); }
body.research-page #report-container .card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; color: #eff6fd; font-size: 1.12rem; font-weight: 750; }
body.research-page #report-container .card-title .badge { margin-left: 0 !important; padding: 0.32rem 0.55rem; border: 1px solid rgba(148, 163, 184, 0.15); border-radius: 999px; color: #b9c9da; background: rgba(148, 163, 184, 0.09) !important; font-size: 0.62rem; font-weight: 650; }
body.research-page #report-container #download-btn { border-color: rgba(0, 232, 157, 0.28); border-radius: 8px; color: #72dfbd; }
body.research-page #report-container #download-btn:hover { color: #effff9; background: rgba(0, 232, 157, 0.11); }
body.research-page #report-container hr { border-color: rgba(148, 163, 184, 0.15); opacity: 1; }

body.research-page .research-report-content {
  color: #cfdae7;
  font-size: 0.92rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

body.research-page .research-report-content h1,
body.research-page .research-report-content h2,
body.research-page .research-report-content h3,
body.research-page .research-report-content h4 {
  margin: 1.7rem 0 0.7rem;
  color: #77dcb9;
  font-weight: 720;
  letter-spacing: -0.02em;
}

body.research-page .research-report-content h1:first-child,
body.research-page .research-report-content h2:first-child,
body.research-page .research-report-content h3:first-child { margin-top: 0; }
body.research-page .research-report-content h1 { font-size: 1.55rem; }
body.research-page .research-report-content h2 { font-size: 1.28rem; }
body.research-page .research-report-content h3 { font-size: 1.08rem; }
body.research-page .research-report-content p,
body.research-page .research-report-content li { color: #c1cedd; }
body.research-page .research-report-content strong { color: #edf5fc; }
body.research-page .research-report-content a { color: #71c6ff; text-decoration-color: rgba(113, 198, 255, 0.4); }
body.research-page .research-report-content blockquote { margin: 1rem 0; padding: 0.65rem 1rem; border-left: 3px solid #2bc99b; border-radius: 0 8px 8px 0; color: #a9bacb; background: rgba(0, 232, 157, 0.045); }
body.research-page .research-report-content ul,
body.research-page .research-report-content ol { padding-left: 1.35rem; }
body.research-page .research-report-content li { margin: 0.3rem 0; }
body.research-page .research-report-content code { padding: 0.12rem 0.35rem; border: 1px solid rgba(148, 163, 184, 0.12); border-radius: 5px; color: #a5d8ff; background: rgba(4, 10, 18, 0.42); font-size: 0.85em; }
body.research-page .research-report-content pre { max-width: 100%; overflow: auto; padding: 1rem; border: 1px solid rgba(148, 163, 184, 0.13); border-radius: 9px; color: #c8d6e5; background: rgba(5, 12, 22, 0.6); }
body.research-page .research-report-content pre code { padding: 0; border: 0; background: transparent; }
body.research-page .research-report-content table { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
body.research-page .research-report-content th,
body.research-page .research-report-content td { padding: 0.55rem 0.7rem; border: 1px solid rgba(148, 163, 184, 0.15); text-align: left; }
body.research-page .research-report-content th { color: #e2edf7; background: rgba(148, 163, 184, 0.07); }
body.research-page .research-report-content img { max-width: 100%; height: auto; border-radius: 8px; }

body.research-page #loading-spinner { display: flex; align-items: center; justify-content: center; }
body.research-page #loading-spinner.d-none { display: none; }
body.research-page .loading-spinner { width: 100%; padding: 3.5rem 1rem; }
body.research-page .loading-spinner p { color: #a0b0c3 !important; }
body.research-page .footer { border-top: 1px solid rgba(148, 163, 184, 0.12); background: #111a29 !important; }
body.research-page .footer p,
body.research-page .footer small,
body.research-page .footer a { color: #8393a8 !important; }
body.research-page .footer hr { border-color: rgba(148, 163, 184, 0.16); }

@media (max-width: 767px) {
  body.research-page > .container.my-5 { width: calc(100% - 1.1rem); margin-top: 0.85rem !important; }
  body.research-page .page-header { min-height: 0; padding: 1.2rem; }
  body.research-page .research-input-card .card-body { padding: 1rem; }
  body.research-page #research-form .row > div { margin-bottom: 0.65rem !important; }
  body.research-page #research-form .row > div:last-child { margin-bottom: 0 !important; }
  body.research-page .research-input-card .card-body > .mt-3 { align-items: flex-start; }
  body.research-page #report-container .card-body > .d-flex { align-items: flex-start !important; gap: 0.65rem; }
  body.research-page .footer .row > div { text-align: left !important; }
}

@media (max-width: 420px) {
  body.research-page .page-header h1 { font-size: 1.45rem; }
  body.research-page .quick-select-btn { min-width: 54px; min-height: 33px; padding-inline: 0.65rem; }
  body.research-page .research-report-content { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  body.research-page *, body.research-page *::before, body.research-page *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
