/* The AI Biographer - Dashboard Styles */

/* Biography Header */
.biography-header {
  background: var(--surface);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-8);
}

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

.progress-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.progress-bar {
  height: 12px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  transition: width var(--transition-slow);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-text {
  font-size: var(--text-sm);
  color: var(--text-light);
  margin: 0;
}

/* Sections Grid */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

/* Section Card */
.section-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.section-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
  transition: background var(--transition-base);
}

.section-card[data-section="early-years"]::before { background: var(--section-early-years); }
.section-card[data-section="education"]::before { background: var(--section-education); }
.section-card[data-section="coming-of-age"]::before { background: var(--section-coming-of-age); }
.section-card[data-section="career"]::before { background: var(--section-career); }
.section-card[data-section="relationships"]::before { background: var(--section-relationships); }
.section-card[data-section="family-life"]::before { background: var(--section-family-life); }
.section-card[data-section="challenges"]::before { background: var(--section-challenges); }
.section-card[data-section="passions"]::before { background: var(--section-passions); }
.section-card[data-section="wisdom"]::before { background: var(--section-wisdom); }
.section-card[data-section="legacy"]::before { background: var(--section-legacy); }

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

.section-card.completed {
  border-color: var(--success);
}

.section-card.in-progress {
  border-color: var(--primary);
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.section-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.section-header h3 {
  flex: 1;
  font-size: var(--text-xl);
  margin: 0;
  color: var(--primary);
}

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

.section-status.not-started {
  background: var(--border-light);
  color: var(--text-light);
}

.section-status.in-progress {
  background: var(--primary);
  color: var(--text-inverse);
}

.section-status.completed {
  background: var(--success);
  color: var(--text-inverse);
}

/* Section Content */
.section-description {
  color: var(--text-light);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.section-meta {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-lighter);
}

.section-action {
  width: 100%;
  background: var(--primary);
  color: var(--text-inverse);
  border: none;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.section-action:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.section-card.completed .section-action {
  background: var(--success);
}

.section-card.completed .section-action:hover {
  background: var(--success-light);
}

.section-card.in-progress .section-action {
  background: var(--secondary);
}

/* Quick Actions */
.quick-actions {
  background: var(--surface);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.quick-actions h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
  color: var(--primary);
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.action-btn {
  background: var(--surface-hover);
  border: 2px solid var(--border);
  padding: var(--space-4);
  border-radius: var(--radius-base);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
}

.action-btn:hover {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.action-btn .icon {
  font-size: var(--text-2xl);
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

#user-name {
  font-weight: 500;
  color: var(--text);
}

#logout-btn {
  background: var(--border-light);
  color: var(--text);
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: var(--radius-base);
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition-fast);
}

#logout-btn:hover {
  background: var(--error);
  color: var(--text-inverse);
}

/* Responsive Design */
@media (max-width: 768px) {
  .sections-grid {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    grid-template-columns: 1fr;
  }
  
  .biography-header {
    padding: var(--space-4);
  }
  
  .biography-header h2 {
    font-size: var(--text-2xl);
  }
}

/* Loading State */
.section-card.loading {
  pointer-events: none;
  opacity: 0.6;
}

.section-card.loading .section-action {
  background: var(--border);
  color: var(--text-light);
}

/* Empty States */
.no-interviews {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-light);
}

.no-interviews .empty-icon {
  font-size: var(--text-5xl);
  opacity: 0.3;
  margin-bottom: var(--space-4);
}

/* Chapter Generation Styles */
.chapter-status {
  margin-top: 10px;
  font-size: 0.9rem;
}

.chapter-badge {
  background: #27ae60;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.chapter-ready {
  color: #f39c12;
  font-weight: 600;
}

.section-card.has-chapter {
  border-color: #27ae60;
}

.button-secondary {
  background: transparent;
  color: #3498db;
  border: 1px solid #3498db;
}

.button-secondary:hover {
  background: #3498db;
  color: white;
}

.generate-chapter-btn {
  width: 100%;
}

/* Chapter Modal */
.chapter-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: 2rem;
}

.chapter-modal-content {
  background: white;
  border-radius: 12px;
  max-width: 800px;
  max-height: 90vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.chapter-modal-header {
  padding: 2rem;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chapter-modal-header h2 {
  margin: 0;
  color: #2c3e50;
}

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

.close-modal:hover {
  background: #f8f9fa;
  color: #2c3e50;
}

.chapter-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.chapter-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  color: #7f8c8d;
  font-size: 0.9rem;
}

.chapter-content {
  line-height: 1.8;
  color: #2c3e50;
}

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

.chapter-modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid #e8e8e8;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Chapter Analysis Modal */
.chapter-analysis-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: 2rem;
}

/* Tabs */
.chapter-modal-tabs {
  display: flex;
  gap: 0;
  padding: 0 2rem;
  border-bottom: 1px solid #e8e8e8;
}

.tab-button {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-weight: 500;
  color: #7f8c8d;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.tab-button:hover {
  color: #3498db;
}

.tab-button.active {
  color: #3498db;
  border-bottom-color: #3498db;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Analysis Tab */
.analysis-section {
  margin-bottom: 2rem;
}

.analysis-section h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline-event {
  position: relative;
  padding-bottom: 1rem;
  border-left: 2px solid #e8e8e8;
  padding-left: 1.5rem;
}

.timeline-event::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3498db;
  border: 3px solid white;
}

.event-time {
  font-weight: 600;
  color: #3498db;
  font-size: 0.9rem;
}

.event-description {
  color: #2c3e50;
  margin: 0.25rem 0;
}

.event-source {
  font-size: 0.85rem;
  color: #7f8c8d;
  font-style: italic;
}

.themes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.theme-tag {
  background: #3498db;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.9rem;
}

.redundancies-list {
  list-style: none;
  padding: 0;
}

.redundancies-list li {
  padding: 0.5rem;
  background: #fff3cd;
  border-left: 4px solid #f39c12;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  color: #856404;
}

.narrative-arc {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.narrative-arc h4 {
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.narrative-arc p {
  margin: 0.25rem 0;
  color: #495057;
}

/* Suggestions Tab */
.suggestions-container {
  max-height: 60vh;
  overflow-y: auto;
}

.suggestion-group {
  margin-bottom: 2rem;
}

.suggestion-group h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.priority-high {
  color: #e74c3c;
}

.priority-medium {
  color: #f39c12;
}

.priority-low {
  color: #27ae60;
}

.suggestion-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 4px solid #3498db;
}

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

.suggestion-type {
  font-weight: 600;
  color: #3498db;
  text-transform: capitalize;
}

.suggestion-location {
  font-size: 0.85rem;
  color: #7f8c8d;
}

.suggestion-issue {
  color: #e74c3c;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.suggestion-recommendation {
  color: #2c3e50;
  font-style: italic;
}

/* Version History Tab */
.versions-container {
  max-height: 60vh;
  overflow-y: auto;
}

.version-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.version-card.current {
  border-color: #3498db;
  background: #ecf6ff;
}

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

.version-header h4 {
  margin: 0;
  color: #2c3e50;
}

.version-date {
  font-size: 0.85rem;
  color: #7f8c8d;
}

.version-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: #7f8c8d;
  margin-bottom: 0.5rem;
}

.version-changes {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.version-changes span:first-child {
  color: #27ae60;
}

.version-changes span:last-child {
  color: #e74c3c;
}

.version-actions {
  display: flex;
  gap: 0.5rem;
}

.button-small {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

/* Diff Modal */
.diff-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: 1100;
  padding: 2rem;
}

.diff-modal-content {
  background: white;
  border-radius: 12px;
  max-width: 700px;
  max-height: 80vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.diff-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.diff-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.diff-section {
  margin-bottom: 1.5rem;
}

.diff-section h4 {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.diff-additions {
  color: #27ae60;
}

.diff-deletions {
  color: #e74c3c;
}

.diff-modifications {
  color: #f39c12;
}

.added {
  background: #d4edda;
  color: #155724;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

.deleted {
  background: #f8d7da;
  color: #721c24;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
  text-decoration: line-through;
}

.modification {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 4px;
}

.mod-location {
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.5rem;
}

.mod-original,
.mod-modified {
  margin: 0.25rem 0;
  padding: 0.5rem;
  border-radius: 4px;
}

/* Loading and error states */
.loading {
  text-align: center;
  padding: 2rem;
  color: #7f8c8d;
}

.no-data {
  text-align: center;
  padding: 2rem;
  color: #7f8c8d;
  font-style: italic;
}

.error {
  text-align: center;
  padding: 2rem;
  color: #e74c3c;
}