/* CourseOS · Assistant Screen
   Dependency-based task guide with 3-state card system.
   Mode bar, context selector, and assignment cards. */

/* Filter banner when coming from a tile tap */
.filter-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px var(--space-md);
  color: #fff;
}

.filter-back-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.filter-back-btn:active {
  background: rgba(255,255,255,0.35);
}

.filter-banner-label {
  font-size: var(--font-lg);
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Mode bar at top */
.assistant-mode-bar {
  display: flex;
  gap: 0;
  padding: var(--space-md) var(--space-md) 0;
}

.mode-tab {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.mode-tab.active {
  color: var(--color-red);
  border-bottom-color: var(--color-red);
}

.mode-tab.disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* Context selector */
.context-selector {
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.context-selector-label {
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.context-selector select {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
  flex: 1;
}

/* Assignment card · all three states share base styles */
.asst-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--border-color);
  margin: 0 var(--space-md) var(--space-sm);
  overflow: visible;
  transition: box-shadow var(--transition-base);
  max-width: 100%;
}

.asst-card.expanded {
  box-shadow: var(--shadow-md);
}

.asst-card.late-card {
  border-left: 3px solid #C0392B;
}

.late-banner {
  background: #FEF0F0;
  color: #C0392B;
  font-size: var(--font-xs);
  font-weight: 700;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  text-align: center;
  line-height: 1.4;
}

/* Collapsed state header */
.asst-card-header {
  padding: var(--space-lg) var(--space-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.asst-card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.asst-card-title {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.asst-card-chevron {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.asst-card.expanded .asst-card-chevron {
  transform: rotate(180deg);
}

.asst-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Summary state */
.asst-card-summary {
  padding: 0 var(--space-md) var(--space-lg);
  display: none;
}

.asst-card.expanded .asst-card-summary {
  display: block;
}

.summary-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-md);
}

.summary-bullets li {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  padding: 8px 0;
  padding-left: 16px;
  position: relative;
  line-height: 1.6;
  border-bottom: var(--border-width) solid var(--gray-100);
}

.summary-bullets li strong {
  color: var(--text-primary);
  font-weight: 700;
}

.summary-bullets li em {
  color: var(--color-red);
  font-style: normal;
  font-weight: 600;
}

.summary-bullets li:last-child {
  border-bottom: none;
}

.summary-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-300);
}

/* Audio play button */
.audio-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #E8F8F5;
  color: #1A8A6A;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--font-sm);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: var(--space-sm);
}

/* Action buttons row */
.asst-card-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.btn-start-steps {
  flex: 1;
  padding: 12px;
  background: var(--color-red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.btn-start-steps:active {
  opacity: 0.8;
}

.btn-compose {
  padding: 12px 16px;
  background: var(--color-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  font-weight: 700;
  cursor: pointer;
}

.btn-compose:active {
  opacity: 0.8;
}

.btn-save-later {
  padding: 12px 16px;
  background: var(--gray-100);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  font-weight: 600;
  cursor: pointer;
}

/* Steps state */
.asst-card-steps {
  padding: 0 var(--space-md) var(--space-lg);
  display: none;
}

.asst-card.show-steps .asst-card-steps {
  display: block;
}

.asst-card.show-steps .asst-card-summary {
  display: none;
}

/* Milestone progress bar */
.milestone-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.milestone-bar-track {
  flex: 1;
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
}

.milestone-bar-fill {
  height: 100%;
  background: var(--color-red);
  border-radius: 3px;
  transition: width var(--transition-base);
}

.milestone-bar-label {
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Individual step */
.step-item {
  display: flex;
  gap: var(--space-sm);
  padding: 14px 0;
  border-bottom: 2px solid #E8E8E8;
  margin-bottom: 4px;
  transition: opacity var(--transition-base);
}

.step-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.step-item.done {
  opacity: 0.65;
}

.step-item.done .step-title-text {
  text-decoration: line-through;
  text-decoration-color: #BBB;
}

/* Validation badges */
.step-validation {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  margin: 4px 0 2px;
  display: inline-block;
}

.step-validation.passed {
  background: #E8F5E9;
  color: #2E7D32;
}

.step-validation.not-yet {
  background: #FFF3E0;
  color: #E65100;
}

.step-validation.manual {
  background: #F5F5F5;
  color: #999;
}

.step-item.active-step {
  background: #FFFDF5;
  margin: 0 calc(-1 * var(--space-md));
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
}

/* Step number circle — tap to mark done */
.step-circle {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.step-item.done .step-circle {
  background: var(--color-safe);
  border-color: var(--color-safe);
  color: #fff;
}

.step-item.active-step .step-circle {
  border-color: var(--color-red);
  color: var(--color-red);
}

/* Step content */
.step-content {
  flex: 1;
  min-width: 0;
}

.step-title-text {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.step-detail-text {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Formatted content within step details */
.step-detail-text strong {
  color: var(--text-primary);
  font-weight: 700;
}

.step-detail-text em {
  color: var(--color-red);
  font-style: normal;
  font-weight: 600;
}

/* Code you need to TYPE */
.step-detail-text .step-key {
  display: block;
  background: #1E1E1E;
  color: #D4D4D4;
  font-family: 'Consolas', 'Courier New', monospace;
  font-weight: 500;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  line-height: 1.6;
  margin: 6px 0;
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 3px solid #4EC9B0;
}

/* Copy button for TYPE code blocks */
.step-copy-btn {
  display: inline-block;
  background: #2D2D2D;
  color: #4EC9B0;
  border: 1px solid #4EC9B0;
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  margin-top: 6px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s, color 0.15s;
}
.step-copy-btn:active {
  background: #4EC9B0;
  color: #1E1E1E;
}
.step-copy-btn.copied {
  background: #4EC9B0;
  color: #1E1E1E;
  border-color: #4EC9B0;
}

.step-detail-text .step-key-label {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #4EC9B0;
  margin-bottom: 4px;
}

/* Code you need to FIND in your file */
.step-detail-text .step-find {
  display: block;
  background: #FFFDE7;
  color: #5D4037;
  font-family: 'Consolas', 'Courier New', monospace;
  font-weight: 500;
  font-size: 13px;
  padding: 10px 14px;
  border: 2px solid #FFD54F;
  border-radius: 6px;
  letter-spacing: 0.3px;
  line-height: 1.6;
  margin: 6px 0;
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 3px solid #F9A825;
}

.step-detail-text .step-find-label {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #F9A825;
  margin-bottom: 4px;
}

.step-detail-text .step-sep {
  display: block;
  height: 6px;
}

/* Line number hint below FIND blocks */
.step-line-hint {
  display: block;
  font-size: 11px;
  color: #AAA;
  font-style: italic;
  margin-top: 4px;
  margin-bottom: 2px;
  padding-left: 2px;
}

.step-line-hint::before {
  content: '\2139\00a0';
  font-style: normal;
}

/* Numbered sub-steps within a step */
.step-substeps {
  list-style: none;
  counter-reset: substep;
  padding: 0;
  margin: 6px 0 0 0;
}

.step-substeps li {
  counter-increment: substep;
  position: relative;
  padding-left: 28px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #ECECEC;
  line-height: 1.55;
}

.step-substeps li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.step-substeps li::before {
  content: counter(substep);
  position: absolute;
  left: 0;
  top: 1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #F0F0F0;
  color: #666;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sync Line Numbers button */
.line-sync-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin: 8px 0 12px;
  background: #F5F5F5;
  border: 1px dashed #CCC;
  border-radius: 8px;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  text-align: center;
}

.line-sync-btn:active {
  background: #EBEBEB;
}

/* Sync modal overlay */
.line-sync-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.line-sync-modal {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.line-sync-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.line-sync-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
  line-height: 1.5;
}

.line-sync-input {
  width: 100%;
  border: 2px solid #E0E0E0;
  border-radius: 8px;
  padding: 10px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  resize: vertical;
  box-sizing: border-box;
}

.line-sync-input:focus {
  border-color: var(--color-red);
  outline: none;
}

.line-sync-btns {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.line-sync-btn-go {
  flex: 1;
  padding: 10px;
  background: var(--color-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.line-sync-btn-cancel {
  padding: 10px 16px;
  background: #F0F0F0;
  color: #666;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* ── Requirements checklist ── */
.requirements-box {
  background: #F8F9FA;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px var(--space-md) 12px;
}
.req-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #555;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.req-count {
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: #2E7D32;
  background: #E8F5E9;
  padding: 2px 8px;
  border-radius: 4px;
}
.req-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #ECECEC;
  font-size: 13px;
  line-height: 1.4;
}
.req-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.req-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-top: 1px;
}
.req-text {
  color: #444;
}
.req-met .req-icon {
  color: #2E7D32;
  font-weight: 700;
}
.req-met .req-text {
  color: #2E7D32;
}
.req-not-met .req-icon {
  color: #E65100;
}
.req-not-met .req-text {
  color: #333;
}
.req-manual .req-icon {
  color: #999;
}
.req-manual .req-text {
  color: #888;
}

/* Step email draft button */
.step-email-btn {
  display: inline-block;
  background: #D93025;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
  margin: 8px 0;
  letter-spacing: 0.2px;
}
.step-email-btn:active {
  opacity: 0.85;
}

/* Step link button */
.step-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 10px;
  background: var(--color-blue);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}

/* Step audio badge — tappable button */
.step-audio-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  margin-left: 6px;
  padding: 4px 10px;
  background: #E8F8F5;
  color: #1A8A6A;
  border: none;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.step-audio-badge:active {
  background: #C8F0E8;
}

/* Reading link button on steps that reference uploaded texts */
.step-reading-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 6px 12px;
  background: var(--color-teal);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.step-reading-btn:active {
  opacity: 0.8;
}

/* Floating selection read-aloud button */
.selection-speak-btn {
  position: absolute;
  z-index: 2000;
  padding: 6px 14px;
  background: var(--color-red);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  animation: selBtnFade 0.15s ease;
}

@keyframes selBtnFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.selection-speak-btn:active {
  transform: scale(0.95);
}

/* ── Previously-due context hint ── */
.prev-due-hint {
  margin: 0 var(--space-md) 4px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #6B7280;
  background: #F9FAFB;
  border-left: 3px solid #D1D5DB;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.4;
}

/* ── Catch Up drawer ── */
.catchup-drawer {
  margin: var(--space-md) var(--space-md) var(--space-sm);
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--border-color);
  background: var(--bg-primary);
  overflow: hidden;
}

.catchup-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px var(--space-md);
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.catchup-toggle:active {
  background: var(--gray-100);
}

.catchup-toggle-label {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-secondary);
  flex: 1;
  text-align: left;
}

.catchup-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: #FEF0F0;
  color: #C0392B;
  font-size: 11px;
  font-weight: 700;
}

.catchup-chevron {
  font-size: 12px;
  color: var(--text-muted);
}

.catchup-body {
  border-top: var(--border-width) solid var(--gray-100);
  padding-top: var(--space-sm);
}

.catchup-note {
  margin: 0 var(--space-md) var(--space-sm);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #6B7280;
  background: #F9FAFB;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.catchup-body .asst-card {
  opacity: 0.75;
}

.catchup-body .asst-card:hover,
.catchup-body .asst-card.expanded {
  opacity: 1;
}
