/* Debate Training System - Core Styles */

/* CSS Variables */
:root {
  /* Colors from spec */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --success: #16a34a;
  --success-light: #22c55e;
  --warning: #ca8a04;
  --warning-light: #eab308;
  --error: #dc2626;
  --error-light: #ef4444;

  /* Neutrals */
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
  margin-bottom: var(--space-md);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* Layout */
.container {
  width: 100%;
  max-width: 32rem;
  margin: 0 auto;
  padding: var(--space-md);
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-content {
  flex: 1;
  padding: var(--space-md);
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.card-header {
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text);
}

.card-muted {
  background: var(--bg);
  border-color: var(--border-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-light);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: var(--success-light);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: var(--error-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--border-light);
  color: var(--text);
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
}

.btn-lg {
  padding: var(--space-lg) var(--space-xl);
  font-size: 1.125rem;
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: var(--radius-full);
}

/* Forms */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.form-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-md);
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 5rem;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

.char-counter {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.char-counter.warning {
  color: var(--warning);
}

.char-counter.error {
  color: var(--error);
}

/* Attack Plan Multi-Row */
.attack-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--bg-card);
}

.attack-row:first-child {
  border-color: var(--primary);
  border-width: 2px;
}

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

.attack-row-label {
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
}

.remove-attack-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.remove-attack-btn:hover {
  color: var(--error);
  background: rgba(220, 38, 38, 0.08);
}

.attack-row .form-group {
  margin-bottom: var(--space-sm);
}

.attack-row .form-group:last-child {
  margin-bottom: 0;
}

.attack-row .form-label {
  font-size: 0.8125rem;
  margin-bottom: var(--space-xs);
}

.attack-row .form-input,
.attack-row .form-select {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9375rem;
}

.attack-row .form-select {
  padding-right: 2.5rem;
}

/* Recording UI */
.recorder {
  text-align: center;
  padding: var(--space-xl);
}

.record-btn {
  width: 5rem;
  height: 5rem;
  border-radius: var(--radius-full);
  background: var(--error);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.record-btn:hover {
  transform: scale(1.05);
}

.record-btn.recording {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(220, 38, 38, 0); }
}

/* Sound Wave Visualizer */
.sound-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  margin-top: var(--space-md);
}

.sound-bar {
  width: 6px;
  background: var(--error);
  border-radius: var(--radius-full);
  transition: height 0.05s ease;
  min-height: 4px;
}

.sound-wave.active .sound-bar:nth-child(1) { animation: soundWave 0.4s ease infinite; }
.sound-wave.active .sound-bar:nth-child(2) { animation: soundWave 0.4s ease infinite 0.1s; }
.sound-wave.active .sound-bar:nth-child(3) { animation: soundWave 0.4s ease infinite 0.2s; }
.sound-wave.active .sound-bar:nth-child(4) { animation: soundWave 0.4s ease infinite 0.15s; }
.sound-wave.active .sound-bar:nth-child(5) { animation: soundWave 0.4s ease infinite 0.25s; }
.sound-wave.active .sound-bar:nth-child(6) { animation: soundWave 0.4s ease infinite 0.05s; }
.sound-wave.active .sound-bar:nth-child(7) { animation: soundWave 0.4s ease infinite 0.3s; }

@keyframes soundWave {
  0%, 100% { height: 8px; }
  50% { height: 32px; }
}

.record-status {
  margin-top: var(--space-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.record-timer {
  font-size: 2.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: var(--space-md);
  color: var(--text);
}

/* Timer */
.timer-display {
  text-align: center;
  padding: var(--space-lg);
  background: var(--bg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
}

.timer-value {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}

.timer-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* Audio Player */
.audio-player {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.audio-player audio {
  width: 100%;
}

/* External Audio Player (Google Drive workaround) */
.audio-player-external {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}

.audio-player-external .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Reference Document Link */
.reference-link {
  text-align: right;
  margin-bottom: var(--space-md);
}

.reference-link a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.reference-link a:hover {
  color: var(--primary);
  background: var(--border-light);
}

.reference-link svg {
  flex-shrink: 0;
}

/* Motion Card */
.motion-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.motion-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
  margin-bottom: var(--space-sm);
}

.motion-text {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: var(--space-md);
}

.position-display {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.position-label {
  font-size: 0.875rem;
  opacity: 0.9;
}

.position-badge {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.position-badge.proposition {
  background: #22c55e;
  color: white;
}

.position-badge.opposition {
  background: #ef4444;
  color: white;
}

/* Argument Scaffold */
.argument-tag-display {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-top: var(--space-md);
  line-height: 1.4;
}

.speaker-version-toggle summary {
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  padding: var(--space-xs) 0;
  list-style: none;
}

.speaker-version-toggle summary::-webkit-details-marker {
  display: none;
}

.speaker-version-toggle summary::before {
  content: '▶ ';
  font-size: 0.7em;
}

.speaker-version-toggle[open] summary::before {
  content: '▼ ';
  font-size: 0.7em;
}

.speaker-version-content {
  font-size: var(--text-sm);
  line-height: 1.5;
}

.speaker-version-content div {
  margin-bottom: var(--space-sm);
}

.speaker-version-content div:last-child {
  margin-bottom: 0;
}

/* Feedback Components */
.feedback-section {
  margin-bottom: var(--space-lg);
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.score-display {
  text-align: center;
  padding: var(--space-lg);
  background: var(--bg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
}

.score-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
}

.score-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Structure Check Table */
.structure-table {
  width: 100%;
  border-collapse: collapse;
}

.structure-table th,
.structure-table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.structure-table th {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.structure-table .indicator {
  font-size: 1.25rem;
  width: 2rem;
  text-align: center;
}

.structure-table .check { color: var(--success); }
.structure-table .partial { color: var(--warning); }
.structure-table .missing { color: var(--error); }

.structure-table .note {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Listening Comparison Table */
#listening-comparison-table td:nth-child(3),
#listening-comparison-table td:nth-child(4) {
  max-width: 150px;
  word-wrap: break-word;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

#listening-comparison-table th:nth-child(3),
#listening-comparison-table th:nth-child(4) {
  font-size: 0.75rem;
}

/* Flow Sheet */
.flow-field {
  margin-bottom: var(--space-md);
}

.flow-field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-xs);
}

.flow-field .field-name {
  font-weight: 500;
}

/* Loading States */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-md);
}

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

/* Error States */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.error-message strong {
  display: block;
  margin-bottom: var(--space-xs);
}

/* Success States */
.success-message {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: var(--success);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

/* Progress Indicator */
.progress-bar {
  height: 0.5rem;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

/* Exercise Progress */
.exercise-progress {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.exercise-dots {
  display: flex;
  gap: var(--space-sm);
}

.exercise-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--radius-full);
  background: var(--border);
}

.exercise-dot.completed {
  background: var(--success);
}

.exercise-dot.current {
  background: var(--primary);
}

/* Exercise Overview */
.exercise-overview-list {
  list-style: none;
  counter-reset: exercise-counter;
}

.exercise-overview-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--bg);
  border-radius: var(--radius-md);
  counter-increment: exercise-counter;
}

.exercise-overview-list li::before {
  content: counter(exercise-counter);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
}

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

.exercise-overview-detail {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.exercise-overview-position {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: var(--space-sm);
}

.exercise-overview-position.proposition {
  background: #dcfce7;
  color: #166534;
}

.exercise-overview-position.opposition {
  background: #fee2e2;
  color: #991b1b;
}

/* Utilities */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* Responsive */
@media (min-width: 640px) {
  .container {
    padding: var(--space-lg);
  }

  h1 { font-size: 2rem; }
}

/* Safe area for mobile */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .page-content {
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  }
}

/* ==========================================
   Visual Polish Enhancements
   ========================================== */

/* Subtle background texture */
body {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(37, 99, 235, 0.02) 0%, transparent 40%);
}

/* Enhanced card styling with subtle hover */
.card {
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Motion card enhancement - subtle animation */
.motion-card {
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.motion-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 70%
  );
  transform: rotate(45deg);
  pointer-events: none;
}

/* Enhanced score display */
.score-display {
  background: linear-gradient(135deg, var(--bg) 0%, rgba(37, 99, 235, 0.05) 100%);
  border: 1px solid var(--border-light);
}

.score-value {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Button polish - subtle depth */
.btn-primary {
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

/* Enhanced feedback items */
.feedback-item {
  position: relative;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  border-left: 4px solid;
}

.feedback-item.success {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-left-color: var(--success);
}

.feedback-item.warning {
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
  border-left-color: var(--warning);
}

.feedback-item.info {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-left-color: var(--primary);
}

.feedback-item h4 {
  margin-bottom: var(--space-sm);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.feedback-item.success h4 { color: #166534; }
.feedback-item.warning h4 { color: #854d0e; }
.feedback-item.info h4 { color: #1e40af; }

.feedback-item p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

/* Enhanced exercise dots */
.exercise-dot {
  transition: all var(--transition-fast);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.exercise-dot.completed {
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.exercise-dot.current {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); }
  50% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); }
}

/* Enhanced table styling */
.structure-table {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.structure-table th {
  background: var(--bg);
}

.structure-table tr:hover td {
  background: var(--border-light);
}

/* Record button pulse when active */
.record-btn.recording {
  animation: pulse-record 1.5s ease-in-out infinite;
}

@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

/* Audio player polish */
audio {
  width: 100%;
  border-radius: var(--radius-md);
  background: var(--bg);
}

audio::-webkit-media-controls-panel {
  background: var(--bg);
}

/* Enhanced loading spinner */
.spinner {
  border-width: 3px;
  border-color: rgba(37, 99, 235, 0.1);
  border-top-color: var(--primary);
}

/* Smooth page transitions */
.page-content {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header polish */
.page-header {
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.95);
}

/* All done celebration card */
#no-assignment .text-center {
  animation: celebrateIn 0.5s ease-out;
}

@keyframes celebrateIn {
  0% { opacity: 0; transform: scale(0.9); }
  50% { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

/* Exercise overview list items - stagger animation */
.exercise-overview-list li {
  animation: slideIn 0.3s ease-out backwards;
}

.exercise-overview-list li:nth-child(1) { animation-delay: 0.05s; }
.exercise-overview-list li:nth-child(2) { animation-delay: 0.1s; }
.exercise-overview-list li:nth-child(3) { animation-delay: 0.15s; }
.exercise-overview-list li:nth-child(4) { animation-delay: 0.2s; }
.exercise-overview-list li:nth-child(5) { animation-delay: 0.25s; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Stat cards on history page - subtle hover */
.stat-card {
  transition: all var(--transition-fast);
}

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

/* Position badge subtle glow */
.position-badge.proposition {
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.position-badge.opposition {
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* ==========================================
   Summary/Crystallization Exercise Styles
   ========================================== */

/* Flow Sheet Display */
.flow-sheet-section {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.flow-sheet-header {
  padding: var(--space-sm) var(--space-md);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.flow-sheet-header.proposition {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border-bottom: 2px solid #22c55e;
}

.flow-sheet-header.opposition {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
  border-bottom: 2px solid #ef4444;
}

.flow-sheet-table-wrapper {
  overflow-x: auto;
  background: var(--bg-card);
}

.flow-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 600px;
}

.flow-sheet-table th,
.flow-sheet-table td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.flow-sheet-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.flow-sheet-table td {
  color: var(--text);
  line-height: 1.4;
}

.flow-sheet-table tbody tr:hover {
  background: var(--border-light);
}

/* Column widths */
.flow-sheet-table .col-num {
  width: 2rem;
  text-align: center;
}

.flow-sheet-table .col-tag {
  width: 20%;
  font-weight: 500;
}

.flow-sheet-table .col-w,
.flow-sheet-table .col-m,
.flow-sheet-table .col-e,
.flow-sheet-table .col-i {
  width: 12%;
}

.flow-sheet-table .col-str {
  width: 3rem;
  text-align: center;
}

.flow-sheet-table .col-notes {
  width: 15%;
  font-style: italic;
  color: var(--text-secondary);
}

/* Strength indicators */
.flow-sheet-table .strength-very-strong {
  color: #166534;
  font-weight: 600;
}

.flow-sheet-table .strength-solid {
  color: #166534;
}

.flow-sheet-table .strength-okay {
  color: var(--warning);
}

.flow-sheet-table .strength-vulnerable {
  color: var(--error);
}

/* Empty cell styling */
.flow-sheet-table .empty-cell {
  color: var(--text-muted);
}

/* Legend */
.flow-sheet-legend {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm);
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.flow-sheet-legend .legend-item {
  white-space: nowrap;
}

.flow-sheet-legend .legend-sep {
  color: var(--border);
}

/* Difficulty Badge */
.difficulty-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: var(--space-sm);
}

.difficulty-badge.easy {
  background: #dcfce7;
  color: #166534;
}

.difficulty-badge.medium {
  background: #fef3c7;
  color: #92400e;
}

.difficulty-badge.hard {
  background: #fee2e2;
  color: #991b1b;
}

/* Guided Questions */
.guided-questions-card {
  border-left: 3px solid var(--primary);
}

.guided-questions-list {
  margin: 0;
  padding-left: 1.25rem;
  list-style: decimal;
}

.guided-questions-list li {
  padding: var(--space-xs) 0;
  line-height: 1.5;
  color: var(--text);
}

/* Simplified Flow (Easy mode — hide W/M/E/I columns) */
.flow-sheet-table.simplified .col-w,
.flow-sheet-table.simplified .col-m,
.flow-sheet-table.simplified .col-e,
.flow-sheet-table.simplified .col-i {
  display: none;
}

/* Clash Hint Row Borders (Easy mode) */
.flow-sheet-table tr.clash-hint-1 {
  border-left: 4px solid #3b82f6;
}

.flow-sheet-table tr.clash-hint-2 {
  border-left: 4px solid #8b5cf6;
}

.flow-sheet-table tr.clash-hint-3 {
  border-left: 4px solid #f59e0b;
}

.clash-hint-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
}

/* Weighing Drill Impact Cards */
.weighing-impacts {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: center;
}

.weighing-impact-card {
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  width: 100%;
  position: relative;
}

.weighing-impact-card.your-side {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.weighing-impact-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.weighing-impact-card.your-side .weighing-impact-label {
  color: var(--primary);
}

.weighing-impact-card.your-side .weighing-impact-label::after {
  content: ' — YOUR SIDE';
  font-weight: 700;
}

.weighing-impact-text {
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

.weighing-vs {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-muted);
  text-align: center;
}

/* Legacy support - keep for backwards compatibility */
.summary-arguments {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.summary-side {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.summary-side-header {
  padding: var(--space-sm) var(--space-md);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-side-header.proposition {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border-bottom: 2px solid #22c55e;
}

.summary-side-header.opposition {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
  border-bottom: 2px solid #ef4444;
}

.summary-side-content {
  padding: var(--space-md);
  background: var(--bg-card);
}

.summary-argument {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.5;
  font-size: 0.9rem;
  color: var(--text);
}

.summary-argument:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.summary-argument strong {
  color: var(--text-secondary);
}

/* Summary Structure Table - slightly wider feedback column */
#summary-structure-table td:nth-child(3) {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Length critique styling */
#summary-length-critique .feedback-item {
  padding: var(--space-sm) var(--space-md);
  margin-bottom: 0;
}

#summary-length-critique .feedback-item p {
  font-size: 0.9rem;
  margin: 0;
}

/* Responsive adjustments for summary */
@media (min-width: 640px) {
  .summary-arguments {
    flex-direction: row;
    gap: var(--space-lg);
  }

  .summary-side {
    flex: 1;
  }
}

/* Network Status Banner */
.network-banner {
  background-color: #FEF3C7;
  border-bottom: 2px solid #F59E0B;
  color: #92400E;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.network-banner.hidden {
  display: none;
}

.network-banner-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success {
  background-color: #065F46;
  color: white;
}

.toast-info {
  background-color: #1E40AF;
  color: white;
}

.toast-error {
  background-color: #991B1B;
  color: white;
}
