/* Help Panel Styles - Story 7.4 + Legal Footer Refactoring */
/* Matches style.css theme: #f8f9fa backgrounds, #dee2e6 borders */

/* Help button in tools panel */
.panel-help {
  margin-top: auto;
  border-bottom: none !important;
}

.help-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  transition: background 0.2s;
}

.help-btn:hover {
  background: #0056b3;
}

.help-btn .icon {
  font-size: 1.2rem;
}

/* Legal Footer - Sticky at bottom of sidebar */
.legal-footer {
  flex-shrink: 0;
  padding: 10px;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
  
  /* Flexbox settings for responsiveness */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  
  font-size: 0.75rem;
  line-height: 1.4;
  color: #6c757d;
  overflow: hidden;
}

.legal-footer a {
  color: #6c757d;
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
  display: inline-block;
  padding: 2px 4px;
}

.legal-footer a:hover {
  color: #007bff;
  text-decoration: underline;
}

.legal-footer .sep {
  display: none;
}

/* Help modal container */
.help-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
}

.help-modal.visible {
  display: flex;
}

/* Semi-transparent backdrop */
.help-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

/* Dialog box */
.help-dialog {
  position: relative;
  z-index: 9001;
  max-width: 800px;
  width: 90%;
  max-height: 85vh;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Header with title and close button */
.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 2px solid #007bff;
  background: #f8f9fa;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.help-header h2 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.5rem;
}

.help-header .close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #6c757d;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  transition: color 0.2s;
}

.help-header .close-btn:hover {
  color: #2c3e50;
}

.help-header .close-btn:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Navigation tabs */
.help-nav {
  display: flex !important;
  border-bottom: 1px solid #dee2e6;
  padding: 0 1rem;
  background: #f8f9fa;
  overflow-x: auto;
  flex-shrink: 0;
  min-height: 48px;
  z-index: 10;
  position: relative;
}

.help-nav button {
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: #495057;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  font-size: 0.875rem;
}

.help-nav button:hover {
  background: rgba(0, 123, 255, 0.05);
  color: #007bff;
}

.help-nav button[aria-selected="true"] {
  border-bottom-color: #007bff;
  color: #007bff;
  font-weight: 600;
}

.help-nav button:focus {
  outline: 2px solid #007bff;
  outline-offset: -2px;
}

/* Content area */
.help-content {
  padding: 2rem;
  overflow-y: auto;
  flex: 1 1 auto;
  background: white;
  color: #495057;
  line-height: 1.6;
  position: relative;
  z-index: 1;
  transition: opacity 0.2s ease-in-out;
}

/* Loading spinner */
.loading-spinner {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
  font-style: italic;
}

/* Error message */
.help-content .error {
  color: #dc3545;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  padding: 1rem;
  border-radius: 4px;
}

/* Markdown content styling */
.help-content h1 {
  color: #2c3e50;
  font-size: 2rem;
  margin-top: 0;
  margin-bottom: 1rem;
  border-bottom: 2px solid #007bff;
  padding-bottom: 0.5rem;
}

.help-content h2 {
  color: #2c3e50;
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.help-content h3 {
  color: #495057;
  font-size: 1.25rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.help-content p {
  margin-bottom: 1rem;
}

.help-content ul,
.help-content ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

.help-content li {
  margin-bottom: 0.5rem;
}

.help-content a {
  color: #007bff;
  text-decoration: none;
}

.help-content a:hover {
  text-decoration: underline;
}

.help-content code {
  background: #f8f9fa;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
}

.help-content pre {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.help-content pre code {
  background: none;
  padding: 0;
}

.help-content blockquote {
  border-left: 4px solid #007bff;
  padding-left: 1rem;
  margin-left: 0;
  color: #6c757d;
  font-style: italic;
}

.help-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.help-content th,
.help-content td {
  border: 1px solid #dee2e6;
  padding: 0.75rem;
  text-align: left;
}

.help-content th {
  background: #f8f9fa;
  font-weight: 600;
}

.help-content hr {
  border: none;
  border-top: 1px solid #dee2e6;
  margin: 2rem 0;
}

/* Disable body scroll when help panel active */
body.help-panel-active {
  overflow: hidden;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .help-dialog {
    width: 95%;
    max-height: 90vh;
  }

  .help-header {
    padding: 1rem;
  }

  .help-header h2 {
    font-size: 1.25rem;
  }

  .help-nav {
    padding: 0 0.5rem;
  }

  .help-nav button {
    padding: 0.75rem 0.75rem;
    font-size: 0.8125rem;
  }

  .help-content {
    padding: 1rem;
  }

  .help-content h1 {
    font-size: 1.5rem;
  }

  .help-content h2 {
    font-size: 1.25rem;
  }

  .help-content h3 {
    font-size: 1.125rem;
  }
}

/* Scrollbar styling for content area */
.help-content::-webkit-scrollbar {
  width: 8px;
}

.help-content::-webkit-scrollbar-track {
  background: #f8f9fa;
}

.help-content::-webkit-scrollbar-thumb {
  background: #dee2e6;
  border-radius: 4px;
}

.help-content::-webkit-scrollbar-thumb:hover {
  background: #c8ccd0;
}

/* Focus indicators for accessibility */
.help-nav button:focus-visible,
.help-header .close-btn:focus-visible,
.help-btn:focus-visible {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}
