/* ============================================================
   MeetIntel — style.css
   Aesthetic: editorial dark, warm ink tones, refined monospace
   ============================================================ */

:root {
  --bg: #0f0e0d;
  --surface: #1a1815;
  --surface2: #232018;
  --border: #2e2b26;
  --border-light: #3a362f;
  --text: #e8e0d0;
  --text-muted: #8a8070;
  --text-dim: #504840;
  --accent: #d4a853;
  --accent-dim: #8a6a2a;
  --accent2: #7eb8a4;
  --accent3: #c17a6a;
  --accent4: #8a9fc4;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;
  --radius: 8px;
  --radius-lg: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Noise texture overlay */
.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

/* ---- HEADER ---- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 14, 13, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-mark {
  font-size: 1.4rem;
  color: var(--accent);
  line-height: 1;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
}

.header-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ---- HERO / INPUT PAGE ---- */
.hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 4rem;
  align-items: start;
}

.hero-text h1 {
  font-family: var(--font-display);
  font-size: 3.2rem;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1.2rem;
}

.hero-text h1 em {
  font-style: italic;
  color: var(--accent);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* Input Card */
.input-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Tabs */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 0.85rem 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.tab:hover {
  color: var(--text);
  background: var(--surface2);
}

.tab.active {
  color: var(--accent);
  background: var(--surface2);
  border-bottom: 2px solid var(--accent);
}

/* Tab panels */
.tab-panel {
  display: none;
  padding: 1.25rem;
}

.tab-panel.active {
  display: block;
}

/* Textarea */
textarea {
  width: 100%;
  height: 260px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  padding: 1rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--accent-dim);
}

textarea::placeholder {
  color: var(--text-dim);
}

.char-count {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(212, 168, 83, 0.04);
}

.drop-icon {
  font-size: 2rem;
  opacity: 0.4;
}

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

.drop-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.file-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.file-selected {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent2);
  margin-top: 0.5rem;
}

/* Analyze button */
.analyze-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: calc(100% - 2.5rem);
  margin: 0 1.25rem 1.25rem;
  padding: 0.9rem;
  position: relative;
  overflow: hidden;
  z-index: 1;
  background: var(--accent);
  color: #0f0e0d;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.progress-percent {
  display: inline-block;
  min-width: 2.2em;
  text-align: right;
  font-weight: 600;
}

.btn-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--accent); /* Solid bright gold fill */
  transition: width 0.4s ease;
  z-index: 0;
}

.btn-text,
.btn-spinner {
  position: relative;
  z-index: 2;
}

.analyze-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.analyze-btn:active {
  transform: translateY(0);
}

.analyze-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.analyze-btn.is-loading:disabled {
  opacity: 1; /* Stops fading when analyzing */
  background: var(--accent-dim); /* Dark solid gold empty track */
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #0f0e0d;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error box */
.error-box {
  margin: 0 1.25rem 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(193, 122, 106, 0.1);
  border: 1px solid var(--accent3);
  border-radius: var(--radius);
  color: var(--accent3);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

/* ============================================================
   RESULTS PAGE
   ============================================================ */

body.results-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.results-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

/* Dashboard (left) */
.dashboard {
  overflow-y: auto;
  padding: 2rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dash-section {
  animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dash-section:nth-child(1) {
  animation-delay: 0.05s;
}

.dash-section:nth-child(2) {
  animation-delay: 0.1s;
}

.dash-section:nth-child(3) {
  animation-delay: 0.15s;
}

.dash-section:nth-child(4) {
  animation-delay: 0.2s;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Speakers */
.speakers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.speaker-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: border-color 0.2s;
}

.speaker-card:hover {
  border-color: var(--border-light);
}

.speaker-name {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.speaker-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: capitalize;
}

.speaker-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Topics */
.topics-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topics-more-btn.inline {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0 0.2rem;
  margin: 0;
  letter-spacing: 0.04em;
  text-decoration: none;
  align-self: center;
}

.topics-more-btn.inline:hover {
  opacity: 0.75;
}

.topic-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text);
  transition: all 0.2s;
}

.topic-chip:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

.topic-chip.high {
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* Decisions */
.decision-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.decision-item {
  background: var(--surface);
  border-left: 3px solid var(--accent2);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.75rem 1rem;
}

.decision-text {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.decision-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Action Items Table */
.action-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.action-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.action-table th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.65rem 1rem;
  text-align: left;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.action-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}

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

.action-table tr:hover td {
  background: var(--surface2);
}

.action-table td:first-child {
  font-family: var(--font-mono);
  color: var(--text-dim);
  width: 2.5rem;
}

.owner-tag {
  display: inline-block;
  background: rgba(126, 184, 164, 0.12);
  border: 1px solid rgba(126, 184, 164, 0.3);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent2);
}

.deadline-tag {
  display: inline-block;
  background: rgba(212, 168, 83, 0.1);
  border: 1px solid rgba(212, 168, 83, 0.25);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
}

/* Viz Panel (right) */
.viz-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

.viz-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.viz-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.25rem;
}

.speaker-dot {
  background: var(--accent);
}

.topic-dot {
  background: var(--accent2);
}

.decision-dot {
  background: var(--accent4);
}

.action-dot {
  background: var(--accent3);
}

.viz-frame {
  flex: 1;
  border: none;
  background: #fff;
  width: 100%;
}

/* Header action buttons */
.export-btn,
.new-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.export-btn {
  background: var(--accent);
  color: #0f0e0d;
  border: none;
}

.export-btn:hover {
  opacity: 0.85;
}

.new-btn {
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.new-btn:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.entity-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent2);
  letter-spacing: 0.05em;
}

/* Skeleton loaders */
.skeleton-card,
.skeleton-pill,
.skeleton-row {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

.skeleton-card {
  height: 80px;
}

.skeleton-pill {
  height: 30px;
  width: 100px;
  display: inline-block;
  border-radius: 20px;
  margin: 0.25rem;
}

.skeleton-row {
  height: 40px;
  margin-bottom: 0.5rem;
}

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

  100% {
    background-position: -200% 0;
  }
}

/* Empty states */
.empty-state {
  color: var(--text-dim);
  font-size: 0.82rem;
  font-style: italic;
  padding: 0.5rem 0;
}

/* Responsive */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 3rem 1.5rem;
    gap: 2rem;
  }

  .results-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: auto;
  }

  body.results-page {
    overflow: auto;
    height: auto;
  }

  .viz-frame {
    height: 500px;
  }
}

/* Email Button with Progress */
.email-speakers-btn {
  font-family: var(--font-mono);
  font-size: 0.77rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0; /* Padding handled by text wrapper for relative positioning */
  height: 38px;
  min-width: 160px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  position: relative;
  overflow: hidden;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.email-speakers-btn:not(:disabled) {
  background: var(--accent2);
  color: #0f0e0d;
  border: none;
}

.email-speakers-btn .btn-text {
  position: relative;
  z-index: 2;
  padding: 0.4rem 0.85rem;
}

.email-speakers-btn .btn-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--accent); /* Solid bright gold fill */
  transition: width 0.4s ease;
  z-index: 1;
}

/* Shimmer Animation for Progress Bar */
.email-speakers-btn.is-summarizing .btn-progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer-btn 1.5s infinite;
  z-index: 2;
}

@keyframes shimmer-btn {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.email-speakers-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.email-speakers-btn.is-summarizing {
  opacity: 1 !important;
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.email-speakers-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Footer for speaker actions */
.speaker-actions-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Section divider */
.section-divider {
  height: 1px;
  background: var(--border);
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* Tooltip */
.info-tooltip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: help;
  position: relative;
  transition: opacity 0.2s;
}

.info-tooltip.hidden {
  display: none;
}

.info-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: calc(100% + 0.6rem);
  transform: translateY(-50%);
  width: 220px;
  background: var(--surface2);
  border: 1px solid var(--border-light);
  color: var(--text);
  padding: 0.6rem;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  line-height: 1.4;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 13, 0.8);
  backdrop-filter: blur(4px);
  display: none;
  /* Changed from flex to none */
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.show {
  display: flex;
}

.email-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 450px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.speaker-emails-list {
  max-height: 350px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 0.5rem;
}

.email-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.email-row label {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.email-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  outline: none;
}

.email-input:focus {
  border-color: var(--accent-dim);
}

.email-input.error {
  border-color: var(--accent3);
}

.send-btn {
  width: 100%;
  padding: 0.8rem;
  background: var(--accent);
  color: #0f0e0d;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent2);
  color: #0f0e0d;
  padding: 0.75rem 1.5rem;
  border-radius: 40px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}