/* Premium Modern Academic skin — scoped to the Research view only.
   The existing markup, IDs, events and application logic remain untouched. */

#researchView {
  --research-red: #c8101e;
  --research-red-strong: #a80d19;
  --research-burgundy: #7f1019;
  --research-red-soft: #fff2f3;
  --research-red-pale: #fff8f8;
  --research-ink: #171a21;
  --research-body: #3f4652;
  --research-muted: #707887;
  --research-border: #e4e7ec;
  --research-border-strong: #d7dbe2;
  --research-surface: #ffffff;
  --research-canvas: #f7f8fa;
  --research-radius-sm: 10px;
  --research-radius: 14px;
  --research-radius-lg: 18px;
  --research-shadow: 0 14px 38px rgba(30, 35, 45, 0.055);
  --research-shadow-hover: 0 18px 44px rgba(80, 15, 22, 0.09);
  color: var(--research-ink);
  font-family: "Be Vietnam Pro", "Inter", system-ui, sans-serif;
  padding: 6px 0 40px;
}

#researchView,
#researchView * {
  box-sizing: border-box;
}

/* Hero: white editorial surface with a restrained academic rule. */
#researchView .research-hero {
  min-height: 230px;
  margin: 0 0 22px;
  padding: 46px 54px 42px 64px;
  display: flex;
  align-items: center;
  gap: 36px;
  background: #fff;
  border: 1px solid var(--research-border);
  border-radius: var(--research-radius-lg);
  box-shadow: var(--research-shadow);
  isolation: isolate;
  overflow: hidden;
}

#researchView .research-hero::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 36px;
  bottom: 36px;
  width: 3px;
  border-radius: 999px;
  background: var(--research-red);
}

#researchView .research-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -58px;
  top: -66px;
  width: 380px;
  height: 310px;
  opacity: .58;
  background-image:
    linear-gradient(rgba(200, 16, 30, .075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 16, 30, .075) 1px, transparent 1px);
  background-size: 28px 28px;
  transform: rotate(-8deg);
  mask-image: linear-gradient(110deg, transparent 2%, #000 62%);
}

#researchView .research-hero-content {
  max-width: 850px;
}

#researchView .research-hero-badge {
  margin: 0 0 15px;
  padding: 0;
  gap: 8px;
  color: var(--research-red-strong);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .13em;
}

#researchView .research-hero-badge i {
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  color: var(--research-red);
  background: var(--research-red-soft);
  border-radius: 8px;
}

#researchView .research-hero h1 {
  max-width: 780px;
  margin: 0 0 13px;
  color: var(--research-burgundy);
  font-family: "Be Vietnam Pro", "Inter", sans-serif;
  font-size: clamp(2rem, 3vw, 3.25rem);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -.035em;
}

#researchView .research-hero-subtitle {
  max-width: 790px;
  margin: 0;
  color: var(--research-body);
  font-size: .97rem;
  font-weight: 400;
  line-height: 1.75;
}

#researchView .research-hero-icon {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  flex: 0 0 112px;
  color: var(--research-red);
  background: var(--research-red-soft);
  border: 1px solid #ffdadd;
  border-radius: 28px;
  font-size: 3.2rem;
  transform: rotate(-3deg);
}

/* Six tools become a single premium academic command rail. */
#researchView .research-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(170px, 1fr));
  gap: 0;
  width: 100%;
  margin: 0 0 24px;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  background: #fff;
  border: 1px solid var(--research-border);
  border-radius: var(--research-radius);
  box-shadow: 0 8px 26px rgba(27, 31, 40, .045);
  scrollbar-width: thin;
  scrollbar-color: #d9dde5 transparent;
}

#researchView .research-tabs::-webkit-scrollbar {
  height: 5px;
}

#researchView .research-tabs::-webkit-scrollbar-thumb {
  background: #d9dde5;
  border-radius: 99px;
}

#researchView .research-tab-btn {
  position: relative;
  min-height: 78px;
  margin: 0 !important;
  padding: 14px 15px !important;
  display: grid;
  grid-template-columns: 28px 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  color: #555e6c;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--research-border);
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-family: "Be Vietnam Pro", "Inter", sans-serif;
  font-size: .72rem !important;
  font-weight: 650;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

#researchView .research-tab-btn:last-child {
  border-right: 0;
}

#researchView .research-tab-btn::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: transparent;
}

#researchView .research-tab-btn:hover {
  color: var(--research-red-strong);
  background: var(--research-red-pale);
}

#researchView .research-tab-btn.active {
  color: var(--research-red-strong);
  background: #fffafa;
  border-bottom-color: transparent;
  font-weight: 800;
}

#researchView .research-tab-btn.active::after {
  background: var(--research-red);
}

#researchView .research-tab-btn > i {
  color: currentColor;
  font-size: 1.05rem;
  text-align: center;
}

#researchView .research-tab-step {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  color: #727b89;
  background: #f1f3f6;
  border-radius: 8px;
  font-size: .68rem;
  font-weight: 800;
}

#researchView .research-tab-btn.active .research-tab-step {
  color: #fff;
  background: var(--research-red);
}

#researchView .research-tab-content {
  animation: researchReveal .28s ease both;
}

@keyframes researchReveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Workspace and panels. */
#researchView .research-layout,
#researchView #tabResearchRebuttal .research-layout,
#researchView #tabResearchMindmap .research-layout,
#researchView #tabResearchCitation .research-layout,
#researchView #tabResearchCrisis .research-layout {
  display: grid;
  grid-template-columns: minmax(370px, 430px) minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  max-width: 100%;
  margin: 0 0 42px;
}

#researchView .research-left-panel {
  gap: 16px;
  min-width: 0;
}

#researchView .research-card,
#researchView #tabResearchRebuttal .research-card,
#researchView #tabResearchMindmap .research-card,
#researchView #tabResearchCitation .research-card,
#researchView #tabResearchCrisis .research-card,
#researchView .research-result-card {
  background: var(--research-surface);
  border: 1px solid var(--research-border);
  border-radius: var(--research-radius);
  box-shadow: var(--research-shadow);
}

#researchView .research-card,
#researchView #tabResearchRebuttal .research-card,
#researchView #tabResearchMindmap .research-card,
#researchView #tabResearchCitation .research-card,
#researchView #tabResearchCrisis .research-card {
  padding: 22px !important;
}

#researchView .research-card-title,
#researchView #tabResearchRebuttal .research-card-title,
#researchView #tabResearchMindmap .research-card-title,
#researchView #tabResearchCitation .research-card-title,
#researchView #tabResearchCrisis .research-card-title {
  position: relative;
  margin: 0 0 20px !important;
  padding: 0 0 14px;
  gap: 10px;
  color: var(--research-ink) !important;
  border-bottom: 1px solid var(--research-border);
  font-size: .98rem !important;
  font-weight: 800;
  line-height: 1.45;
}

#researchView .research-card-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 46px;
  height: 2px;
  background: var(--research-red);
}

#researchView .research-card-title i {
  color: var(--research-red) !important;
}

#researchView .research-form-group {
  margin-bottom: 17px !important;
}

#researchView .research-form-group label {
  margin-bottom: 7px !important;
  color: #444c59;
  font-size: .72rem !important;
  font-weight: 750;
  line-height: 1.4;
  letter-spacing: .035em;
  text-transform: none;
}

#researchView .research-textarea,
#researchView .research-select,
#researchView input.research-select,
#researchView select.research-select,
#researchView #tabResearchCitation input,
#researchView #tabResearchCitation select {
  width: 100%;
  max-width: 100%;
  color: var(--research-ink);
  background: #fbfcfd;
  border: 1px solid var(--research-border-strong);
  border-radius: var(--research-radius-sm);
  font-family: "Be Vietnam Pro", "Inter", sans-serif;
  font-size: .81rem !important;
  outline: 0;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

#researchView .research-textarea {
  min-height: 116px;
  height: 116px;
  padding: 13px 14px;
  resize: vertical;
  line-height: 1.65;
}

#researchView .research-select,
#researchView input.research-select,
#researchView select.research-select,
#researchView #tabResearchCitation input,
#researchView #tabResearchCitation select {
  min-height: 44px !important;
  height: 44px !important;
  padding: 9px 12px !important;
}

#researchView .research-textarea:hover,
#researchView .research-select:hover {
  border-color: #bfc5ce;
}

#researchView .research-textarea:focus,
#researchView .research-select:focus,
#researchView input:focus,
#researchView select:focus,
#researchView textarea:focus {
  background: #fff;
  border-color: var(--research-red) !important;
  box-shadow: 0 0 0 4px rgba(200, 16, 30, .085) !important;
}

#researchView .research-submit-btn {
  min-height: 46px;
  padding: 12px 18px;
  color: #fff;
  background: var(--research-red) !important;
  border: 1px solid var(--research-red) !important;
  border-radius: var(--research-radius-sm);
  box-shadow: 0 8px 18px rgba(168, 13, 25, .14) !important;
  font-family: "Be Vietnam Pro", "Inter", sans-serif;
  font-size: .8rem;
  font-weight: 750;
  letter-spacing: .005em;
  transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}

#researchView .research-submit-btn:hover {
  background: var(--research-red-strong) !important;
  transform: translateY(-1px);
  box-shadow: 0 11px 22px rgba(127, 16, 25, .2) !important;
}

#researchView .research-submit-btn:focus-visible,
#researchView .research-tab-btn:focus-visible,
#researchView .suggested-topic-item:focus-visible,
#researchView .research-copy-btn:focus-visible {
  outline: 3px solid rgba(200, 16, 30, .2);
  outline-offset: 2px;
}

#researchView .suggested-topics-list {
  gap: 9px;
}

#researchView .suggested-topic-item {
  position: relative;
  width: 100%;
  min-height: 74px;
  padding: 12px 34px 12px 12px;
  align-items: flex-start;
  color: inherit;
  background: #fff;
  border: 1px solid var(--research-border);
  border-radius: var(--research-radius-sm);
  box-shadow: none;
  transition: transform .2s ease, border-color .2s ease, background-color .2s ease;
}

#researchView .suggested-topic-item::after {
  content: "\f054";
  position: absolute;
  right: 14px;
  top: 50%;
  color: #9aa1ad;
  font-family: "Font Awesome 6 Free";
  font-size: .7rem;
  font-weight: 900;
  transform: translateY(-50%);
}

#researchView .suggested-topic-item:hover {
  color: inherit;
  background: var(--research-red-pale);
  border-color: #f0b8bd;
  transform: translateX(2px);
}

#researchView .suggested-topic-badge {
  width: 27px;
  height: 27px;
  color: var(--research-red-strong);
  background: var(--research-red-soft);
  border-radius: 8px;
  font-size: .69rem;
}

#researchView .suggested-topic-text {
  margin-bottom: 5px;
  color: #282e38;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.5;
}

#researchView .suggested-topic-cat {
  color: var(--research-muted);
  font-size: .64rem;
  font-weight: 500;
  line-height: 1.45;
}

/* Empty, loading and result states share the same premium surface. */
#researchView .research-empty-state {
  min-height: 440px;
  padding: 68px 34px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--research-muted);
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, #f1d3d6, #e4e7ec) border-box;
  border: 1px solid transparent;
}

#researchView .research-empty-state i {
  width: 82px;
  height: 82px;
  margin: 0 0 22px;
  display: grid;
  place-items: center;
  color: var(--research-red);
  background: var(--research-red-soft);
  border: 1px solid #ffd9dc;
  border-radius: 24px;
  font-size: 2.25rem;
}

#researchView .research-empty-state h3 {
  margin: 0 0 9px;
  color: var(--research-ink);
  font-size: 1.03rem;
  font-weight: 800;
  line-height: 1.45;
}

#researchView .research-empty-state p {
  max-width: 500px;
  color: var(--research-muted);
  font-size: .78rem;
  line-height: 1.75;
}

#researchView .research-loading-overlay {
  background: rgba(255, 255, 255, .94) !important;
  border: 1px solid var(--research-border);
  border-radius: var(--research-radius);
  backdrop-filter: blur(5px);
}

#researchView .research-spinner {
  border-color: #f5c9cd;
  border-left-color: var(--research-red);
}

#researchView .research-loading-text {
  color: var(--research-burgundy) !important;
}

#researchView .research-result-card {
  padding: 28px;
  gap: 24px;
}

#researchView .research-result-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--research-border);
}

#researchView .research-result-badge {
  color: var(--research-red-strong);
  background: var(--research-red-soft);
  border-radius: 7px;
}

#researchView .research-result-title {
  color: var(--research-ink);
  font-family: "Be Vietnam Pro", "Inter", sans-serif;
  font-size: 1.18rem;
  line-height: 1.55;
  text-align: left;
}

#researchView .research-copy-btn {
  color: var(--research-body) !important;
  background: #fff !important;
  border: 1px solid var(--research-border-strong) !important;
  border-radius: 9px;
  font-family: "Be Vietnam Pro", "Inter", sans-serif;
}

#researchView .research-copy-btn:hover {
  color: var(--research-red-strong) !important;
  background: var(--research-red-pale) !important;
  border-color: #efb8bd !important;
}

#researchView .result-section-title {
  color: var(--research-burgundy);
}

#researchView .urgency-content {
  color: var(--research-body);
  background: #fafbfc;
  border-left-color: var(--research-red);
}

#researchView .method-card,
#researchView .chapter-card {
  border-color: var(--research-border);
  box-shadow: none;
}

#researchView .chapter-card-header {
  color: var(--research-burgundy);
  background: var(--research-red-pale);
  border-bottom-color: var(--research-border);
}

#researchView .reference-standard-label {
  margin-bottom: 2px;
  color: var(--research-burgundy);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .045em;
}

#researchView .reference-item {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--research-border);
  border-left: 3px solid var(--research-red);
  border-radius: 10px;
  color: var(--research-body);
  line-height: 1.65;
}

#researchView .reference-item i {
  color: var(--research-red);
}

#researchView .reference-item em {
  color: var(--research-ink);
  font-weight: 700;
}

/* Keep the specialist tools inside the same red-white system. */
#researchView #tabResearchRebuttal,
#researchView #tabResearchMindmap,
#researchView #tabResearchCitation,
#researchView #tabResearchCrisis {
  color: var(--research-body);
  font-size: .8rem;
}

#researchView .bento-grid > *,
#researchView .hyp-result-card,
#researchView .rebuttal-result-card,
#researchView .mindmap-result-card,
#researchView .citation-result-card,
#researchView .crisis-result-card {
  border-radius: var(--research-radius) !important;
}

@media (prefers-reduced-motion: reduce) {
  #researchView *,
  #researchView *::before,
  #researchView *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 1100px) {
  #researchView .research-hero {
    padding-right: 42px;
  }

  #researchView .research-layout,
  #researchView #tabResearchRebuttal .research-layout,
  #researchView #tabResearchMindmap .research-layout,
  #researchView #tabResearchCitation .research-layout,
  #researchView #tabResearchCrisis .research-layout {
    grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  #researchView .research-layout,
  #researchView #tabResearchRebuttal .research-layout,
  #researchView #tabResearchMindmap .research-layout,
  #researchView #tabResearchCitation .research-layout,
  #researchView #tabResearchCrisis .research-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 18px !important;
  }

  #researchView .research-left-panel,
  #researchView .research-layout > div {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #researchView .research-empty-state {
    min-height: 330px;
  }
}

@media (max-width: 768px) {
  #researchView {
    width: 100%;
    max-width: 100%;
    padding: 0 0 26px;
    overflow: hidden;
  }

  #researchView .research-hero {
    min-height: 0;
    margin-bottom: 14px;
    padding: 25px 18px 24px 30px;
    align-items: flex-start;
    border-radius: 13px;
  }

  #researchView .research-hero::before {
    left: 15px;
    top: 22px;
    bottom: 22px;
    width: 2px;
  }

  #researchView .research-hero::after {
    right: -150px;
    top: -100px;
    opacity: .38;
  }

  #researchView .research-hero-badge {
    margin-bottom: 10px;
    font-size: .57rem;
  }

  #researchView .research-hero-badge i {
    width: 23px;
    height: 23px;
    border-radius: 7px;
  }

  #researchView .research-hero h1 {
    margin-bottom: 9px;
    font-size: clamp(1.25rem, 6.3vw, 1.65rem);
    line-height: 1.22;
    letter-spacing: -.025em;
  }

  #researchView .research-hero-subtitle {
    font-size: .72rem;
    line-height: 1.65;
  }

  #researchView .research-hero-icon {
    display: none;
  }

  #researchView .research-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 15px;
    border-radius: 12px;
    scroll-snap-type: x proximity;
  }

  #researchView .research-tab-btn {
    min-width: 158px;
    min-height: 62px;
    padding: 10px 11px !important;
    grid-template-columns: 23px 17px minmax(0, 1fr);
    gap: 7px;
    font-size: .61rem !important;
    line-height: 1.35;
    scroll-snap-align: start;
  }

  #researchView .research-tab-step {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    font-size: .59rem;
  }

  #researchView .research-tab-btn > i {
    font-size: .86rem;
  }

  #researchView .research-left-panel {
    gap: 13px;
  }

  #researchView .research-card,
  #researchView #tabResearchRebuttal .research-card,
  #researchView #tabResearchMindmap .research-card,
  #researchView #tabResearchCitation .research-card,
  #researchView #tabResearchCrisis .research-card {
    padding: 16px !important;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(25, 29, 38, .045);
  }

  #researchView .research-card-title,
  #researchView #tabResearchRebuttal .research-card-title,
  #researchView #tabResearchMindmap .research-card-title,
  #researchView #tabResearchCitation .research-card-title,
  #researchView #tabResearchCrisis .research-card-title {
    margin-bottom: 15px !important;
    padding-bottom: 11px;
    font-size: .78rem !important;
  }

  #researchView .research-form-group {
    margin-bottom: 13px !important;
  }

  #researchView .research-form-group label {
    font-size: .62rem !important;
  }

  #researchView .research-textarea {
    min-height: 94px;
    height: 94px;
    padding: 10px 11px;
    font-size: .7rem !important;
  }

  #researchView .research-select,
  #researchView input.research-select,
  #researchView select.research-select,
  #researchView #tabResearchCitation input,
  #researchView #tabResearchCitation select {
    min-height: 40px !important;
    height: 40px !important;
    padding: 7px 10px !important;
    font-size: .68rem !important;
  }

  #researchView .research-submit-btn {
    min-height: 42px;
    padding: 10px 12px;
    font-size: .67rem;
  }

  #researchView .suggested-topic-item {
    min-height: 66px;
    padding: 10px 30px 10px 10px;
  }

  #researchView .suggested-topic-badge {
    width: 24px;
    height: 24px;
    font-size: .62rem;
  }

  #researchView .suggested-topic-text {
    font-size: .66rem;
    line-height: 1.48;
  }

  #researchView .suggested-topic-cat {
    font-size: .58rem;
  }

  #researchView .research-empty-state {
    min-height: 255px;
    padding: 35px 18px !important;
    border-radius: 12px;
  }

  #researchView .research-empty-state i {
    width: 62px;
    height: 62px;
    margin-bottom: 16px;
    border-radius: 18px;
    font-size: 1.7rem;
  }

  #researchView .research-empty-state h3 {
    font-size: .82rem;
  }

  #researchView .research-empty-state p {
    font-size: .67rem;
    line-height: 1.65;
  }

  #researchView .research-result-card {
    padding: 17px;
    gap: 18px;
    border-radius: 12px;
  }

  #researchView .research-result-header {
    flex-direction: column;
    gap: 10px;
  }

  #researchView .research-result-title {
    font-size: .9rem;
  }

  #researchView .research-copy-btn {
    margin-top: 0;
    font-size: .66rem;
  }

  #researchView .methods-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  #researchView .research-hero h1 {
    font-size: 1.18rem;
  }

  #researchView .research-hero-subtitle {
    font-size: .67rem;
  }

  #researchView .research-tab-btn {
    min-width: 148px;
  }
}
