/* CourseOS · Library Screen
   Course materials browser with upload, rich cards,
   status badges, and reading view access. */

/* Header */
.library-header {
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.library-title {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.library-subtitle {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Toggle bar */
.library-toggle {
  display: flex;
  margin: 0 var(--space-md) var(--space-sm);
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: 3px;
}

.library-toggle-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.library-toggle-btn.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Course section */
.library-course-section {
  margin: 0 var(--space-md) var(--space-md);
}

.library-course-heading {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.library-course-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.library-course-name {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.library-course-count {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* Material card */
.material-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--border-color);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.material-card.has-file {
  cursor: pointer;
  border-left: 3px solid var(--color-teal);
}

.material-card.has-file:active {
  background: var(--gray-100);
}

.material-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.material-icon.book { background: #EDE9FE; }
.material-icon.pdf { background: #FEE2E2; }
.material-icon.link { background: #DBEAFE; }
.material-icon.video { background: #FFF0D4; }
.material-icon.file { background: var(--gray-100); }

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

.material-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.material-meta {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Status badges */
.material-status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-required {
  background: #e6f4d7;
  color: #27500A;
}

.badge-uploaded {
  background: #dbeafe;
  color: #185FA5;
}

.badge-wrong {
  background: #FEF0F0;
  color: #DA0000;
}

.badge-missing {
  background: var(--gray-100);
  color: var(--text-muted);
}

.material-edition-warning {
  font-size: var(--font-xs);
  color: #EE4F07;
  margin-top: 3px;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 6px;
}

.material-edition-warning.warning-hidden {
  margin-top: 4px;
}

/* Small amber dot for hidden warnings */
.warning-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-orange, #EE4F07);
  flex-shrink: 0;
}

/* Manage button (⋯) */
.warning-manage-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: var(--transition-fast);
}

.warning-manage-btn:hover,
.warning-manage-btn:active {
  background: var(--gray-200, #e5e7eb);
}

/* Action pills row — slides open below warning */
.warning-actions {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  overflow: hidden;
}

.warning-actions.open {
  display: flex;
  animation: warningSlideIn 0.2s ease-out;
}

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

.warning-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.warning-action-pill:hover,
.warning-action-pill:active {
  background: var(--gray-100);
  color: var(--text-primary);
}

/* Action button (play arrow or upload prompt) */
.material-action {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
}

.material-action.upload-prompt {
  background: var(--gray-100);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
}

/* Upload section */
.upload-section {
  margin: var(--space-md);
  background: linear-gradient(135deg, #FAFBFF 0%, #F0F4FF 100%);
  border-radius: 16px;
  border: 2px solid #E0E7FF;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.08);
}

.upload-header {
  padding: 14px var(--space-md);
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.upload-header-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
}

.upload-header-icon {
  font-size: 18px;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
}

.upload-body {
  padding: var(--space-md);
  display: none;
}

.upload-body.open {
  display: block;
}

.upload-field {
  margin-bottom: 16px;
}

.upload-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6366F1;
  margin-bottom: 8px;
  display: block;
}

.upload-file-input {
  width: 100%;
  padding: 16px;
  border: 2.5px dashed #A5B4FC;
  border-radius: 12px;
  font-size: var(--font-sm);
  color: var(--text-primary);
  background: #fff;
  box-sizing: border-box;
  transition: all 0.2s;
}

.upload-file-input:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

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

.upload-course-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid var(--gray-200);
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.upload-course-tag:active {
  transform: scale(0.96);
}

.upload-submit-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.upload-submit-btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

/* Assignment picker */
.upload-assignment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-assignment-category {
  margin-bottom: 6px;
}

.upload-category-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7C3AED;
  padding: 10px 0 6px;
  border-bottom: 2px solid #E9E5FF;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.upload-category-label::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7C3AED;
  flex-shrink: 0;
}

.upload-assignment-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  background: #fff;
  border: 2px solid #E5E7EB;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.upload-assignment-btn:active {
  transform: scale(0.98);
}

.upload-assignment-btn.selected {
  font-weight: 700;
  border-width: 2.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.upload-assignment-label {
  flex: 1;
  color: var(--text-primary);
}

.upload-assignment-check {
  font-size: 18px;
  font-weight: 800;
}

/* Upload status area */
.upload-status {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.upload-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--gray-100);
  border-top-color: var(--color-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* Upload progress bar */
.upload-progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-stage {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.upload-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--color-red);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.upload-pct {
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
}

/* Upload result card */
.upload-result {
  width: 100%;
}

.upload-result-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.upload-result-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.upload-result-desc {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.upload-result-warning {
  font-size: var(--font-xs);
  color: #EE4F07;
  margin-top: 4px;
}

/* ── Date anchor labels (ADHD context) ───────────────── */
.material-date-anchor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 4px;
}

.date-anchor-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.4;
}

/* Urgency colors */
.date-anchor-pill.anchor-overdue {
  background: #FEF0F0;
  color: #B91C1C;
}

.date-anchor-pill.anchor-today {
  background: #FEF0F0;
  color: #DA0000;
}

.date-anchor-pill.anchor-soon {
  background: #FFF7ED;
  color: #9A3412;
}

.date-anchor-pill.anchor-week {
  background: #FFFBEB;
  color: #92400E;
}

.date-anchor-pill.anchor-later {
  background: #F0FDF4;
  color: #166534;
}

.date-anchor-pill.anchor-week-num {
  background: #EFF6FF;
  color: #1E40AF;
}

.date-anchor-pill.anchor-assignment {
  background: #F5F3FF;
  color: #5B21B6;
}

/* Empty state */
.library-empty {
  text-align: center;
  padding: var(--space-lg);
  font-size: var(--font-sm);
  color: var(--text-muted);
  font-style: italic;
}
