/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  padding: 0;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page-wrapper {
  padding: 20px;
  /* push content below the iOS nav bar + safe area */
  padding-top: calc(20px + env(safe-area-inset-top) + 44px); /* 44px ≈ standard nav bar height */
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* Add extra padding on iOS devices to account for navigation bar */
@supports (-webkit-touch-callout: none) {
  .page-wrapper {
    padding-top: 20px;
  }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Flash Messages */
.notice, .alert {
  padding: 15px 20px;
  margin-bottom: 20px;
  border-radius: 8px;
  font-weight: 500;
}

.notice {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-small, .btn-danger {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.2s;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

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

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #545b62;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
  margin-right: 0;
  white-space: nowrap;
}

.btn-tiny {
  padding: 4px 8px;
  font-size: 11px;
  margin-right: 0;
  white-space: nowrap;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
}

.btn-danger:hover {
  background-color: #c82333;
}

/* Make small danger buttons less prominent */
.btn-small.btn-danger {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #dc3545;
  font-size: 12px;
  padding: 5px 10px;
}

.btn-small.btn-danger:hover {
  background-color: #dc3545;
  color: white;
}

/* Make tiny danger buttons even less prominent */
.btn-tiny.btn-danger {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  font-size: 10px;
  padding: 3px 8px;
}

.btn-tiny.btn-danger:hover {
  background-color: #dc3545;
  color: white;
}

/* Dashboard */
.dashboard {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dashboard .header {
  position: static; /* ensure normal flow */
  top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 20px;
}

.dashboard .header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.dashboard .header-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  transition: color 0.2s ease;
}

.dashboard .header-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Flash Messages */
.flash-alert, .flash-notice {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease-out;
}

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

.flash-alert {
  background: #fef2f2;
  border: 2px solid #ef4444;
  color: #991b1b;
}

.flash-notice {
  background: #f0fdf4;
  border: 2px solid #10b981;
  color: #065f46;
}

.flash-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.flash-content {
  flex: 1;
  line-height: 1.5;
}

.flash-content strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.1rem;
}

/* Error Box (within child panels) */
.error-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  background: #fef2f2;
  border: 2px solid #ef4444;
  color: #991b1b;
  animation: slideDown 0.3s ease-out;
}

.error-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.error-content {
  flex: 1;
  line-height: 1.5;
}

.error-content strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.dashboard h1 {
  font-size: 32px;
  color: #2c3e50;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 24px;
  color: #495057;
}

.children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.child-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  border: 2px solid #dee2e6;
}

.child-card h3 {
  font-size: 20px;
  color: #2c3e50;
  margin-bottom: 10px;
}

.child-info {
  color: #6c757d;
  margin-bottom: 15px;
  font-size: 14px;
}

.status {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 15px;
  text-align: center;
}

.status.completed {
  background-color: #d4edda;
  color: #155724;
}

.status.pending {
  background-color: #fff3cd;
  color: #856404;
}

.feedback-section {
  background: #e8f4f8;
  border-left: 4px solid #17a2b8;
  padding: 15px;
  margin: 15px 0;
  border-radius: 6px;
}

.feedback-section h4 {
  color: #0c5460;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.feedback-text {
  color: #2c3e50;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.child-actions {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.empty-state {
  text-align: center;
  color: #6c757d;
  padding: 40px;
  font-size: 18px;
}

/* Forms */
.form-container {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-container h1 {
  margin-bottom: 25px;
  color: #2c3e50;
}

.form-field {
  margin-bottom: 20px;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #495057;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="number"],
.form-field select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 16px;
}

.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: #007bff;
}

.form-actions {
  margin-top: 25px;
  display: flex;
  gap: 10px;
}

.error-messages {
  background-color: #f8d7da;
  color: #721c24;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.error-messages h3 {
  margin-bottom: 10px;
}

.error-messages ul {
  margin-left: 20px;
}

/* Reading Session */
.reading-session {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.reading-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e9ecef;
}

.reading-header h1 {
  color: #2c3e50;
  margin-bottom: 10px;
}

.child-name {
  font-size: 18px;
  color: #6c757d;
}

.passage-section {
  margin-bottom: 40px;
  position: relative;
}

.passage-title {
  text-align: center;
  color: #495057;
  margin-bottom: 20px;
}

.passage-content {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 8px;
  line-height: 2.2;
  font-size: 20px;
  margin-bottom: 15px;
  text-align: justify;
}

.word {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
  user-select: none;
  display: inline-block;
}

.word:hover {
  background-color: #e9ecef;
}

.word.tapped {
  background-color: #ffc107;
  font-weight: bold;
}

.instruction {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  font-size: 14px;
}

.flag-passage-btn {
  position: absolute;
  bottom: -15px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
}

.flag-passage-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.teaching-notes-panel {
  background: #fff9e6;
  border: 3px solid #ffc107;
  border-radius: 10px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.teaching-notes-panel h3 {
  color: #856404;
  margin-bottom: 15px;
  font-size: 20px;
  border-bottom: 2px solid #ffc107;
  padding-bottom: 10px;
}

.teaching-notes-word {
  font-size: 18px;
  color: #2c3e50;
  margin-bottom: 15px;
  padding: 10px;
  background: white;
  border-radius: 6px;
  border-left: 4px solid #ffc107;
}

.teaching-note {
  background: white;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  border-left: 4px solid #17a2b8;
}

.teaching-note:last-child {
  margin-bottom: 15px;
}

.teaching-note h4 {
  color: #17a2b8;
  font-size: 16px;
  margin-bottom: 8px;
  font-weight: 600;
}

.teaching-note p {
  color: #495057;
  line-height: 1.6;
  margin: 0;
  font-size: 15px;
}

.comprehension-section {
  margin-bottom: 40px;
}

.comprehension-section h2 {
  color: #2c3e50;
  margin-bottom: 15px;
}

.questions {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border: 2px solid #dee2e6;
}

.question-text {
  font-size: 18px;
  color: #2c3e50;
  margin-bottom: 10px;
  font-weight: 500;
}

.question-type {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 15px;
  font-style: italic;
}

.star-rating {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.star {
  font-size: 36px;
  background: none;
  border: none;
  cursor: pointer;
  color: #dee2e6;
  transition: color 0.2s;
}

.star:hover {
  color: #ffd700;
}

.star.selected {
  color: #ffd700;
}

.question-card textarea.notes {
  width: 100%;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

.session-notes {
  margin-bottom: 30px;
}

.session-notes h3 {
  color: #495057;
  margin-bottom: 15px;
}

.session-notes textarea {
  width: 100%;
  padding: 15px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
}

.session-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* Skills Dashboard */
.skills-dashboard {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 1400px;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.skills-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e9ecef;
}

.skills-header h1 {
  color: #2c3e50;
}

.skills-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
  text-align: center;
  border: 2px solid #dee2e6;
}

.stat-card h3 {
  font-size: 36px;
  color: #2c3e50;
  margin-bottom: 5px;
}

.stat-card p {
  color: #6c757d;
  font-size: 14px;
  margin: 0;
}

.stat-card.success {
  background: #d4edda;
  border-color: #c3e6cb;
}

.stat-card.success h3 {
  color: #155724;
}

.stat-card.warning {
  background: #fff3cd;
  border-color: #ffeaa7;
}

.stat-card.warning h3 {
  color: #856404;
}

.skills-by-type {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.skill-type-section h2 {
  color: #495057;
  margin-bottom: 20px;
  font-size: 22px;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.skill-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #dee2e6;
}

.skill-card.mastered {
  background: #d4edda;
  border-left-color: #28a745;
}

.skill-card.needs-review {
  background: #fff3cd;
  border-left-color: #ffc107;
}

.skill-card.in-progress {
  background: #d1ecf1;
  border-left-color: #17a2b8;
}

.skill-name {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 5px;
}

.skill-description {
  font-size: 13px;
  color: #6c757d;
  margin-bottom: 15px;
}

.skill-stats {
  margin-top: 15px;
}

.mastery-bar {
  background: #e9ecef;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.mastery-fill {
  background: linear-gradient(90deg, #ffc107 0%, #28a745 100%);
  height: 100%;
  transition: width 0.3s ease;
}

.mastery-details {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6c757d;
}

.mastery-percent {
  font-weight: 600;
  color: #2c3e50;
}

.exposure-count {
  font-style: italic;
}

.last-practiced {
  font-size: 11px;
}

/* Grade Level Section */
.grade-level-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 40px;
  color: white;
}

.grade-level-section h2 {
  color: white;
  font-size: 26px;
  margin-bottom: 10px;
}

.grade-level-intro {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  margin-bottom: 25px;
}

.current-grade-banner {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 25px;
  display: inline-flex;
  align-items: center;
  gap: 15px;
}

.current-grade-banner .label {
  font-size: 16px;
  font-weight: 500;
}

.grade-badge {
  background: white;
  color: #667eea;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 18px;
}

.grade-level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.grade-level-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  color: #2c3e50;
  transition: transform 0.2s, box-shadow 0.2s;
}

.grade-level-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.grade-level-card.current {
  border: 3px solid #ffd700;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.grade-level-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.grade-level-header h3 {
  font-size: 20px;
  color: #2c3e50;
  margin: 0;
}

.confidence-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 16px;
}

.confidence-badge.high {
  background: #28a745;
  color: white;
}

.confidence-badge.medium {
  background: #ffc107;
  color: #333;
}

.confidence-badge.low {
  background: #e9ecef;
  color: #6c757d;
}

.grade-level-progress {
  margin-bottom: 15px;
}

.progress-bar {
  background: #e9ecef;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  height: 100%;
  transition: width 0.3s ease;
}

.grade-level-stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 5px;
}

.grade-level-stats .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0; /* Allow flex items to shrink below content size */
}

.grade-level-stats .stat-number {
  font-size: 20px;
  font-weight: 700;
  color: #667eea;
}

.grade-level-stats .stat-label {
  font-size: 11px;
  color: #6c757d;
  text-align: center;
  word-wrap: break-word;
  max-width: 100%;
}

/* Reading History */
.history-page {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 1200px;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e9ecef;
}

.history-header h1 {
  color: #2c3e50;
  font-size: 28px;
}

.sessions-timeline {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.session-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 25px;
  border-left: 4px solid #007bff;
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.session-header h2 {
  color: #2c3e50;
  font-size: 22px;
  margin: 0;
}

.session-date {
  color: #6c757d;
  font-size: 14px;
}

.session-stats {
  display: flex;
  gap: 30px;
  margin-bottom: 20px;
  padding: 15px;
  background: white;
  border-radius: 8px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-label {
  font-size: 12px;
  color: #6c757d;
  text-transform: uppercase;
  font-weight: 600;
}

.stat-value {
  font-size: 20px;
  color: #2c3e50;
  font-weight: bold;
}

.struggled-words {
  margin-bottom: 20px;
}

.struggled-words h4 {
  color: #495057;
  font-size: 14px;
  margin-bottom: 10px;
}

.word-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-tag {
  background: #ffc107;
  color: #333;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}

.session-feedback {
  background: #e8f4f8;
  border-left: 4px solid #17a2b8;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 6px;
}

.session-feedback h4 {
  color: #0c5460;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.session-feedback p {
  color: #2c3e50;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.passage-details {
  margin-top: 15px;
}

.passage-details summary {
  cursor: pointer;
  color: #007bff;
  font-weight: 600;
  padding: 10px;
  background: white;
  border-radius: 6px;
  user-select: none;
}

.passage-details summary:hover {
  background: #e9ecef;
}

.passage-text {
  margin-top: 15px;
  padding: 20px;
  background: white;
  border-radius: 6px;
  line-height: 1.8;
  color: #495057;
}

/* Skills Page Tabs */
.skills-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0;
}

.tab-btn {
  padding: 12px 24px;
  border: none;
  background: none;
  font-size: 1rem;
  font-weight: 600;
  color: #6c757d;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #495057;
}

.tab-btn.active {
  color: #007bff;
  border-bottom-color: #007bff;
}

.tab-content {
  display: none;
}

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

/* All Skills Tab */
.all-skills-section {
  margin-top: 20px;
}

.all-skills-intro {
  color: #6c757d;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.grade-skills-group {
  margin-bottom: 30px;
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.grade-skills-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin: -20px -20px 0 -20px;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.grade-skills-header:hover {
  background: #f8f9fa;
}

.grade-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.collapse-icon {
  font-size: 0.8rem;
  color: #6c757d;
  transition: transform 0.2s ease;
}

.grade-skills-header h3 {
  margin: 0;
  color: #343a40;
  font-size: 1.1rem;
}

.grade-skills-count {
  font-size: 0.85rem;
  color: #6c757d;
  background: #f8f9fa;
  padding: 4px 10px;
  border-radius: 12px;
}

.grade-skills-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 15px;
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.3s ease, margin 0.3s ease, opacity 0.3s ease;
}

.grade-skills-list.collapsed {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
}

.grade-skills-group.collapsible {
  padding-bottom: 15px;
}

.grade-skills-group.collapsible:not(.expanded) {
  padding-bottom: 0;
}

.grade-skills-group.collapsible:not(.expanded) .grade-skills-header {
  border-bottom: none;
  margin-bottom: 0;
}

.skill-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-radius: 6px;
  background: #f8f9fa;
}

.skill-list-item.practiced {
  background: #f8f9fa;
}

.skill-list-item.unpracticed {
  background: #fafafa;
  opacity: 0.7;
}

.skill-list-info {
  flex: 1;
  min-width: 0;
}

.skill-list-name {
  font-weight: 600;
  color: #343a40;
  display: block;
  margin-bottom: 2px;
}

.skill-list-description {
  font-size: 0.8rem;
  color: #6c757d;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-list-mastery {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 120px;
}

.mini-mastery-bar {
  width: 60px;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}

.mini-mastery-fill {
  height: 100%;
  background: linear-gradient(90deg, #28a745, #20c997);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.mini-mastery-percent {
  font-size: 0.85rem;
  font-weight: 600;
  color: #28a745;
  min-width: 35px;
  text-align: right;
}

.not-practiced-badge {
  font-size: 0.75rem;
  color: #adb5bd;
  background: #e9ecef;
  padding: 4px 8px;
  border-radius: 4px;
}

.assumed-badge {
  font-size: 0.625rem;
  color: #7c3aed;
  background: #ede9fe;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 0.5rem;
}

/* Responsive adjustments for All Skills tab */
@media (max-width: 768px) {
  .skill-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .skill-list-mastery {
    width: 100%;
  }

  .mini-mastery-bar {
    flex: 1;
  }
}

/* Danger Zone */
.danger-zone {
  margin-top: 40px;
  padding: 20px;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  background: #fff5f5;
}

.danger-zone h3 {
  margin: 0 0 10px 0;
  color: #dc3545;
  font-size: 1rem;
}

.danger-zone p {
  margin: 0 0 15px 0;
  color: #721c24;
  font-size: 0.9rem;
}

.danger-zone .btn-danger {
  background: #dc3545;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.danger-zone .btn-danger:hover {
  background: #c82333;
}

/* Loading Animation for Passage Generation */
.passage-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-in;
}

.passage-loading-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loading-content {
  text-align: center;
  color: white;
  max-width: 500px;
  padding: 40px;
}

.loading-animation {
  margin-bottom: 40px;
  position: relative;
  height: 150px;
}

/* Bouncing Book Animation */
.bouncing-book {
  font-size: 80px;
  animation: bounce 1s ease-in-out infinite;
  display: inline-block;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-30px); }
}

/* Sparkles around the book */
.sparkle {
  position: absolute;
  font-size: 24px;
  animation: sparkle 1.5s ease-in-out infinite;
}

.sparkle:nth-child(1) {
  top: 20px;
  left: 30%;
  animation-delay: 0s;
}

.sparkle:nth-child(2) {
  top: 40px;
  right: 30%;
  animation-delay: 0.3s;
}

.sparkle:nth-child(3) {
  bottom: 30px;
  left: 25%;
  animation-delay: 0.6s;
}

.sparkle:nth-child(4) {
  bottom: 30px;
  right: 25%;
  animation-delay: 0.9s;
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(180deg);
  }
}

.loading-message {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 15px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.loading-submessage {
  font-size: 18px;
  opacity: 0.9;
  margin-top: 10px;
}

/* Rotating messages */
.rotating-message {
  min-height: 60px;
  animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Progress dots */
.loading-dots {
  display: inline-block;
  width: 80px;
  text-align: left;
  margin-top: 20px;
}

.loading-dots span {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  margin: 0 4px;
  animation: dotBounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes dotBounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* ===== ADVENTURE MAP STYLES ===== */

/* Child Tabs */
.child-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 20px 0 20px;
  border-bottom: 2px solid #e5e7eb;
  overflow-x: auto;
  scrollbar-width: thin;
}

.child-tab {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
  transition: all 0.2s;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.child-tab:hover {
  color: #667eea;
  background: #f3f4f6;
}

.child-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
  font-weight: 600;
}

.tab-badge {
  background: #e0e7ff;
  color: #667eea;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.child-tab.active .tab-badge {
  background: #667eea;
  color: white;
}

.add-child-tab {
  color: #10b981;
  border-bottom-color: transparent;
}

.add-child-tab:hover {
  color: #059669;
  background: #d1fae5;
  border-bottom-color: #10b981;
}

/* Child Panels */
.child-panel {
  display: none;
  padding: 20px;
  animation: fadeIn 0.3s;
}

.child-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Progress Metrics */
.progress-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
}

/* Checkpoint Progress Widget */
.checkpoint-progress-widget {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.checkpoint-ready {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
  padding: 40px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: white;
}

.checkpoint-icon {
  font-size: 64px;
}

.checkpoint-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.checkpoint-content h3 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: bold;
}

.checkpoint-content p {
  margin: 0 0 20px 0;
  opacity: 0.9;
  font-size: 16px;
}

.btn-checkpoint {
  background: white;
  color: #667eea;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  transition: all 0.2s;
}

.btn-checkpoint:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.checkpoint-progress {
  padding: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.progress-header h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.checkpoints-count {
  color: #667eea;
  font-weight: 600;
  font-size: 14px;
}

.progress-bar-container {
  background: #e5e7eb;
  height: 12px;
  border-radius: 6px;
  overflow: visible;
  margin-bottom: 24px;
  position: relative;
}

.progress-bar {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 6px;
}

.progress-turtle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  transition: left 0.3s ease;
  animation: turtleWalk 1.5s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

@keyframes turtleWalk {
  0%, 100% {
    transform: translate(-50%, -50%) rotate(-2deg);
  }
  50% {
    transform: translate(-50%, -52%) rotate(2deg);
  }
}

.progress-text {
  text-align: center;
  color: #6c757d;
  margin: 0;
  font-size: 14px;
}

/* Primary CTA Container */
.primary-cta-container {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  margin-bottom: 30px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.cta-title {
  color: white;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 20px 0;
}

.btn-cta {
  background: white;
  color: #059669;
  padding: 20px 40px;
  font-size: 22px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: all 0.2s;
  display: inline-block;
  text-decoration: none;
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  background: #f0fdf4;
}

.cta-hint {
  color: rgba(255,255,255,0.95);
  font-size: 14px;
  margin: 16px 0 0 0;
}

.metric {
  text-align: center;
  color: white;
}

.metric-number {
  display: block;
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.metric-label {
  display: block;
  font-size: 0.9rem;
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Adventure Map Container */
.adventure-map-container {
  background: white;
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.map-title {
  font-size: 28px;
  color: #1f2937;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 700;
}

/* Current Progress Banner */
.current-progress-banner {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid #3b82f6;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
  text-align: center;
}

.progress-info {
  margin-bottom: 12px;
}

.progress-label {
  font-size: 14px;
  font-weight: 600;
  color: #1e40af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 6px;
}

.progress-value {
  font-size: 20px;
  font-weight: 700;
  color: #1e40af;
  display: block;
}

.progress-hint {
  font-size: 14px;
  color: #1e40af;
  font-style: italic;
  opacity: 0.9;
}

/* Adventure Map */
.adventure-map {
  display: flex;
  gap: 30px;
  overflow-x: auto;
  padding: 20px 10px;
  scrollbar-width: thin;
  scrollbar-color: #667eea #e5e7eb;
}

.adventure-map::-webkit-scrollbar {
  height: 8px;
}

.adventure-map::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 4px;
}

.adventure-map::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 4px;
}

/* Map Zones */
.map-zone {
  min-width: 300px;
  max-width: 350px;
  background: white;
  border: 3px solid var(--zone-color);
  border-radius: 14px;
  padding: 16px;
  position: relative;
  transition: all 0.3s;
}

.map-zone.current {
  border-width: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 0 0 4px rgba(102, 126, 234, 0.1);
  transform: scale(1.02);
}

.map-zone.locked {
  opacity: 0.5;
  filter: grayscale(80%);
  border-style: dashed;
}

.map-zone.completed {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

/* Zone Header */
.zone-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--zone-color);
}

.zone-emoji {
  font-size: 2.5rem;
  line-height: 1;
}

.zone-info {
  flex: 1;
}

.zone-name {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 4px 0;
}

.zone-grade {
  font-size: 13px;
  font-weight: 600;
  color: var(--zone-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lock-icon, .completed-icon {
  font-size: 1.5rem;
}

/* Zone Path - Continuous */
.zone-path-continuous {
  position: relative;
  height: 90px;
  margin: 12px 0 20px;
}

.path-svg {
  width: 100%;
  height: 100%;
}

.path-trail {
  stroke: var(--zone-color);
  opacity: 0.25;
  stroke-linecap: round;
  transition: all 0.3s;
}

.path-trail.completed {
  opacity: 0.6;
  stroke: #10b981;
}

/* Journey Avatar (on continuous path) */
.journey-avatar {
  position: absolute;
  top: 52%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
}

.avatar-marker {
  font-size: 1.4rem;
}

.avatar-name {
  background: var(--zone-color);
  color: white;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.avatar-label {
  display: none;
}

/* Checkpoint Markers */
.checkpoint-marker {
  position: absolute;
  top: 52%;
  transform: translate(-50%, -50%);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkpoint-marker .checkpoint-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.checkpoint-marker.passed .checkpoint-icon {
  animation: checkpointGlow 2s infinite;
}

.checkpoint-marker.available .checkpoint-icon {
  opacity: 0.5;
  animation: checkpointPulse 1.5s infinite;
}

.checkpoint-marker.failed .checkpoint-icon {
  opacity: 0.6;
}

@keyframes checkpointGlow {
  0%, 100% {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.6));
  }
}

@keyframes checkpointPulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.8;
  }
}

/* Journey Complete Indicator */
.journey-complete {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
}

.complete-icon {
  font-size: 2rem;
  display: block;
  animation: celebratePulse 2s infinite;
}

@keyframes celebratePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* Milestone Counter */
.milestone-counter {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: var(--zone-color);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 2px solid var(--zone-color);
}

/* Zone Locked Message */
.zone-locked-message {
  text-align: center;
  padding: 20px;
  color: #6b7280;
  font-size: 14px;
  font-style: italic;
}

/* Action Cards */
.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.action-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s;
}

.action-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
  transform: translateY(-2px);
}

.action-card.primary-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  grid-column: 1 / -1;
}

.action-card h3 {
  font-size: 18px;
  margin: 0 0 12px 0;
  color: #1f2937;
}

.action-card.primary-card h3 {
  color: white;
  font-size: 24px;
}

.action-card p {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.action-card.primary-card p {
  color: rgba(255,255,255,0.95);
  font-size: 16px;
}

.btn-large {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
}

/* Empty State */
.empty-state-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 40px;
}

.empty-state {
  text-align: center;
  max-width: 500px;
}

.empty-state h2 {
  font-size: 28px;
  color: #1f2937;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 24px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .progress-metrics {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .metric-number {
    font-size: 2rem;
  }

  .primary-cta-container {
    padding: 20px;
  }

  .cta-title {
    font-size: 20px;
  }

  .btn-cta {
    padding: 16px 32px;
    font-size: 18px;
  }

  .current-progress-banner {
    padding: 15px;
  }

  .progress-label {
    font-size: 12px;
  }

  .progress-value {
    font-size: 16px;
  }

  .progress-hint {
    font-size: 12px;
  }

  .zone-path-continuous {
    height: 80px;
  }

  .avatar-marker { font-size: 1.2rem; }
  .avatar-name { font-size: 12px; padding: 6px 12px; }
  .avatar-label { font-size: 10px; padding: 3px 8px; }

  .milestone-counter {
    font-size: 11px;
    padding: 3px 10px;
  }

  .adventure-map {
    gap: 15px;
  }

  .map-zone {
    min-width: 250px;
  }

  .action-cards {
    grid-template-columns: 1fr;
  }

  .child-tabs {
    margin: 10px 10px 0 10px;
  }

  .child-panel {
    padding: 10px;
  }

  .map-title {
    font-size: 22px;
  }
}

/* Passage Flag Modal */
.flag-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.flag-modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.flag-modal-content h2 {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 24px;
}

.flag-modal-content > p {
  color: #6c757d;
  margin-bottom: 20px;
  font-size: 14px;
}

.flag-form {
  margin-top: 20px;
}

.flag-form .form-group {
  margin-bottom: 20px;
}

.flag-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #495057;
}

.flag-form .form-control {
  width: 100%;
  padding: 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.flag-form .form-control:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.flag-form .error-message {
  color: #dc3545;
  font-size: 13px;
  margin-top: 6px;
}

.flag-form .form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.flag-success {
  text-align: center;
  padding: 20px;
}

.flag-success h3 {
  color: #28a745;
  font-size: 20px;
  margin-bottom: 15px;
}

.flag-success p {
  color: #495057;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .flag-modal {
    padding: 10px;
  }

  .flag-modal-content {
    padding: 20px;
  }
}
