/* The AI Biographer - Chapters Page Styles */

/* Page Header */
.page-header {
  background: var(--surface);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  text-align: center;
}

.page-header h2 {
  font-size: var(--text-3xl);
  color: var(--primary);
  margin-bottom: var(--space-2);
}

.page-header p {
  color: var(--text-light);
  font-size: var(--text-lg);
}

/* Chapter Stats */
.chapter-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--surface);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: all var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Chapter Actions */
.chapter-actions {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  justify-content: center;
}

.chapter-actions .button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Chapters Container */
.chapters-container {
  background: var(--surface);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.chapters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}

.chapters-header h3 {
  font-size: var(--text-2xl);
  color: var(--primary);
  margin: 0;
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: var(--space-1);
  background: var(--border-light);
  padding: var(--space-1);
  border-radius: var(--radius-base);
}

.view-btn {
  background: transparent;
  border: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  transition: all var(--transition-fast);
}

.view-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Chapters Grid */
.chapters-grid {
  display: grid;
  gap: var(--space-4);
}

.chapters-grid.grid-view {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.chapters-grid.list-view {
  grid-template-columns: 1fr;
}

/* Chapter Card */
.chapter-card {
  background: var(--surface-hover);
  border: 2px solid var(--border);
  border-radius: var(--radius-base);
  padding: var(--space-4);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.chapter-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.chapter-card.finalized {
  border-color: var(--success);
}

.chapter-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: var(--space-3);
}

.chapter-info h4 {
  font-size: var(--text-lg);
  color: var(--text);
  margin: 0 0 var(--space-1) 0;
}

.section-name {
  font-size: var(--text-sm);
  color: var(--text-light);
}

.chapter-status {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
}

.chapter-status.draft {
  background: var(--warning-light);
  color: var(--warning);
}

.chapter-status.finalized {
  background: var(--success-light);
  color: var(--success);
}

.chapter-meta {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-light);
}

.chapter-preview {
  color: var(--text-lighter);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: var(--space-3);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.chapter-actions-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.chapter-actions-row .button {
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
}

/* List View Specific */
.chapters-grid.list-view .chapter-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-4);
}

.chapters-grid.list-view .chapter-content {
  display: grid;
  grid-template-columns: 2fr 3fr 1fr;
  gap: var(--space-4);
  align-items: center;
}

.chapters-grid.list-view .chapter-preview {
  -webkit-line-clamp: 2;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-12);
}

.empty-icon {
  font-size: var(--text-6xl);
  opacity: 0.2;
  margin-bottom: var(--space-4);
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: var(--space-2);
}

.empty-state p {
  color: var(--text-light);
  margin-bottom: var(--space-6);
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: var(--primary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Chapter Editor */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--border-light);
  border-radius: var(--radius-base);
  margin-bottom: var(--space-4);
}

.toolbar-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 var(--space-2);
}

.word-count {
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--text-light);
}

.editor-container {
  position: relative;
  margin-bottom: var(--space-4);
}

.chapter-editor {
  width: 100%;
  min-height: 400px;
  padding: var(--space-4);
  border: 2px solid var(--border);
  border-radius: var(--radius-base);
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: 1.8;
  resize: vertical;
}

.chapter-editor:focus {
  outline: none;
  border-color: var(--primary);
}

.editor-suggestions {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  padding: var(--space-3);
  background: var(--border-light);
}

.suggestion-item {
  padding: var(--space-2);
  margin-bottom: var(--space-2);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-item:hover {
  background: var(--primary-light);
}

/* Organization Analysis */
#organization-analysis {
  max-height: 60vh;
  overflow-y: auto;
}

.organization-section {
  margin-bottom: var(--space-6);
}

.organization-section h3 {
  color: var(--primary);
  margin-bottom: var(--space-3);
}

.chapter-order-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.order-list {
  background: var(--border-light);
  border-radius: var(--radius-base);
  padding: var(--space-3);
}

.order-list h4 {
  margin-bottom: var(--space-2);
  color: var(--text);
}

.order-item {
  padding: var(--space-2);
  margin-bottom: var(--space-1);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.order-arrow {
  display: flex;
  align-items: center;
  font-size: var(--text-2xl);
  color: var(--primary);
}

.narrative-arc {
  background: var(--surface-hover);
  border-left: 4px solid var(--primary);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.narrative-arc h4 {
  color: var(--primary);
  margin-bottom: var(--space-1);
}

.arc-chapters {
  font-size: var(--text-sm);
  color: var(--text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
  .chapter-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .chapters-grid.grid-view {
    grid-template-columns: 1fr;
  }
  
  .chapter-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .modal-content {
    margin: var(--space-2);
  }
}
/* Free Tier Limitations */
.chapter-card.locked {
  opacity: 0.7;
  position: relative;
}

.chapter-card.locked::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 48%, rgba(255,255,255,0.1) 50%, transparent 52%);
  pointer-events: none;
}

.locked-preview {
  font-style: italic;
  color: var(--text-light);
}

.free-tier-notice {
  background: var(--primary);
  color: white;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 8px;
  animation: slideDown 0.3s ease-out;
}

.notice-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.notice-text h4 {
  margin: 0 0 0.5rem 0;
  color: white;
}

.notice-text p {
  margin: 0;
  opacity: 0.9;
}

.notice-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.notice-actions .button {
  margin: 0;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .notice-content {
    flex-direction: column;
    text-align: center;
  }
  
  .notice-actions {
    width: 100%;
    justify-content: center;
  }
}

/* Suggestion Checkboxes */
.suggestions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: 8px;
  gap: 1rem;
}

.select-all-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
}

.select-all-label input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
}

.suggestion-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.suggestion-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.suggestion-checkbox-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-top: 0.25rem;
}

.suggestion-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
}

.suggestion-content {
  flex: 1;
}

.suggestion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.suggestion-type {
  font-weight: 600;
  color: var(--primary);
  text-transform: capitalize;
}

.suggestion-location {
  font-size: 0.875rem;
  color: var(--text-light);
}

.suggestion-issue {
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.suggestion-recommendation {
  font-style: italic;
  color: var(--text);
  background: rgba(var(--primary-rgb), 0.05);
  padding: 0.5rem;
  border-radius: 4px;
  border-left: 3px solid var(--primary);
}

.priority-high {
  color: #dc3545;
}

.priority-medium {
  color: #ffc107;
}

.priority-low {
  color: #28a745;
}
