/* Course Builder Styles - Extracted from course-builder.php trait */

/* Starter Section Styles */
.lms-starter-section {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 8px;
  padding: 30px;
  margin: 20px 0;
  text-align: center;
}

.lms-starter-header h2 {
  color: #2271b1;
  margin-bottom: 10px;
}

.lms-starter-options {
  display: flex;
  gap: 30px;
  justify-content: center;
  margin: 30px 0;
  flex-wrap: wrap;
}

.starter-option {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 20px;
  min-width: 250px;
  flex: 1;
  max-width: 300px;
}

.starter-option h3 {
  margin-top: 0;
  color: #333;
}

.lms-starter-preview {
  background: #f0f6fc;
  border: 1px solid #c9d6e5;
  border-radius: 6px;
  padding: 20px;
  margin-top: 20px;
  text-align: left;
}

.lms-starter-preview h4 {
  margin-top: 0;
  color: #0073aa;
}

.lms-starter-preview li {
  padding: 5px 0;
}

/* Main Course Builder Styles */
#lms-course-builder {
  max-width: 1400px;
}

.course-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.course-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.course-title {
  margin: 0 0 8px 0;
  color: #2271b1;
  font-size: 1.3em;
}

.course-status {
  font-size: 0.8em;
  padding: 2px 8px;
  border-radius: 12px;
  background: #f0f0f1;
  margin-left: 10px;
}

.status-publish {
  background: #d1e7dd;
  color: #0a3622;
}

.course-meta,
.lesson-meta {
  font-size: 0.9em;
  color: #666;
}

.course-meta span,
.lesson-meta span {
  margin-right: 15px;
}

.course-actions,
.lesson-actions,
.topic-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.course-content {
  display: none;
  padding: 0 20px 20px;
}

.lesson-item {
  background: #f8f9fa;
  border: 1px solid #e2e4e7;
  border-radius: 6px;
  margin: 10px 0;
}

.lesson-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
}

.lesson-title {
  margin: 0 0 5px 0;
  color: #1d2327;
  font-size: 1.1em;
}

.lesson-number,
.topic-number {
  color: #2271b1;
  font-weight: bold;
  margin-right: 5px;
}

.lesson-body {
  margin: 0 15px 15px;
  padding: 10px 5px 5px;
  border-top: 1px solid #e2e4e7;
  background: #fdfdfd;
}

.lesson-body .no-topics {
  margin: 12px 10px;
  padding: 18px;
  background: #ffffff;
  border: 1px dashed #d0d7de;
  border-radius: 6px;
  text-align: center;
  color: #555;
}

.topics-container {
  padding: 0 10px 10px;
}

.topic-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin: 10px 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.topic-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 15px;
}

.topic-info {
  max-width: 70%;
}

.topic-title {
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95em;
}

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85em;
  color: #666;
}

.topic-type {
  text-transform: capitalize;
  color: #2271b1;
  font-weight: 600;
}

.topic-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topic-content {
  border-top: 1px solid #f0f0f0;
  padding: 0 15px 15px;
}

.topic-content-preview {
  padding: 15px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e2e4e7;
  margin-top: 10px;
}

.topic-content-preview .content-preview {
  background: white;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
  font-size: 0.9em;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
}

.topic-video-preview {
  background: white;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.topic-video-preview small {
  color: #666;
  font-family: monospace;
}

.topic-duration {
  font-size: 0.85em;
  color: #666;
  margin-left: 10px;
}

.drag-handle {
  cursor: move;
  color: #999;
  font-size: 1.2em;
}

.drag-handle:hover {
  color: #666;
}

.toggle-icon {
  transition: transform 0.2s;
}

.toggle-icon.rotated {
  transform: rotate(180deg);
}

/* Modal Styles */
.lms-modal {
  position: fixed;
  z-index: 100000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.lms-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.lms-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.lms-modal-header h2 {
  margin: 0;
}

.lms-modal-close {
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #aaa;
}

.lms-modal-close:hover {
  color: #000;
}

.lms-modal-body {
  padding: 20px;
}

.lms-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px;
  border-top: 1px solid #eee;
}

/* Lesson/Topic List Styles */
.lesson-item-selectable,
.topic-item-selectable {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #f0f0f1;
  transition: background-color 0.2s;
  cursor: pointer;
}

.lesson-item-selectable:hover,
.topic-item-selectable:hover {
  background-color: #f8f9fa;
}

.lesson-item-selectable.selected,
.topic-item-selectable.selected {
  background-color: #e3f2fd;
  border-left: 3px solid #2271b1;
}

.item-checkbox {
  margin-right: 10px;
}

.item-details {
  flex: 1;
}

.item-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #1d2327;
}

.item-meta {
  font-size: 0.85em;
  color: #646970;
}

.item-meta span {
  margin-right: 12px;
}

.item-status {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 500;
}

.item-status.publish {
  background: #d1e7dd;
  color: #0a3622;
}

.item-status.draft {
  background: #fff3cd;
  color: #664d03;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.search-section {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.link-modal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #f8f9fb;
  border: 1px solid #e3e5e8;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 15px 0 10px;
}

.link-modal-target {
  font-weight: 600;
  color: #1d2327;
}

.link-modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.link-selection-count {
  font-size: 0.9em;
  color: #50575e;
  margin-bottom: 12px;
  font-weight: 500;
}

/* Library Panels */
.lms-library-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 30px;
}

.lms-library-card {
  flex: 1 1 420px;
  background: #fff;
  border: 1px solid #dcdcde;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

.library-card-header h2 {
  margin: 0 0 8px;
  color: #1d2327;
}

.library-card-header p {
  margin: 0;
  color: #50575e;
  font-size: 0.95em;
}

.library-card-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.library-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-control.align-right {
  margin-left: auto;
}

.library-card-controls input[type="search"] {
  min-width: 220px;
}

.library-link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.library-selection-count {
  font-weight: 600;
  color: #1d2327;
}

.library-target-select-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-target-select {
  min-width: 220px;
}

.library-helper-text {
  margin: 8px 0 0;
  font-size: 0.85em;
  color: #9aa0a6;
}

.library-list {
  margin-top: 18px;
  border: 1px solid #e2e4e7;
  border-radius: 6px;
  background: #f6f7f7;
  max-height: 340px;
  overflow-y: auto;
}

.library-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e4e7;
  align-items: flex-start;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.library-item:last-child {
  border-bottom: none;
}

.library-item:hover {
  background: #eef2ff;
}

.library-item input[type="checkbox"] {
  margin-top: 6px;
}

.library-item-body {
  flex: 1;
}

.library-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.library-item-title {
  font-weight: 600;
  color: #1d2327;
}

.library-item-status {
  font-size: 0.8em;
  padding: 2px 10px;
  border-radius: 999px;
  text-transform: capitalize;
  background: #e5e7eb;
  color: #1f2937;
}

.library-item-status.status-publish {
  background: #d1e7dd;
  color: #0a3622;
}

.library-item-status.status-draft {
  background: #fff3cd;
  color: #7f5f00;
}

.library-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85em;
  color: #50575e;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: #e7e9ec;
  color: #1f2937;
}

.meta-chip-warning {
  background: #fdecc8;
  color: #7c2d12;
}

.library-empty {
  margin: 20px;
  text-align: center;
  color: #6b7280;
}

.library-footer {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.library-footer .button[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

@media (max-width: 1024px) {
  .lms-library-card {
    flex: 1 1 100%;
  }

  .library-card-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .library-card-controls input[type="search"],
  .library-target-select {
    width: 100%;
    min-width: 0;
  }

  .library-control.align-right {
    justify-content: flex-end;
  }

  .library-link-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

.sortable-lessons,
.sortable-topics {
  min-height: 50px;
}

.ui-sortable-helper {
  background: #fff !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

.ui-sortable-placeholder {
  background: #e3f2fd !important;
  border: 2px dashed #2271b1 !important;
}

/* Modal Styles */
.lms-modal {
  display: none;
  position: fixed;
  z-index: 100000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.lms-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: modalFadeIn 0.3s ease-out;
}

.large-modal .lms-modal-content {
  max-width: 800px;
}

.fullscreen-modal .lms-modal-content {
  width: 95%;
  height: 90%;
  max-width: none;
  margin: 2.5% auto;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lms-modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px 8px 0 0;
}

.lms-modal-header h2 {
  margin: 0;
  font-size: 1.4em;
  color: #2271b1;
}

.lms-modal-close {
  color: #666;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.lms-modal-close:hover {
  color: #d32f2f;
}

.lms-modal-body {
  padding: 25px;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #2271b1;
  box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.form-actions {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
  text-align: right;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.form-actions .button {
  min-width: 100px;
}

/* Link Modal Styles */
.link-search {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.link-search input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.items-checklist {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 10px;
  background: #fafafa;
}

.item-checkbox {
  display: flex;
  align-items: center;
  padding: 10px;
  margin: 5px 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.item-checkbox:hover {
  background: #f0f8ff;
  border-color: #2271b1;
}

.item-checkbox input[type="checkbox"] {
  margin-right: 12px;
  width: auto;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.item-title {
  font-weight: 600;
  color: #333;
}

.item-meta {
  font-size: 0.85em;
  color: #666;
  margin-right: 10px;
}

.no-items-found {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.no-items-found em {
  font-size: 0.9em;
  color: #888;
}
  gap: 10px;
}

/* Builder Toolbar */
.builder-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.builder-toolbar .toolbar-left,
.builder-toolbar .toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Course Item Styles */
.course-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 25px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s;
}

.course-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.course-header {
  padding: 20px 25px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.course-info h2 {
  margin: 0 0 8px 0;
  font-size: 1.3em;
}

.course-meta {
  display: flex;
  gap: 15px;
  font-size: 0.9em;
  color: #666;
}

.course-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.course-content {
  padding: 20px 25px;
}

/* Lesson and Topic Items */
.lesson-item {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 15px;
  transition: all 0.2s;
}

.lesson-item:hover {
  background: #f0f8ff;
  border-color: #2271b1;
}

.lesson-header {
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lesson-info h3 {
  margin: 0 0 5px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lesson-meta {
  display: flex;
  gap: 12px;
  font-size: 0.85em;
  color: #666;
}

.lesson-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lesson-actions .toggle-lesson-btn {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topic-item {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin: 10px 0;
  transition: all 0.2s;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.topic-item:hover {
  background: #f9f9f9;
  border-color: #ccc;
}

.topic-drag-handle {
  cursor: move;
  color: #999;
  font-size: 1.1em;
}

.topic-info {
  max-width: 70%;
}

.topic-info h4 {
  margin: 0 0 6px 0;
  font-size: 1em;
}

.topic-meta {
  display: flex;
  gap: 10px;
  font-size: 0.8em;
  color: #666;
}

.topic-actions {
  display: flex;
  gap: 5px;
}

/* Status badges */
.course-status,
.lesson-status,
.topic-status {
  font-size: 0.75em;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.status-publish {
  background: #d1e7dd;
  color: #0a3622;
}

.status-draft {
  background: #fff3cd;
  color: #664d03;
}

.status-private {
  background: #f8d7da;
  color: #721c24;
}

/* Empty states */
.no-lessons,
.no-topics {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  background: #f8f9fa;
  border: 2px dashed #ddd;
  border-radius: 6px;
  margin: 15px 0;
}

.course-actions-bottom {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
  text-align: center;
}

/* Drag and drop placeholders */
.lesson-placeholder,
.topic-placeholder {
  background: #e3f2fd !important;
  border: 2px dashed #2271b1 !important;
  border-radius: 6px;
  height: 60px;
  margin: 8px 0;
}

/* Notices */
.lms-notice {
  position: relative;
  margin: 15px 0;
}

/* Responsive */
@media (max-width: 768px) {
  .lms-modal-content {
    width: 95%;
    margin: 10% auto;
  }

  .course-header,
  .lesson-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  .course-actions,
  .lesson-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .builder-toolbar {
    flex-direction: column;
    gap: 15px;
  }
}
