/**
 * 📜 Bill Text Editor Styles
 * Beautiful, accessible, civic-themed design
 */

/* ===== Text Viewer Overlay ===== */
.bill-text-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(30, 60, 114, 0.98), rgba(42, 82, 152, 0.98));
  backdrop-filter: blur(10px);
  z-index: 10000;
  overflow: scroll;
  display: flex;
  flex-direction: column;
}

.close-text-viewer {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 12px 24px;
  background: rgba(255, 75, 75, 0.9);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1em;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.close-text-viewer:hover {
  background: rgba(255, 75, 75, 1);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 75, 75, 0.4);
}

/* ===== Main Viewer Container ===== */
.bill-text-viewer {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px;
  padding-top: 70px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Header ===== */
.bill-text-header {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.bill-text-title h2 {
  color: white;
  margin: 0 0 8px 0;
  font-size: 1.8em;
  font-weight: 700;
}

.bill-text-meta {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95em;
}

.bill-text-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.version-select,
.control-btn {
  padding: 10px 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95em;
}

.version-select:hover,
.control-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(76, 175, 80, 0.6);
  transform: translateY(-2px);
}

.version-select:focus,
.control-btn:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

/* ===== Section Navigation ===== */
.section-navigation {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.nav-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.nav-btn:disabled {
  background: rgba(255, 255, 255, 0.2);
  cursor: not-allowed;
  opacity: 0.5;
}

.section-indicator {
  color: white;
  font-weight: 600;
  font-size: 1.1em;
}

/* ===== Section Header ===== */
.section-header {
  background: rgba(255, 255, 255, 0.1);
  border-left: 4px solid #4CAF50;
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 20px;
}

.section-header h3 {
  color: white;
  margin: 0 0 8px 0;
  font-size: 1.4em;
}

.section-stats {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9em;
}

/* ===== Lines Container ===== */
.lines-container {
  flex: 1;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Custom scrollbar */
.lines-container::-webkit-scrollbar {
  width: 12px;
}

.lines-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.lines-container::-webkit-scrollbar-thumb {
  background: rgba(76, 175, 80, 0.6);
  border-radius: 10px;
}

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

/* ===== Individual Lines ===== */
.bill-line {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 15px;
  padding: 15px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.bill-line:hover {
  background: rgba(255, 255, 255, 0.12);
  border-left-color: #4CAF50;
  transform: translateX(3px);
}

.bill-line.highlighted {
  animation: highlight 2s ease;
}

@keyframes highlight {
  0%, 100% { background: rgba(255, 255, 255, 0.08); }
  50% { background: rgba(255, 215, 0, 0.3); }
}

/* Line number */
.line-number {
  color: rgba(255, 255, 255, 0.5);
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  font-weight: bold;
  text-align: right;
  padding-top: 3px;
  user-select: none;
}

/* Line content */
.line-content {
  color: white;
  line-height: 1.7;
  font-size: 1.05em;
}

.line-content p {
  margin: 0;
}

.line-content h1,
.line-content h2,
.line-content h3,
.line-content h4 {
  color: #4CAF50;
  margin: 8px 0;
  font-weight: 700;
}

.line-content ul,
.line-content ol {
  margin: 8px 0;
  padding-left: 25px;
}

.line-content li {
  margin: 5px 0;
}

.line-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
}

.line-content th,
.line-content td {
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: left;
}

.line-content th {
  background: rgba(76, 175, 80, 0.2);
  font-weight: 600;
}

.line-content blockquote {
  border-left: 4px solid rgba(76, 175, 80, 0.5);
  padding-left: 15px;
  margin: 10px 0;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
}

/* Special line types */
.line-header {
  background: rgba(76, 175, 80, 0.15);
  border-left-color: #4CAF50;
}

.line-table {
  background: rgba(102, 126, 234, 0.1);
}

/* Indentation */
.indent-1 { padding-left: 30px; }
.indent-2 { padding-left: 60px; }
.indent-3 { padding-left: 90px; }

/* User voted states */
.user-voted-support { border-left-color: #4CAF50; }
.user-voted-oppose { border-left-color: #f44336; }
.user-voted-neutral { border-left-color: #ffc107; }

/* ===== Line Actions ===== */
.line-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding-top: 3px;
}

.action-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: white;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.action-btn.vote-support:hover {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.2);
}

.action-btn.vote-oppose:hover {
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.2);
}

.action-btn.comment:hover {
  border-color: #2196F3;
  background: rgba(33, 150, 243, 0.2);
}

.action-btn.suggest-edit:hover {
  border-color: #ffc107;
  background: rgba(255, 193, 7, 0.2);
}

.action-btn .count {
  font-weight: 600;
}

/* ===== Modals ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 10002;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: linear-gradient(135deg, rgba(30, 60, 114, 0.98), rgba(42, 82, 152, 0.98));
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
  padding: 20px 25px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
}

.modal-header h3 {
  color: white;
  margin: 0;
  font-size: 1.4em;
}

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

.modal-close:hover {
  background: rgba(255, 75, 75, 0.3);
  transform: rotate(90deg);
}

.modal-body {
  padding: 25px;
  overflow-y: auto;
  flex: 1;
}

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

.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

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

/* ===== Comments ===== */
.line-preview {
  background: rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #4CAF50;
}

.line-preview strong {
  color: #4CAF50;
  display: block;
  margin-bottom: 8px;
}

.comments-list {
  margin-bottom: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.no-comments {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 40px 20px;
  font-style: italic;
}

.comment {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 12px;
  border-left: 3px solid rgba(76, 175, 80, 0.5);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.9);
}

.comment-header strong {
  color: #4CAF50;
}

.comment-time {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85em;
}

.comment-text {
  color: white;
  line-height: 1.6;
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.comment-actions {
  display: flex;
  gap: 10px;
}

.comment-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.comment-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #4CAF50;
}

.comment-replies {
  margin-top: 15px;
  padding-left: 20px;
  border-left: 2px solid rgba(255, 255, 255, 0.2);
}

.comment-reply {
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95em;
}

.comment-reply strong {
  color: #4CAF50;
}

.reply-form {
  margin-top: 15px;
  padding-left: 20px;
}

.reply-form textarea {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 10px;
}

.reply-form textarea:focus {
  outline: none;
  border-color: #4CAF50;
}

.add-comment-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.add-comment-form textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-family: inherit;
  font-size: 1em;
  resize: vertical;
}

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

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.char-count {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9em;
}

/* ===== Edit Modal ===== */
.original-text {
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
  border-radius: 6px;
  margin-top: 8px;
  color: white;
  line-height: 1.6;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: white;
  font-weight: 600;
  margin-bottom: 8px;
}

.form-group textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-family: inherit;
  font-size: 1em;
  resize: vertical;
}

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

/* ===== Table of Contents ===== */
.toc-item {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  display: flex;
  gap: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

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

.toc-item.active {
  background: rgba(76, 175, 80, 0.2);
  border-left-color: #4CAF50;
}

.toc-number {
  color: #4CAF50;
  font-weight: bold;
  font-size: 1.2em;
  min-width: 40px;
}

.toc-details {
  flex: 1;
}

.toc-title {
  color: white;
  font-weight: 600;
  margin-bottom: 5px;
}

.toc-stats {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9em;
}

/* ===== Search Results ===== */
.search-input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: black;
  font-size: 1em;
  margin-bottom: 15px;
}

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

.search-results-header {
  color: black;
  font-weight: 600;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.search-result-item {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

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

.search-result-line {
  color: #4CAF50;
  font-weight: bold;
  margin-bottom: 5px;
}

.search-result-section {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9em;
  margin-bottom: 8px;
}

.search-result-text {
  color: black;
  line-height: 1.6;
}

.search-result-text mark {
  background: rgba(255, 215, 0, 0.4);
  color: black;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}

.no-results {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 40px 20px;
  font-style: italic;
}

/* ===== Buttons ===== */
.primary-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1em;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.secondary-btn {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1em;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Update existing bill-btn for text viewer */
.bill-btn.view-text {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.bill-btn.view-text:hover {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ===== 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: 10003;
  transition: bottom 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.toast.show {
  bottom: 30px;
}

.toast-success {
  background: linear-gradient(135deg, #4CAF50, #45a049);
}

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

.toast-info {
  background: linear-gradient(135deg, #2196F3, #1976D2);
}

/* ===== Loading States ===== */
.loading-spinner {
  text-align: center;
  padding: 60px 20px;
  color: white;
  font-size: 1.3em;
}

.loading-spinner::before {
  content: "";
  display: block;
  width: 50px;
  height: 50px;
  margin: 0 auto 20px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.error-message {
  text-align: center;
  padding: 60px 20px;
  color: #f44336;
  font-size: 1.2em;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
  .bill-line {
    grid-template-columns: 50px 1fr;
  }
  
  .line-actions {
    grid-column: 2;
    margin-top: 10px;
  }
}

@media (max-width: 768px) {
  .bill-text-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .bill-text-controls {
    width: 100%;
  }
  
  .version-select,
  .control-btn {
    flex: 1;
    min-width: 120px;
  }
  
  .section-navigation {
    flex-direction: column;
    gap: 10px;
  }
  
  .nav-btn {
    width: 100%;
  }
  
  .bill-line {
    grid-template-columns: 40px 1fr;
    gap: 10px;
    padding: 12px;
  }
  
  .line-actions {
    flex-wrap: wrap;
  }
  
  .action-btn {
    font-size: 0.85em;
    padding: 5px 10px;
  }
  
  .modal-content {
    max-width: 95%;
    max-height: 95vh;
  }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  .bill-line {
    border: 2px solid white;
  }
  
  .action-btn {
    border-width: 3px;
  }
}

/* Focus visible for keyboard navigation */
.bill-line:focus-within {
  outline: 3px solid #4CAF50;
  outline-offset: 2px;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid #4CAF50;
  outline-offset: 2px;
}