/* ============================================================
   tract-chain-panel.css — Chain of Title Panel Styles
   TitleMind.AI Enhanced VARA GIS Click-for-Chain
   ============================================================ */

/* --------------- Chain Panel Container --------------- */

.chain-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100vh;
  background: #1a1a1a;
  border-left: 1px solid #333;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.chain-panel-hidden {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.chain-panel-visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: all;
}

/* --------------- Panel Header --------------- */

.chain-panel-header {
  padding: 16px 20px;
  background: #222;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
}

.chain-panel-title h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.chain-panel-title #chain-subtitle {
  font-size: 13px;
  color: #888;
  margin: 0;
}

.chain-panel-controls {
  display: flex;
  gap: 8px;
}

.chain-control-btn {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chain-control-btn:hover {
  background: #333;
  border-color: #555;
  color: #fff;
}

/* --------------- Panel Content --------------- */

.chain-panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Loading and Error States */

.chain-loading, .chain-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.chain-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #333;
  border-top: 3px solid #4ECDC4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.chain-error {
  color: #ff6b6b;
}

.error-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

/* --------------- Chain Content --------------- */

.chain-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Timeline Visualization */

.chain-timeline {
  padding: 20px;
  background: #1e1e1e;
  border-bottom: 1px solid #333;
}

/* Documents Section */

.chain-documents {
  padding: 20px;
  border-bottom: 1px solid #333;
}

.chain-documents h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #fff;
  border-bottom: 2px solid #4ECDC4;
  padding-bottom: 8px;
}

.chain-documents-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chain-document {
  background: #242424;
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid #444;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chain-document:hover {
  background: #2a2a2a;
  border-left-color: #4ECDC4;
}

.chain-document.highlighted {
  background: #2d3748;
  border-left-color: #4ECDC4;
  box-shadow: 0 2px 8px rgba(78, 205, 196, 0.2);
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.doc-type {
  font-weight: 600;
  font-size: 14px;
}

.doc-date {
  font-size: 13px;
  color: #888;
  font-family: 'Courier New', monospace;
}

.doc-parties {
  margin-bottom: 12px;
  font-size: 14px;
}

.grantor {
  color: #ff9ff3;
  font-weight: 500;
}

.arrow {
  color: #666;
  margin: 0 8px;
}

.grantee {
  color: #54a0ff;
  font-weight: 500;
}

.doc-details {
  font-size: 12px;
  color: #aaa;
  line-height: 1.4;
  margin-bottom: 12px;
}

.doc-details div {
  margin-bottom: 4px;
}

.doc-consideration, .doc-recording, .doc-interest, .doc-minerals {
  font-family: 'Courier New', monospace;
}

.doc-confidence {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confidence-bar {
  flex: 1;
  height: 4px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b 0%, #feca57 50%, #48dbfb 100%);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.confidence-text {
  font-size: 11px;
  color: #888;
  font-weight: 500;
  min-width: 80px;
  text-align: right;
}

/* Ownership Summary */

.chain-ownership {
  padding: 20px;
  background: #1e1e1e;
}

.chain-ownership h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #fff;
  border-bottom: 2px solid #45B7D1;
  padding-bottom: 8px;
}

.ownership-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.ownership-item {
  background: #242424;
  padding: 12px;
  border-radius: 6px;
  border-left: 3px solid #45B7D1;
}

.ownership-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 500;
}

.ownership-value {
  font-size: 14px;
  color: #fff;
  font-weight: 500;
}

.confidence-score {
  display: flex;
  align-items: center;
  gap: 6px;
}

.confidence-indicator.high {
  filter: brightness(1.2);
}

.confidence-indicator.medium {
  filter: brightness(0.9);
}

.confidence-indicator.low {
  filter: brightness(0.7);
}

/* Warnings and Encumbrances */

.chain-warnings {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 6px;
}

.warning-item {
  color: #ff9ff3;
  font-size: 13px;
}

.encumbrances {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 206, 84, 0.1);
  border: 1px solid rgba(255, 206, 84, 0.3);
  border-radius: 6px;
}

.encumbrance-label {
  font-size: 13px;
  color: #feca57;
  margin-bottom: 8px;
  font-weight: 500;
}

.encumbrance-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.encumbrance-item {
  background: rgba(255, 206, 84, 0.2);
  color: #feca57;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
}

/* No Documents State */

.no-documents {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

/* --------------- Responsive Design --------------- */

@media (max-width: 768px) {
  .chain-panel {
    width: 100%;
    left: 0;
    top: 60px; /* Account for mobile nav */
    height: calc(100vh - 60px);
  }

  .chain-panel-hidden {
    transform: translateY(100%);
  }

  .chain-panel-visible {
    transform: translateY(0);
  }

  .ownership-grid {
    grid-template-columns: 1fr;
  }

  .chain-panel-header {
    padding: 12px 16px;
  }

  .doc-header {
    flex-direction: column;
    gap: 4px;
  }
}

/* --------------- Scrollbar Styling --------------- */

.chain-content::-webkit-scrollbar {
  width: 6px;
}

.chain-content::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.chain-content::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.chain-content::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Firefox scrollbar styling */
.chain-content {
  scrollbar-width: thin;
  scrollbar-color: #444 #1a1a1a;
}