/**
 * 📜 Clean Bill Text Document Styles
 * Beautiful, uncluttered reading experience with range-based interactions
 */

/* ===== Clean Text Viewer Container ===== */
.clean-text-viewer {
  display: flex;
  min-height: 100vh;  
  overflow-y: auto;  /* NEW: Make this container scroll */
  background: linear-gradient(135deg, rgba(30, 60, 114, 0.98), rgba(42, 82, 152, 0.98));
  position: relative;
}

/* ===== Indicator Lane (Left Side) ===== */
.indicator-lane {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 100vh;
  background: rgba(30, 60, 114, 0.95);
  border-right: 2px solid rgba(76, 175, 80, 0.5);
  z-index: 100;
  pointer-events: none; /* Allow clicks through the lane */
}

.indicator-arrow {
  position: absolute;
  left: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  border-radius: 4px;
  cursor: pointer;
  pointer-events: auto; /* But allow clicks on arrows */
  transition: opacity 0.2s ease, top 0.1s linear; /* Smooth scroll animation */
  cursor: pointer;  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.indicator-arrow:hover {
  transform: translateX(5px) scale(1.1);
  transform: scale(1.2);
  box-shadow: 0 4px 16px rgba(76, 175, 80, 0.6);
}

.arrow-symbol {
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.arrow-count {
  background: rgba(255, 255, 255, 0.9);
  color: #4CAF50;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ===== Document Wrapper ===== */
.document-wrapper {
  flex: 1;
  margin-left: 50px;
  max-width: calc(100% - 50px);
  margin-right: auto;
  padding: 40px 60px;
 background: rgba(255, 255, 255, 0.98);
 box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
  min-height: 100vh;
}

/* ===== Document Header ===== */
.document-header {
  border-bottom: 3px solid #4CAF50;
  padding-bottom: 20px;
  margin-bottom: 40px;
}

.document-header h1 {
  color: #2d3748;
  font-size: 2em;
  font-weight: 700;
  margin: 0 0 10px 0;
  line-height: 1.3;
}

.document-meta {
  display: flex;
  gap: 20px;
  color: #4a5568;
  font-size: 0.95em;
  flex-wrap: wrap;
}

.document-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ===== Document Content ===== */
.document-content {
  color: #2d3748;
  line-height: 1.8;
  font-size: 1.1em;
  font-family: 'Georgia', 'Times New Roman', serif;
}

/* Beautiful typography for bill text */
.document-content h1 {
  color: #1a202c;
  font-size: 2em;
  font-weight: 700;
  margin: 40px 0 20px 0;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
}

.document-content h2 {
  color: #2d3748;
  font-size: 1.6em;
  font-weight: 600;
  margin: 35px 0 18px 0;
  border-left: 4px solid #667eea;
  padding-left: 15px;
}

.document-content h3 {
  color: #4a5568;
  font-size: 1.3em;
  font-weight: 600;
  margin: 30px 0 15px 0;
}

.document-content h4,
.document-content h5,
.document-content h6 {
  color: #4a5568;
  font-weight: 600;
  margin: 25px 0 12px 0;
}

.document-content p {
  margin: 15px 0;
  text-align: justify;
}

.document-content ul,
.document-content ol {
  margin: 15px 0;
  padding-left: 40px;
}

.document-content li {
  margin: 8px 0;
}

.document-content blockquote {
  border-left: 4px solid #cbd5e0;
  padding-left: 20px;
  margin: 20px 0;
  color: #4a5568;
  font-style: italic;
}

.document-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  font-size: 0.95em;
}

.document-content th,
.document-content td {
  padding: 12px;
  border: 1px solid #e2e8f0;
  text-align: left;
}

.document-content th {
  background: #f7fafc;
  font-weight: 600;
  color: #2d3748;
}

.document-content tr:hover {
  background: #f7fafc;
}

/* Hover effect for clickable text */
.document-content p:hover,
.document-content li:hover,
.document-content td:hover {
  background: rgba(102, 126, 234, 0.05);
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 4px;
  margin: 0 -4px;
  transition: all 0.2s ease;
}

/* ===== Loading State ===== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 20px;
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(102, 126, 234, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

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

.spinner-small {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(102, 126, 234, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-state p {
  color: #718096;
  font-size: 1.1em;
}

/* ===== Error State ===== */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 20px;
  text-align: center;
}

.error-icon {
  font-size: 4em;
  margin-bottom: 20px;
}

.error-state h3 {
  color: #e53e3e;
  font-size: 1.5em;
  margin-bottom: 10px;
}

.error-state p {
  color: #718096;
  font-size: 1.1em;
}

/* ===== Interaction Panel (Floating) ===== */
.interaction-panel {
  position: fixed;
  background: linear-gradient(135deg, rgba(30, 60, 114, 0.98), rgba(42, 82, 152, 0.98));
  backdrop-filter: blur(10px);

  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 400px;
  max-height: 80vh; /* 🆕 UPDATED: Max 80% of viewport */
  bottom: 1vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  animation: panelSlideIn 0.3s ease;
}

@keyframes panelSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.panel-header {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
}

.panel-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.8em;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.panel-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.panel-body {
  padding: 20px;
  flex: 1;
  max-height: calc(80vh - 70px); /* Subtract header height */

}

.panel-body::-webkit-scrollbar {
  width: 10px;
}

.panel-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.panel-body::-webkit-scrollbar-thumb {
  background: rgba(76, 175, 80, 0.6);
  border-radius: 5px;
}

.panel-body::-webkit-scrollbar-thumb:hover {
  background: rgba(76, 175, 80, 0.8);
}

.panel-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

.panel-loading p {
  color: #718096;
  margin-top: 15px;
}

/* ===== Context Preview ===== */
.context-preview {
  background: rgba(0, 0, 0, 0.3);
  border-left: 4px solid #667eea;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 4px;
}

.context-preview strong {
  color: #86efac;
  display: block;
  margin-bottom: 8px;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.context-preview p {
  color: rgba(255, 255, 255, 0.9);
  font-style: italic;
  margin: 0;
  line-height: 1.6;
}

/* ===== Editor Section ===== */
.editor-section {
  margin-bottom: 20px;
}

.editor-section label {
  display: block;
  color: white;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.95em;
}

.editor-section textarea {
  width: 100%;
  padding: 12px;
  /* 🆕 UPDATED: Dark input fields */
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-family: inherit;
  font-size: 0.95em;
  resize: vertical;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

.editor-section textarea:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.editor-section textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.char-counter {
  text-align: right;
  color: #a0aec0;
  font-size: 0.85em;
  margin-top: -10px;
  margin-bottom: 15px;
}

/* ===== Action Buttons ===== */
.action-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.action-buttons button {
  padding: 10px 16px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9em;
}

.btn-support {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
  grid-column: span 1;
}

.btn-support:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.btn-oppose {
  background: linear-gradient(135deg, #f56565, #e53e3e);
  color: white;
  grid-column: span 1;
}

.btn-oppose:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

.btn-neutral {
  background: linear-gradient(135deg, #ecc94b, #d69e2e);
  color: white;
  grid-column: span 1;
}

.btn-neutral:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(236, 201, 75, 0.4);
}

.btn-submit-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  grid-column: span 3;
  padding: 12px;
  font-size: 1em;
}

.btn-submit-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* ===== Grouped Interactions ===== */
.grouped-interactions {
  border-top: 2px solid rgba(255, 255, 255, 0.2);
  padding-top: 20px;
  margin-top: 20px;
}

.grouped-interactions h4 {
  /* 🆕 UPDATED: White heading */
  color: white;
  font-size: 1em;
  margin: 0 0 15px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.no-interactions {
  text-align: center;
  padding: 40px 20px;
  color: #a0aec0;
  font-style: italic;
}

.interactions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 15px;
}

/* ===== Individual Interaction Item ===== */
.interaction-item {
  /* 🆕 UPDATED: Darker background */
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  border-left: 3px solid rgba(76, 175, 80, 0.5);
  transition: all 0.3s ease;
}

.interaction-item:hover {
  background: rgba(255, 255, 255, 0.15);
  border-left-color: #4CAF50;
  transform: translateX(3px);
}

.interaction-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.interaction-icon {
  font-size: 1.2em;
}

.interaction-header strong {
  /* 🆕 UPDATED: Green username */
  color: #86efac;
  font-size: 0.9em;
}

.interaction-time {
  /* 🆕 UPDATED: Lighter time */
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85em;
  margin-left: auto;
}

.vote-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  color: #667eea;
  font-size: 0.9em;
  font-weight: 600;
}

.action-buttons button.voted {
  background: rgba(76, 175, 80, 0.3) !important;
  border: 2px solid #4CAF50 !important;
}

.interaction-text {
  /* 🆕 UPDATED: White text */
  color: rgba(255, 255, 255, 0.9);
  margin: 8px 0;
  line-height: 1.6;
  font-size: 0.95em;
}

.edit-suggestion {
  margin: 8px 0;
}

.edit-suggestion strong {
  color: #2d3748;
  font-size: 0.85em;
  display: block;
  margin-bottom: 5px;
}

.edit-suggestion p {
  color: #4a5568;
  font-size: 0.9em;
  font-style: italic;
  margin: 5px 0;
}

.edit-rationale {
  color: #718096;
  font-size: 0.85em;
  margin-top: 8px;
}

.interaction-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.upvote-btn {
  background: transparent;
  border: 1px solid #cbd5e0;
  color: #718096;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 600;
  transition: all 0.3s ease;
}

.upvote-btn:hover {
  background: #f7fafc;
  border-color: #667eea;
  color: #667eea;
  transform: translateY(-1px);
}

.upvote-btn.upvoted {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

.reply-count {
  color: #a0aec0;
  font-size: 0.85em;
  display: flex;
  align-items: center;
  gap: 5px;
}

.show-more-btn {
  width: 100%;
  padding: 10px;
  background: #edf2f7;
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  color: #4a5568;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.show-more-btn:hover {
  background: #e2e8f0;
  border-color: #667eea;
  color: #667eea;
}

/* ===== Toast Notifications ===== */
.toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 25px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  z-index: 10000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  transition: bottom 0.3s ease;
  min-width: 300px;
  text-align: center;
}

.toast.show {
  bottom: 30px;
}

.toast-success {
  background: linear-gradient(135deg, #48bb78, #38a169);
}

.toast-error {
  background: linear-gradient(135deg, #f56565, #e53e3e);
}

.toast-info {
  background: linear-gradient(135deg, #4299e1, #3182ce);
}

/* Clean Text Viewer Overlay */
.clean-text-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: white;
  overflow-y: auto;
}

.close-clean-viewer {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 24px;
  /* 🆕 UPDATED: Match error color from legislative */
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.close-clean-viewer:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Style for the new button */
.bill-btn.clean-text {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
}

.bill-btn.clean-text:hover {
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
  transform: translateY(-2px);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
  .document-wrapper {
    padding: 30px 40px;
  }
  
  .interaction-panel {
    width: 350px;
  }
}

@media (max-width: 768px) {
  .indicator-lane {
    width: 30px;
  }
  
  .document-wrapper {
    margin-left: 35px;
    padding: 20px 25px;
  }
  
  .document-header h1 {
    font-size: 1.5em;
  }
  
  .document-content {
    font-size: 1em;
  }
  
  .interaction-panel {
    width: 90vw;
    max-width: 350px;
    max-height: 80vh;
    left: 5vw !important;
    right: 5vw;
  }
  
  .action-buttons {
    grid-template-columns: 1fr;
  }
  
  .btn-submit-primary {
    grid-column: span 1;
  }
}

/* ===== Print Styles ===== */
@media print {
  .indicator-lane,
  .interaction-panel {
    display: none !important;
  }
  
  .document-wrapper {
    margin: 0;
    padding: 20px;
    box-shadow: none;
  }
  
  .document-content p:hover,
  .document-content li:hover,
  .document-content td:hover {
    background: none;
    cursor: default;
  }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .interaction-panel {
    border: 3px solid black;
  }
  
  .document-content p:hover,
  .document-content li:hover {
    outline: 2px solid black;
  }
}

/* Focus styles for keyboard navigation */
button:focus-visible,
textarea:focus-visible {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

.interaction-item:focus-within {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* ===== Vote Summary (Aggregate Display) ===== */
.vote-summary {
  background: rgba(0, 0, 0, 0.3);
  border-left: 4px solid #4CAF50;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 4px;
}

.vote-summary h4 {
  color: #86efac;
  margin: 0 0 12px 0;
  font-size: 0.95em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tally-bar {
  display: flex;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tally-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.tally-segment:hover {
  filter: brightness(1.2);
  transform: scaleY(1.1);
}

.tally-segment.support {
  background: linear-gradient(135deg, #48bb78, #38a169);
}

.tally-segment.oppose {
  background: linear-gradient(135deg, #f56565, #e53e3e);
}

.tally-segment.neutral {
  background: linear-gradient(135deg, #ecc94b, #d69e2e);
}

.vote-count {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85em;
  margin: 0;
  text-align: center;
}

/* ===== Bill Vote Section ===== */
.bill-vote-section {
  background: rgba(255, 255, 255, 0.95);
  border-left: 4px solid #667eea;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.bill-vote-header h3 {
  color: #2d3748;
  margin: 0 0 8px 0;
  font-size: 1.3em;
}

.bill-vote-header p {
  color: #4a5568;
  margin: 0 0 15px 0;
}

.bill-vote-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.bill-vote-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.bill-vote-btn.support {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
}

.bill-vote-btn.oppose {
  background: linear-gradient(135deg, #f56565, #e53e3e);
  color: white;
}

.bill-vote-btn.neutral {
  background: linear-gradient(135deg, #ecc94b, #d69e2e);
  color: white;
}

.bill-vote-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tally-bar-wrapper {
  margin-bottom: 10px;
}

.vote-totals {
  text-align: center;
  color: #4a5568;
  font-size: 0.9em;
  margin: 0;
}

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

/* Header vote tally styling */
.vote-tally {
  display: flex;
  gap: 12px;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

.tally-support {
  color: #38a169;
  font-weight: 600;
}

.tally-oppose {
  color: #e53e3e;
  font-weight: 600;
}

/* ===== Document Controls ===== */
.document-controls {
  display: flex;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
  align-items: center;
}

.control-select {
  padding: 8px 12px;
  border: 2px solid #cbd5e0;
  border-radius: 6px;
  background: white;
  font-size: 0.95em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-select:hover {
  border-color: #667eea;
}

.control-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.control-btn {
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

/* Ask Claude button special styling */
.control-btn-claude {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: 2px solid rgba(59, 130, 246, 0.5);
  animation: pulseGlow 2s infinite;
}

.control-btn-claude:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.5);
  transform: translateY(-2px) scale(1.05);
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
  }
}

/* ===== Search Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-content-small {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 2px solid #e2e8f0;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  color: #2d3748;
  font-size: 1.3em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2em;
  color: #a0aec0;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #f7fafc;
  color: #2d3748;
  transform: rotate(90deg);
}

.modal-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.search-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1em;
  margin-bottom: 20px;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#searchResults,
#billTextSearchResults {
  width: 100%;
  display: block;
  position: relative;
  z-index: 1;
}

/* Ensure search results are visible */
#searchResults > *,
#billTextSearchResults > * {
  display: block;
  visibility: visible;
  opacity: 1;
}

.search-hint,
.search-error,
.search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: #a0aec0;
  font-style: italic;
}

.search-error {
  color: #e53e3e;
}

.search-results-header {
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.search-results-list {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  visibility: visible !important;
  opacity: 1 !important;
}

.search-result-item {
  display: flex !important;
  gap: 12px;
  padding: 12px;
  background: #f7fafc;
  border-radius: 8px;
  border-left: 3px solid #667eea;
  cursor: pointer;
  transition: all 0.2s ease;
  visibility: visible !important;
  opacity: 1 !important;
}

.search-result-item:hover {
  background: #edf2f7;
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-result-number {
  color: #667eea;
  font-weight: 700;
  font-size: 0.9em;
  min-width: 30px;
}

.search-result-text {
  flex: 1;
  color: #4a5568;
  line-height: 1.6;
}

.search-result-text mark {
  background: #fef08a;
  color: #2d3748;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 3px;
}

/* ===== Table of Contents Modal ===== */
.toc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: white;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toc-item:hover {
  background: #edf2f7;
  border-color: #667eea;
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.toc-level-1 {
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(135deg, #f7fafc, #edf2f7);
}

.toc-level-2 {
  margin-left: 20px;
  font-weight: 600;
  font-size: 15px;
}

.toc-level-3 {
  margin-left: 40px;
  font-weight: 500;
  font-size: 14px;
}

.toc-level-4 {
  margin-left: 60px;
  font-size: 13px;
}

.toc-number {
  color: #667eea;
  font-weight: 700;
  min-width: 30px;
}

.toc-title {
  flex: 1;
  color: #2d3748;
}

.toc-empty {
  text-align: center;
  color: #718096;
  padding: 40px 20px;
  font-style: italic;
}

/* ===== Search Highlight ===== */
.search-highlight {
  animation: highlightFade 3s ease-in-out;
  background: linear-gradient(90deg, transparent, rgba(255, 235, 59, 0.5), transparent);
  background-size: 200% 100%;
  padding: 4px 0;
  border-left: 4px solid #ffd700;
  margin-left: -4px;
  padding-left: 4px;
}

/* Highlight just the matched text */
.search-text-highlight {
  background: rgba(255, 235, 59, 0.8);
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
  animation: searchTextFade 3s ease-in-out;
  box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
}

@keyframes searchTextFade {
  0% {
    background: rgba(255, 235, 59, 0.9);
    box-shadow: 0 0 15px rgba(255, 235, 59, 0.7);
  }
  50% {
    background: rgba(255, 235, 59, 0.8);
    box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
  }
  100% {
    background: rgba(255, 235, 59, 0.3);
    box-shadow: 0 0 5px rgba(255, 235, 59, 0.2);
  }
}

@keyframes highlightFade {
  0% {
    background-position: 100% 0;
    border-left-color: #ffd700;
  }
  50% {
    background-position: 0 0;
    border-left-color: #ffd700;
  }
  100% {
    background-position: -100% 0;
    border-left-color: transparent;
  }
}

/* ===== Expandable Vote Analytics ===== */
.bill-vote-section.collapsed .bill-vote-tally,
.bill-vote-section.collapsed .bill-vote-header p {
  display: none;
}

.bill-vote-section {
  transition: all 0.3s ease;
}

.bill-vote-header {
  cursor: pointer;
  position: relative;
  user-select: none;
}

.bill-vote-header::after {
  content: '▼';
  position: absolute;
  right: 0;
  top: 0;
  font-size: 0.8em;
  color: #667eea;
  transition: transform 0.3s ease;
}

.bill-vote-section.collapsed .bill-vote-header::after {
  transform: rotate(-90deg);
}

.bill-vote-header:hover {
  background: rgba(102, 126, 234, 0.05);
  border-radius: 4px;
  margin: -5px;
  padding: 5px;
}