/* Activity Designer Modal Styles */

/* Activity cards: as many columns of at least 280px as the editor panel
   fits (3 on a laptop, 2 on a tablet, 1 on a phone). Based on the panel's
   width, not the screen's. */
.activity-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.activity-card-grid .activity-card {
  margin-bottom: 0;
}

/* Fix horizontal scrollbar on activity cards container */
.activities-container {
  overflow-x: hidden;
}

.activities-container .row {
  margin-left: 0;
  margin-right: 0;
}

.activities-container .row > [class*='col-'] {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

/* Participation Mode Selector - Bootstrap 3x2 grid */
.participation-mode-selector {
  margin-top: 10px;
}

.participation-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  border: 2px solid #ddd;
  border-radius: 8px;
  flex-direction: column;
  transition: all 0.2s ease;
  cursor: pointer;
  background-color: #fff;
  min-height: 100px;
  height: 100%;
}

.participation-cell:hover {
  background-color: #f8f9fa;
  border-color: #999;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.participation-cell.active,
.participation-cell.btn-primary {
  background-color: rgba(22, 92, 125, 0.1);
  font-weight: bold;
  border-color: #165C7D;
}

.participation-cell i {
  font-size: 28px;
  margin-bottom: 8px;
  color: #165C7D;
}

.participation-cell .cell-label {
  font-size: 0.85rem;
  text-align: center;
  color: #333;
}

.participation-cell.active .cell-label,
.participation-cell.btn-primary .cell-label {
  font-weight: 600;
}

/* Mode Explanation Panel */
.mode-explanation {
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 0.85rem;
  min-height: 100px;
  height: 100%;
}

.mode-explanation h6 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.mode-explanation p {
  margin-bottom: 8px;
  line-height: 1.4;
}

.mode-explanation strong {
  color: #165C7D;
  display: block;
  margin-bottom: 8px;
}

/* Group Size Selector - Card style buttons */
.group-size-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.group-size-option {
  flex: 1 0 calc(20% - 12px);
  min-width: 100px;
  padding: 15px 10px;
  text-align: center;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.group-size-option:hover {
  background-color: #f8f9fa;
  border-color: #999;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.group-size-option.selected,
.group-size-option.btn-secondary {
  border-color: #165C7D;
  background-color: rgba(22, 92, 125, 0.1);
}

.group-size-option i {
  font-size: 28px;
  margin-bottom: 8px;
  color: #165C7D;
}

.group-size-option .size-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.group-size-option .size-description {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

.group-size-option.selected .size-label,
.group-size-option.btn-secondary .size-label {
  color: #165C7D;
}

/* Implementation Guide Styles */
.implementation-guide {
  margin-top: 20px;
}

.implementation-guide .card-header {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.guide-steps .design-step-input {
  font-size: 0.95rem;
}

/* Steps grow to show the whole text (js/utils/autoGrowTextarea.js) */
textarea.design-step-input,
textarea.custom-step-input {
  resize: none;
  overflow: hidden;
  line-height: 1.5;
  min-height: calc(1.5em + 0.75rem + 2px);
}

.guide-steps .input-group {
  margin-bottom: 8px;
}

.remove-design-step-btn {
  padding: 0.375rem 0.75rem;
}

/* Step rows: drag handle, text, move up/down, remove (ImplementationSteps.js) */
.design-step-row .step-drag-handle {
  cursor: grab;
  padding: 0 0.5rem;
  color: var(--bs-secondary-color, #6c757d);
}

.design-step-row .step-drag-handle:active {
  cursor: grabbing;
}

.design-step-row.single-step .step-drag-handle {
  cursor: default;
  opacity: 0.4;
}

.design-step-row .move-step-up-btn,
.design-step-row .move-step-down-btn {
  padding: 0.375rem 0.5rem;
}

/* While dragging: the placeholder where the step will land */
.design-step-row.sortable-ghost {
  opacity: 0.4;
}

.design-step-row.sortable-chosen .design-step-input {
  background-color: #f0f7ff;
}

.activity-import-prompt p {
  margin-bottom: 0.5rem;
}

.guide-tips textarea,
.guide-variations textarea {
  font-size: 0.9rem;
  resize: vertical;
}

/* Tool selection styles */
.lms-tools-container {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
}

.lms-tools-title {
  font-size: 1.1rem;
  color: #165C7D;
}

.lms-tool-checkbox {
  cursor: pointer;
}

.form-check-label {
  cursor: pointer;
  user-select: none;
}

.tool-category-section {
  margin-bottom: 30px;
}

.tool-category-section:last-child {
  margin-bottom: 0;
}

/* Tab content padding */
.tab-pane {
  padding-top: 15px;
}

/* Selected summaries */
#selected-activities-summary,
#selected-tools-summary {
  min-height: 30px;
  display: flex;
  align-items: center;
}

/* Feedback Prompt Helpers - Contextual guidance based on Brooks matrix */
.alert.border-start {
  background-color: #f8f9fa;
}

.alert.border-start.border-primary {
  border-left-width: 4px !important;
}

.alert.border-start.border-success {
  border-left-width: 4px !important;
}

/* Feedback prompt list styling */
.alert.border-start ul {
  margin-bottom: 0.5rem;
}

.alert.border-start ul li {
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

.alert.border-start ul li:last-child {
  margin-bottom: 0;
}

/* Details/Summary styling for examples */
.alert.border-start details summary {
  font-weight: 500;
  padding: 0.25rem 0;
  transition: color 0.2s ease;
}

.alert.border-start details summary:hover {
  color: #0d6efd !important;
}

.alert.border-start details[open] summary {
  margin-bottom: 0.5rem;
}

.alert.border-start details .mt-2 {
  padding: 0.75rem;
  background-color: #ffffff;
  border-radius: 0.375rem;
  border: 1px solid #e0e0e0;
}

/* Icon styling for prompt helpers */
.alert.border-start .fa-lightbulb {
  flex-shrink: 0;
  font-size: 1.1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .participation-grid {
    height: 180px;
  }

  .participation-cell i {
    font-size: 24px;
  }

  .participation-cell .cell-label {
    font-size: 0.75rem;
  }

  .group-size-option {
    flex: 1 0 calc(50% - 12px);
  }

  /* Adjust prompt helpers for mobile */
  .alert.border-start .fa-lightbulb {
    font-size: 1rem;
  }

  .alert.border-start ul {
    font-size: 0.875rem;
  }
}

/* Enhanced Activity Features - Added for context-aware activities */

/* Activity Card Badges */
.activity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  min-height: 24px;
}

.activity-badges .badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  font-weight: 500;
}

.activity-enhanced-badge {
  background-color: #0dcaf0 !important;
  color: white;
}

.activity-difficulty-badge.beginner {
  background-color: #198754;
  color: white;
}

.activity-difficulty-badge.intermediate {
  background-color: #ffc107;
  color: #000;
}

.activity-difficulty-badge.advanced {
  background-color: #dc3545;
  color: white;
}

.activity-groupsize-badge {
  background-color: #6c757d;
  color: white;
}

.activity-pedagogy-badge {
  background-color: #6f42c1 !important;
  color: white;
}

/* Purple background utility class */
.bg-purple {
  background-color: #6f42c1 !important;
}

/* Enhanced Activity Card Styling */
.enhanced-activity {
  border-left: 3px solid #0dcaf0;
  transition: border-color 0.3s ease;
}

.enhanced-activity:hover {
  border-left-color: #0969da;
}

/* Activity card footer layout for two buttons */
.activity-card-footer .d-flex {
  gap: 0.5rem;
}

.activity-card-footer .btn {
  flex: 1;
}

.view-details-btn {
  white-space: nowrap;
}

/* Context Selector */
.context-selector {
  max-width: 350px;
}

.context-selector-hint {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* Activity Detail View (inside the Activities tab, in place of the list) */
.activity-detail-view {
  max-width: 860px; /* comfortable reading width in a wide panel */
}

.activity-detail-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #dee2e6;
}

.activity-detail-back {
  padding: 0;
  margin-bottom: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.activity-detail-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0;
}

/* Detail View Sections */
.detail-section {
  background: white;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid #dee2e6;
}

.detail-section h6 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-section h6 i {
  color: #667eea;
}

/* Implementation Steps */
.implementation-steps {
  margin: 0;
  padding-left: 1.5rem;
}

.implementation-steps li {
  padding-left: 0.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

/* Recommended Tools */
.tool-recommendation {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.tool-recommendation:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.tool-name-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.tool-name-header strong {
  font-size: 0.95rem;
  color: #212529;
}

.relevance-badge {
  background: #667eea;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tool-config-hint {
  font-size: 0.85rem;
  color: #6c757d;
  font-style: italic;
  margin-top: 0.25rem;
}

/* Active Enhancements */
.enhancement-item {
  background: #d1f4e0;
  border-left: 3px solid #198754;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.enhancement-item strong {
  color: #146c43;
  display: block;
  margin-bottom: 0.25rem;
}

.enhancement-item .text-muted {
  font-size: 0.9rem;
}

/* Common Pitfalls Accordion */
.accordion-button {
  font-size: 0.95rem;
}

.accordion-button:not(.collapsed) {
  background-color: #ffeef0;
  color: #842029;
}

.accordion-body ul {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

.accordion-body ul li {
  margin-bottom: 0.5rem;
}

/* Nord Example */
.nord-example-box {
  background: linear-gradient(135deg, #fff8c5 0%, #fffbeb 100%);
  border-left: 4px solid #ffc107;
  padding: 1rem;
  border-radius: 6px;
}

.nord-example-box strong {
  color: #9a6700;
  display: block;
  margin-bottom: 0.5rem;
}

/* Time Estimates Table */
.time-estimates-table {
  width: 100%;
  font-size: 0.9rem;
}

.time-estimates-table th {
  font-weight: 600;
  padding: 0.5rem;
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.time-estimates-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

/* Context Selector in Detail View */
#detail-context-selector {
  max-width: 100%;
  margin-bottom: 1rem;
}

/* Use Activity Button */
.use-activity-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.use-activity-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Responsive Offcanvas */
@media (max-width: 768px) {
  .activity-badges .badge {
    font-size: 0.65rem;
    padding: 1px 4px;
  }

  .tool-recommendation {
    padding: 0.5rem;
  }

  .detail-section {
    padding: 1rem;
  }
}

/* ======= Activity Editor Panel =======
   Full-height side panel (Bootstrap offcanvas). Header, tabs and footer
   stay in place; only the tab content scrolls. */
.activity-editor {
  --bs-offcanvas-width: min(1200px, 75vw);
}

@media (max-width: 991.98px) {
  .activity-editor {
    --bs-offcanvas-width: 100vw;
  }
}

.activity-editor-tabs {
  flex-shrink: 0;
  padding: 0.75rem 1rem 0;
}

.activity-editor-body {
  padding: 1rem;
}

.activity-editor-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}

/* Phones: one row of tabs that scrolls sideways instead of wrapping */
@media (max-width: 575.98px) {
  .activity-editor-header .offcanvas-title {
    font-size: 1rem;
  }

  .activity-editor-tabs .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .activity-editor-tabs .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .activity-editor-tabs .nav-link {
    white-space: nowrap;
  }
}

/* ======= Activity Filter Bar =======
   One compact row above the activity list. It sticks to the top of the
   editor panel while the list scrolls; the negative margins let it run
   edge to edge over the panel body's 1rem padding. */
.activity-filter-bar {
  position: sticky;
  top: -1rem;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: -1rem -1rem 1rem;
  padding: 0.75rem 1rem;
}

/* The filter bar provides the spacing under the tabs */
.activity-editor #activities.tab-pane {
  padding-top: 0;
}

.activity-filter-bar .filter-context {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 220px;
  max-width: 350px;
}

.activity-filter-bar .filter-hint-icon {
  cursor: help;
}

.activity-filter-bar .filter-options {
  gap: 0.375rem;
}

/* Phones: duration buttons in one row that scrolls sideways, so the
   pinned bar stays short */
@media (max-width: 575.98px) {
  .activity-filter-bar .filter-context {
    max-width: none;
  }

  .activity-filter-bar .filter-options {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .activity-filter-bar .filter-options::-webkit-scrollbar {
    display: none;
  }

  .activity-filter-bar .filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* ======= Design tab layout =======
   Two columns when the tab is at least 820px wide (the editor panel on a
   laptop): left = what the activity is (basics, implementation guide),
   right = how it is organised (participation, grouping, spanning, summary).
   Narrower, the columns stack in the same order, so visual order always
   matches keyboard and screen-reader order. Uses a container query, so it
   follows the panel width, not the screen. */
.activity-editor #design {
  container: design-tab / inline-size;
}

@container design-tab (min-width: 820px) {
  .design-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 1.5rem;
    align-items: start;
  }
}
