/* Standards Viewer — Interactive alignment guide components
   Requires CSS variables from the course's shared_styles.css:
   --primary, --primary-light, --primary-dark, --primary-highlight
   --bg-light, --bg-white, --text-primary, --text-secondary, --text-muted
   --badge-page, --badge-page-text, --badge-assignment, --badge-assignment-text
   --badge-quiz, --badge-quiz-text, --border-radius, --font-family
*/

/* Tab navigation */
.sg-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.sg-tab { padding: 8px 18px; border: 2px solid var(--primary); border-radius: 20px; background: var(--bg-white); color: var(--primary); font-family: var(--font-family); font-size: 0.9rem; font-weight: 700; cursor: pointer; transition: background 0.2s, color 0.2s; }
.sg-tab:hover { background: var(--primary-light); }
.sg-tab.active { background: var(--primary); color: white; }
.sg-tab-content { display: none; }
.sg-tab-content.active { display: block; }

/* Controls bar */
.sg-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 12px 16px; background: var(--bg-light); border: 1px solid #e0e0e0; border-radius: var(--border-radius); margin-bottom: 16px; }
.sg-search { flex: 1; min-width: 200px; max-width: 400px; padding: 8px 14px; border: 2px solid #e0e0e0; border-radius: var(--border-radius); font-family: var(--font-family); font-size: 0.9rem; }
.sg-search:focus { outline: none; border-color: var(--primary); }

/* View toggle */
.sg-view-toggle { display: flex; border: 2px solid var(--primary); border-radius: var(--border-radius); overflow: hidden; }
.sg-view-btn { padding: 8px 16px; border: none; background: var(--bg-white); color: var(--primary); font-family: var(--font-family); font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.sg-view-btn:hover { background: var(--primary-light); }
.sg-view-btn.active { background: var(--primary); color: white; }

/* Action buttons */
.sg-actions { display: flex; gap: 8px; margin-left: auto; }
.sg-btn { padding: 8px 16px; border: 2px solid var(--primary); border-radius: var(--border-radius); background: var(--bg-white); color: var(--primary); font-family: var(--font-family); font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: background 0.2s; }
.sg-btn:hover { background: var(--primary-light); }

/* Unit cards (expandable) */
.sg-unit-card { border: 1px solid #e0e0e0; border-radius: var(--border-radius); margin-bottom: 16px; overflow: hidden; }
.sg-unit-header { background: var(--primary); color: white; padding: 14px 20px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.sg-unit-header h3 { margin: 0; color: white; font-size: 1.1rem; border: none; padding: 0; }
.sg-unit-meta { display: flex; gap: 12px; align-items: center; font-size: 0.85rem; opacity: 0.9; }
.sg-unit-body { display: none; padding: 0; }
.sg-unit-body.open { display: block; }
.sg-expand { transition: transform 0.2s; font-size: 0.9rem; }
.sg-expand.open { transform: rotate(90deg); }

/* Essential question */
.sg-eq { background: var(--primary-light); border-left: 4px solid var(--primary); padding: 10px 16px; margin: 0; font-style: italic; color: var(--text-primary); }

/* Activity items (clickable) */
.sg-activity { border-bottom: 1px solid #e0e0e0; }
.sg-activity:last-child { border-bottom: none; }
.sg-activity-header { padding: 12px 20px; cursor: pointer; display: flex; justify-content: space-between; align-items: flex-start; transition: background 0.15s; }
.sg-activity-header:hover { background: var(--bg-light); }
.sg-activity-name { font-weight: 700; color: var(--primary); margin-bottom: 3px; }
.sg-activity-desc { font-size: 0.88rem; color: var(--text-muted); }
.sg-activity-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sg-activity-details { display: none; padding: 0 20px 16px; background: var(--bg-light); border-top: 1px solid #e0e0e0; }
.sg-activity-details.open { display: block; }

/* Standards framework badges — default classes + data-driven inline styles */
.sg-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }
.sg-badge-ccss { background: var(--badge-page); color: var(--badge-page-text); }
.sg-badge-iste { background: var(--badge-assignment); color: var(--badge-assignment-text); }
.sg-badge-nsq { background: var(--badge-quiz); color: var(--badge-quiz-text); }

/* Alignment rationale */
.sg-rationale { background: var(--primary-light); border-left: 3px solid var(--primary-highlight); padding: 8px 12px; border-radius: 0 4px 4px 0; font-size: 0.88rem; margin-top: 6px; }
.sg-rationale strong { color: var(--primary-dark); }

/* Standard detail card */
.sg-standard-detail { background: white; border: 1px solid #e0e0e0; border-radius: var(--border-radius); padding: 12px 16px; margin-bottom: 10px; }
.sg-standard-code { font-weight: 700; color: var(--primary); }
.sg-standard-desc { font-style: italic; color: var(--text-secondary); font-size: 0.88rem; margin: 4px 0 8px; }

/* Standards section heading in activity details */
.sg-standards-group { margin-top: 12px; }
.sg-standards-group h4 { font-size: 0.95rem; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 2px solid var(--primary-light); color: var(--primary-dark); }

/* Standard view cards */
.sg-standard-card { border: 1px solid #e0e0e0; border-radius: var(--border-radius); margin-bottom: 12px; overflow: hidden; }
.sg-standard-header { padding: 12px 20px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.sg-standard-header:hover { background: var(--bg-light); }
.sg-standard-header.ccss { border-left: 4px solid var(--badge-page-text); }
.sg-standard-header.iste { border-left: 4px solid var(--badge-assignment-text); }
.sg-standard-header.nsq { border-left: 4px solid var(--badge-quiz-text); }
.sg-standard-body { display: none; padding: 16px 20px; background: var(--bg-light); border-top: 1px solid #e0e0e0; }
.sg-standard-body.open { display: block; }
.sg-standard-full-desc { background: white; padding: 12px; border-radius: 4px; margin-bottom: 12px; border-left: 3px solid var(--primary); }
.sg-coverage { background: var(--primary-light); color: var(--primary-dark); padding: 4px 12px; border-radius: 12px; font-size: 0.8rem; font-weight: 700; margin-right: 12px; }

/* Activity reference in standard view */
.sg-activity-ref { background: white; border: 1px solid #e0e0e0; border-radius: var(--border-radius); padding: 10px 14px; margin-bottom: 6px; }
.sg-activity-ref-name { font-weight: 700; color: var(--primary); }
.sg-activity-ref-unit { font-size: 0.85rem; color: var(--text-muted); }
.sg-activity-ref-rationale { font-size: 0.88rem; color: var(--text-secondary); margin-top: 4px; }

/* Category section header (standard view) */
.sg-category-header { background: var(--primary); color: white; padding: 10px 20px; border-radius: var(--border-radius); margin: 20px 0 12px; font-weight: 700; font-size: 1rem; }
.sg-category-header:first-of-type { margin-top: 0; }

/* Info grid for UDL/SEL/Accessibility */
.sg-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* Info card (used in UDL/SEL/Accessibility grids) */
.sg-info-card { background: var(--bg-white); border: 1px solid #e0e0e0; border-left: 4px solid var(--primary); border-radius: 0 var(--border-radius) var(--border-radius) 0; padding: 16px; }
.sg-info-card h4 { color: var(--primary-dark); margin-top: 0; }

/* Summary stats */
.sg-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.sg-stat { flex: 1; min-width: 120px; text-align: center; padding: 12px; background: var(--bg-light); border: 1px solid #e0e0e0; border-radius: var(--border-radius); }
.sg-stat-number { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.sg-stat-label { font-size: 0.85rem; color: var(--text-muted); }

/* No results */
.sg-no-results { text-align: center; padding: 40px; color: var(--text-muted); }

@media (max-width: 768px) {
  .sg-controls { flex-direction: column; }
  .sg-search { max-width: none; min-width: auto; }
  .sg-actions { margin-left: 0; width: 100%; }
  .sg-actions .sg-btn { flex: 1; }
  .sg-unit-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .sg-activity-header { flex-direction: column; }
  .sg-stats { flex-direction: column; }
}

@media print {
  .sg-controls, .sg-tabs, .sg-actions, .sg-expand { display: none !important; }
  .sg-unit-body, .sg-activity-details, .sg-standard-body, .sg-tab-content { display: block !important; }
  .sg-unit-card { break-inside: avoid; }
}
