/* FILM Markets — Research page styles */

.research-main {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: var(--grid-gap);
  height: calc(100vh - var(--header-h) - var(--ticker-h) - var(--statusbar-h));
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s-3) var(--s-4) 0;
}

/* ── Panel shell ── */
.research-panel {
  background: var(--bg-1);
  border: 1px solid var(--bd-2);
  border-radius: var(--r-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.research-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-2) var(--s-3);
  background: var(--bg-2);
  border-bottom: 1px solid var(--bd-1);
  font-family: var(--ff-mono);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--t-3);
  flex-shrink: 0;
}

.research-panel-head-badge {
  font-size: var(--fs-micro);
  color: var(--info);
  font-weight: 400;
  letter-spacing: normal;
}

.research-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* ── File drop zone ── */
.doc-drop {
  border: 1px dashed var(--bd-3);
  border-radius: var(--r-3);
  padding: var(--s-6) var(--s-4);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-base), background var(--dur-base);
  color: var(--t-3);
  font-size: var(--fs-sm);
  user-select: none;
}
.doc-drop:hover          { border-color: var(--alert); background: var(--alert-bg); color: var(--t-2); }
.doc-drop.dragover       { border-color: var(--info); background: rgba(6,182,212,0.06); }
.doc-drop-icon           { font-size: 1.6rem; margin-bottom: var(--s-2); }
.doc-drop-hint           { font-size: var(--fs-micro); color: var(--t-4); margin-top: var(--s-1); }

/* ── File info card (shown after upload) ── */
.doc-file-info {
  display: none;
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  border-radius: var(--r-2);
  padding: var(--s-2) var(--s-3);
  gap: var(--s-2);
  align-items: center;
}
.doc-file-info.visible { display: flex; }
.doc-file-name {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  color: var(--t-1);
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-file-meta {
  font-family: var(--ff-mono);
  font-size: var(--fs-micro);
  color: var(--t-4);
  white-space: nowrap;
}

/* ── Status ── */
.doc-status {
  display: none;
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-2);
  align-items: center;
  gap: var(--s-2);
}
.doc-status.loading { display: flex; color: var(--info);    background: rgba(6,182,212,0.06); border: 1px solid rgba(6,182,212,0.15); }
.doc-status.success { display: flex; color: var(--up);      background: var(--up-bg);          border: 1px solid rgba(16,185,129,0.2); }
.doc-status.error   { display: flex; color: var(--down);    background: var(--down-bg);        border: 1px solid rgba(239,68,68,0.2); }

/* ── Action buttons ── */
.research-actions {
  display: flex;
  gap: var(--s-2);
}

.res-btn {
  flex: 1;
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-2);
  border: 1px solid var(--bd-2);
  background: var(--bg-2);
  color: var(--t-2);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  text-align: center;
}
.res-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--t-0); border-color: var(--bd-3); }
.res-btn:disabled              { opacity: 0.35; cursor: not-allowed; }
.res-btn--primary {
  background: var(--alert-bg);
  color: var(--alert);
  border-color: rgba(240,185,11,0.3);
}
.res-btn--primary:hover:not(:disabled) { background: rgba(240,185,11,0.15); }

/* ── History ── */
.history-section-lbl {
  font-family: var(--ff-mono);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--t-4);
  padding: var(--s-2) 0 var(--s-1);
  border-top: 1px solid var(--bd-1);
}

.history-list { display: flex; flex-direction: column; gap: 2px; }

.history-item {
  padding: var(--s-2) var(--s-2);
  border-radius: var(--r-2);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.history-item:hover { background: var(--bg-hover); }
.history-item-name { font-size: var(--fs-xs); color: var(--t-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-meta { font-family: var(--ff-mono); font-size: var(--fs-micro); color: var(--t-4); }

/* ── Analysis terminal (right panel) ── */
.analysis-stream {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  line-height: 1.85;
  color: var(--t-1);
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg-0);
  min-height: 200px;
}

.analysis-placeholder {
  color: var(--t-4);
  font-style: normal;
}

.analysis-cursor {
  display: inline-block;
  width: 7px;
  height: 12px;
  background: var(--alert);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Export bar ── */
.export-bar {
  display: flex;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-top: 1px solid var(--bd-1);
  background: var(--bg-2);
  flex-shrink: 0;
}

.export-lbl {
  font-family: var(--ff-mono);
  font-size: var(--fs-micro);
  color: var(--t-4);
  display: flex;
  align-items: center;
  margin-right: var(--s-2);
}

/* Spinner animation */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(6,182,212,0.2);
  border-top-color: var(--info);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .research-main {
    grid-template-columns: 1fr;
    height: auto;
    padding-bottom: calc(var(--statusbar-h) + var(--s-4));
  }
  .analysis-stream { min-height: 300px; max-height: 60vh; }
}
