/* ==========================================================================
   TERMOVA - NEGOTIATION TRACKER & VERSION DIFF TIMELINE CSS
   ========================================================================== */

/* Main Container */
.neg-view-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow-y: auto;
  padding: 1.5rem;
  gap: 1.5rem;
  background: radial-gradient(circle at 10% 15%, rgba(15, 23, 42, 0.95), rgba(10, 15, 30, 0.98));
  color: var(--text-primary, #f8fafc);
}

/* ──── Top Control Bar & Track Switcher ──── */
.neg-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.neg-track-selector-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 280px;
}

.neg-track-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  white-space: nowrap;
}

.neg-select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  min-width: 240px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.neg-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.neg-actions-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-neg-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.btn-neg-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.btn-neg-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-neg-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ──── Track Header Summary Banner ──── */
.neg-track-header {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.neg-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.neg-track-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.neg-track-title-row h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
}

.neg-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 12px;
}

.status-active {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-agreed {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-abandoned {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-paused {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.neg-meta-pills {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: #94a3b8;
}

.neg-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.neg-meta-item strong {
  color: #f1f5f9;
}

/* ──── Sub-Navigation Tabs ──── */
.neg-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.neg-tab-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.neg-tab-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

.neg-tab-btn.active {
  color: #ffffff;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ──── VIEW: Vertical Timeline ──── */
.neg-timeline-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.timeline-container {
  position: relative;
  padding-left: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline-container::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 11px;
  width: 2px;
  background: linear-gradient(180deg, #3b82f6 0%, #8b5cf6 50%, rgba(255, 255, 255, 0.1) 100%);
}

.timeline-node {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-marker {
  position: absolute;
  left: -2rem;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  z-index: 2;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.marker-counterparty {
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.timeline-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.timeline-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateX(3px);
}

.timeline-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.version-source-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.source-internal {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.source-counterparty {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.timeline-risk-chip {
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline-key-changes {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.timeline-change-bullet {
  font-size: 0.83rem;
  color: #cbd5e1;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.timeline-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  color: #94a3b8;
}

/* ──── VIEW: Concession Ledger ──── */
.neg-ledger-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ledger-balance-banner {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.balance-status-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.balance-tag {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
}

.balance-favorable {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.balance-balanced {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.balance-unfavorable {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.ledger-columns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.ledger-column {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ledger-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ledger-col-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.col-we-gave {
  color: #f87171;
}

.col-they-gave {
  color: #34d399;
}

.concession-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.concession-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

.concession-category-tag {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.concession-significance {
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.sig-critical {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.sig-high {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.sig-medium {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.sig-low {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.4);
}

.concession-summary-text {
  font-size: 0.88rem;
  color: #f1f5f9;
  font-weight: 500;
}

/* ──── VIEW: Risk Trajectory SVG Chart ──── */
.neg-risk-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.risk-chart-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.risk-chart-container {
  width: 100%;
  height: 260px;
  position: relative;
}

.risk-svg-chart {
  width: 100%;
  height: 100%;
}

/* ──── VIEW: Diff Viewer ──── */
.neg-diff-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.diff-controls-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.diff-clause-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.diff-clause-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.diff-content-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.84rem;
  line-height: 1.6;
  overflow-x: auto;
}

/* ──── VIEW: AI Negotiation Summary ──── */
.neg-summary-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.summary-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.summary-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #818cf8;
}

.summary-bullet-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
}

.summary-bullet-list li {
  font-size: 0.88rem;
  color: #cbd5e1;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

/* ──── Modals ──── */
.neg-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.neg-modal-content {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.neg-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.neg-modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.neg-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.neg-form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
}

.neg-form-group input,
.neg-form-group select,
.neg-form-group textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #fff;
  font-size: 0.9rem;
}

.neg-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ──── Mobile Responsive Media Queries ──── */
@media screen and (max-width: 768px) {
  .neg-view-container {
    padding: 10px;
    gap: 12px;
  }

  .neg-top-bar {
    padding: 0.85rem 1rem;
  }

  .neg-track-selector-group {
    width: 100%;
  }

  .neg-select {
    width: 100%;
    min-width: 100%;
  }

  .neg-actions-group {
    width: 100%;
    justify-content: space-between;
  }

  .ledger-columns-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .timeline-container {
    padding-left: 1.5rem;
  }

  .timeline-marker {
    left: -1.5rem;
    width: 20px;
    height: 20px;
  }

  .neg-modal-content {
    width: 95vw;
    padding: 1rem;
  }
}
