body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f6fa;
  color: #1f2933;
}

body.modal-open {
  overflow: hidden;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 2rem 3rem;
  display: grid;
  gap: 2rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  font-size: 1.75rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid #2563eb;
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.header-link:hover {
  background: #2563eb;
  color: #ffffff;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-nav {
  display: flex;
  gap: 0.75rem;
}

.nav-button {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #e2e8f0;
  color: #1f2933;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-button.active,
.nav-button:hover:not([disabled]) {
  background: #2563eb;
  color: #ffffff;
}

.view {
  display: grid;
  gap: 1.75rem;
}

.view.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 1.25rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.panel-description {
  margin: 0;
  color: #475569;
  line-height: 1.6;
}

.panel-subtitle {
  margin: 0;
  color: #64748b;
  font-size: 0.95rem;
}

.upload-form{
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.upload-form select,
.upload-form input[type="file"] {
  flex: 1 1 220px;
  min-width: 180px;
  box-sizing: border-box;
  border: 1px dashed #93c5fd;
  background: #f8fbff;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
}

.video-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.50rem;
  align-items: center;
}
.video-upload-form input[type="url"] {
  border: 1px dashed #93c5fd;
  background: #f8fbff;
  border-radius: 12px;
  padding: 0.70rem 1rem;
  font-size: 0.95rem;
  flex: 1 1 240px;
}
.video-upload-form input[type="text"] {
  border: 1px dashed #93c5fd;
  background: #f8fbff;
  border-radius: 12px;
  padding: 0.70rem 1rem;
  font-size: 0.95rem;
  flex: 1 1 240px;
}

.video-upload-form .form-group {
  flex: 1 1 240px;
  min-width: 180px;
}
.video-upload-form .form-group > * {
  width: 100%;
  box-sizing: border-box;
}

#video-submit-btn {
  flex: 0 0 auto;
}
.video-panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 1.2rem;
  padding-bottom: 1.8rem;
  padding-left: 1.7rem;
}
.course-create-form {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.50rem;
  align-items: center;
} 
.course-create-form input[type="text"] {
  border: 1px dashed #93c5fd;
  background: #f8fbff;
  border-radius: 12px;
  padding: 0.70rem 1rem;
  font-size: 0.95rem;
  flex: 1 1 240px;
}
.course-create-form .form-group {
  flex: 1 1 320px;
  min-width: 200px;
}
.course-create-form .form-group {
  flex: 1 1 240px;
  min-width: 180px;
}
.course-create-form .form-group > * {
  width: 100%;
  box-sizing: border-box;
}
.checkbox-inline {
  display: inline-flex;   
  align-items: center;   
  gap: 0.5rem;  
}

.checkbox-inline input[type="checkbox"] {
  margin-bottom: 10;  
}
.course-label {
  margin-top: 5px;
}
#course-submit-btn {
  flex: 0 0 auto;
}
.scrape-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.scrape-form input[type="url"] {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  flex: 1 1 320px;
  background: #ffffff;
}

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.divider span {
  font-size: 0.75rem;
}

textarea {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  resize: none;
  background: #ffffff;
  color: inherit;
}

button {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.26);
}

button.secondary {
  background: transparent;
  color: #2563eb;
  border: 1px solid #93c5fd;
}

button.secondary:hover:not([disabled]) {
  background: #e0ecff;
}

.status {
  min-height: 1.5rem;
  color: #2563eb;
  font-weight: 500;
}

.document-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}
.course-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}
.document-list li {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.document-meta {
  color: #64748b;
  font-size: 0.95rem;
}

.chat-layout {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 1.75rem;
}

.reference-panel,
.conversation-panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
}

.reference-list {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.reference-placeholder {
  color: #64748b;
  margin: 0;
}


.reference-card {
  border: 1px solid #dbeafe;
  border-radius: 14px;
  padding: 1rem;
  background: #f8fbff;
  display: grid;
  gap: 0.5rem;
}

.reference-card[data-type="pdf"] {
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.reference-card[data-type="pdf"]:hover {
  border-color: #93c5fd;
  background: #ecf2ff;
}

.reference-card.active {
  border-color: #2563eb;
  background: #e0ecff;
}

.reference-card h4 {
  margin: 0;
  font-size: 1rem;
  color: #1d4ed8;
}

.reference-meta {
  font-size: 0.85rem;
  color: #475569;
}

.reference-excerpt {
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.6;
  background: #ffffff;
  border-radius: 10px;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
}

.reference-link {
  font-size: 0.85rem;
  color: #1d4ed8;
  text-decoration: underline;
  word-break: break-word;
}

.reference-link:hover {
  text-decoration: none;
}

.reference-hint {
  font-size: 0.8rem;
  color: #1d4ed8;
  font-weight: 600;
}

.reference-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 2rem;
  z-index: 1000;
}

.reference-modal.hidden {
  display: none;
}

.reference-modal-dialog {
  width: min(960px, 100%);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
  display: grid;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1.5rem;
}

.reference-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.reference-modal-title {
  margin: 0;
  font-size: 1.05rem;
  color: #111827;
}

.reference-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #1f2937;
  padding: 0.25rem 0.5rem;
}

.modal-close:hover {
  color: #ef4444;
}

.reference-modal-frame {
  width: 100%;
  height: 70vh;
  min-height: 320px;
  border: none;
  border-radius: 12px;
  background: #f8fafc;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 0 1rem;
  overflow-y: auto;
  max-height: 70vh;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  line-height: 1.6;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.chat-bubble.user {
  align-self: flex-end;
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: #f1f5f9;
  color: #0f172a;
  border-bottom-left-radius: 4px;
}

.chat-form {
  margin-top: auto;
  display: grid;
  gap: 0.75rem;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: end;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 0.5rem 0.75rem;
  background: #ffffff;
}

.chat-input textarea {
  border: none;
  padding: 0;
  min-height: 3rem;
  box-shadow: none;
}

.chat-input textarea:focus {
  outline: none;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-actions  {
  border-radius: 50px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 1024px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .reference-panel {
    order: 2;
  }
}

@media (max-width: 768px) {
  .app-shell {
    padding: 1.5rem 1rem 2rem;
  }

  .panel,
  .reference-panel,
  .conversation-panel {
    padding: 1.25rem;
  }

  .chat-input {
    grid-template-columns: 1fr;
  }

  .chat-actions {
    justify-content: flex-end;
  }
}
/* Add these form group styles */
.form-group {
  margin-bottom: 1rem;
  width: 100%;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

/* Ensure video inputs and course selects have consistent styling */
.video-input, .course-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  background-color: white;
  font-size: 0.95rem;
} 

