/* History Practice Styles */

/* Container Centering */
#history-full-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Header */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.history-page-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  background: var(--accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.history-page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.history-stats-summary {
  display: flex;
  gap: 16px;
}

/* Category Cards */
.history-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.history-category-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.history-category-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(159, 124, 255, 0.2);
  border-color: var(--accent-solid);
}

.history-category-image {
  width: 100%;
  height: 200px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.history-category-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.3) 100%);
}

.history-category-content {
  padding: 24px;
}

.history-category-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  line-height: 1;
}

.history-category-title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.history-category-description {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.history-category-count {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(159, 124, 255, 0.1);
  color: var(--accent-solid);
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Stories Grid */
.history-stories-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
}

.history-story-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.history-story-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(159, 124, 255, 0.15);
  border-color: var(--accent-solid);
}

.history-story-image {
  width: 100%;
  height: 180px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.history-story-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.4) 100%);
}

.history-story-content {
  padding: 20px;
}

.history-story-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.history-story-year {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(159, 124, 255, 0.1);
  color: var(--accent-solid);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.history-story-preview {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Practice Card */
.history-practice-card {
  background: white;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  display: none;
  max-width: 1200px;
  margin: 0 auto;
}

.history-practice-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.history-story-image-preview {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.history-story-info {
  flex: 1;
}

.history-story-info h3 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.history-story-info p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

/* Timer Controls */
.history-timer-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--card-secondary);
  border-radius: 12px;
  border: 2px solid var(--border);
}

.history-timer-select-wrapper {
  flex: 1;
}

.history-countdown-display {
  text-align: center;
  padding: 16px 32px;
  background: linear-gradient(135deg, rgba(159, 124, 255, 0.1), rgba(107, 78, 255, 0.1));
  border-radius: 12px;
  border: 2px solid var(--accent-solid);
}

.history-countdown-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 4px;
}

#history-countdown {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-solid);
  line-height: 1;
}

/* Story Text Display */
.history-story-display {
  background: var(--card-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  max-height: 300px;
  overflow-y: auto;
 
  line-height: 1.5;
  font-size: 1.7rem;
  font-weight: 500;
}

.history-story-display .char {
  transition: all 0.1s ease;
}

.history-story-display .char.current {
  background: rgba(159, 124, 255, 0.2);
  border-radius: 2px;
  padding: 0 2px;
}

.history-story-display .char.correct {
  color: #51cf66;
}

.history-story-display .char.incorrect {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border-radius: 2px;
}
/* Word highlighting - same as dashboard */
.history-story-display .word {
  display: inline-block;
  margin-right: 0.3em; /* Add space between words */
}

.history-story-display .active-word {
  background: rgba(159, 124, 255, 0.466);
  border-radius: 4px;
  padding: 0 6px;
  box-shadow: inset 0 0 0 0.5px rgba(159, 124, 255, 0.582);
  line-height: 1;
  display: inline-block;
  margin-right: 0.3em; /* Keep spacing even when highlighted */
}

.history-story-display .row {
  display: inline-block;
  width: 100%;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.history-story-display .row.fade-out {
  transform: translateY(-50%);
  opacity: 0;
}

/* History Input */
.history-input {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  background: var(--card-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
  transition: border-color 0.2s ease;
  margin-bottom: 24px;
}

.history-input:focus {
  border-color: var(--accent-solid);
  box-shadow: 0 0 0 3px rgba(159, 124, 255, 0.1);
  outline: none;
}

.history-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Stats Display */
.history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.history-stat-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s ease;
}

.history-stat-card:hover {
  border-color: var(--accent-solid);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(159, 124, 255, 0.1);
}

.history-stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 600;
}

.history-stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  background: var(--accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .history-list-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  
  .history-stories-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  .history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .history-stats-summary {
    width: 100%;
    justify-content: space-between;
  }
  
  .history-list-grid,
  .history-stories-grid {
    grid-template-columns: 1fr;
  }
  
  .history-practice-header {
    flex-direction: column;
    text-align: center;
  }
  
  .history-story-image-preview {
    width: 100%;
    height: 200px;
  }
  
  .history-timer-controls {
    flex-direction: column;
  }
  
  .history-stats {
    grid-template-columns: 1fr;
  }
  
  .history-page-title {
    font-size: 1.5rem;
  }
}

/* Scrollbar styling for story display */
.history-story-display::-webkit-scrollbar {
  width: 8px;
}

.history-story-display::-webkit-scrollbar-track {
  background: var(--card-secondary);
  border-radius: 4px;
}

.history-story-display::-webkit-scrollbar-thumb {
  background: var(--accent-solid);
  border-radius: 4px;
}

.history-story-display::-webkit-scrollbar-thumb:hover {
  background: #6b4eff;
}

/* Completion Modal Styles */
.modal-completion {
  max-width: 600px;
  animation: modalSlideIn 0.3s ease;
}

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

.completion-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.completion-stat-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 2px solid var(--border);
  transition: all 0.2s ease;
}

.completion-stat-card.highlight {
  background: linear-gradient(135deg, rgba(159, 124, 255, 0.05), rgba(107, 78, 255, 0.05));
  border-color: rgba(159, 124, 255, 0.2);
}

.completion-stat-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.completion-stat-content {
  flex: 1;
}

.completion-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.completion-stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 4px;
}

.completion-stat-unit {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.completion-details {
  background: var(--card-secondary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.completion-detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.completion-detail-item:last-child {
  border-bottom: none;
}

.completion-detail-icon {
  font-size: 1.25rem;
  width: 32px;
  text-align: center;
}

.completion-detail-label {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 600;
  min-width: 100px;
}

.completion-detail-value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 600;
  flex: 1;
}

.completion-message {
  background: linear-gradient(135deg, rgba(81, 207, 102, 0.1), rgba(55, 178, 77, 0.1));
  border: 2px solid rgba(81, 207, 102, 0.3);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

.completion-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.completion-actions .btn {
  flex: 1;
  min-width: 140px;
}

/* Retry Button Styling */
#history-retry-btn {
  min-width: 200px;
  font-size: 1rem;
  padding: 12px 32px;
}

/* Responsive adjustments for modal */
@media (max-width: 768px) {
  .completion-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .completion-actions {
    flex-direction: column;
  }
  
  .completion-actions .btn {
    width: 100%;
  }
}
