:root {
  --teal: #1a6b6a;
  --teal-light: #e8f4f4;
  --teal-dark: #0f4e4d;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --white: #ffffff;
  --red-500: #ef4444;
  --red-50: #fef2f2;
  --green-500: #10b981;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 100px;
}

header {
  background: var(--teal);
  color: var(--white);
  padding: 24px 32px;
  text-align: center;
}

header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

header .subtitle {
  font-size: 14px;
  opacity: 0.85;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Fields */
.meta-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(26, 107, 106, 0.1);
}

.field-full {
  grid-column: 1 / -1;
}

.optional {
  font-weight: 400;
  color: var(--gray-500);
  font-size: 11px;
}

/* Groupings */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 18px;
  color: var(--gray-900);
}

.grouping-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.grouping-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}

.grouping-header input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
}

.grouping-header input:focus {
  outline: none;
  border-color: var(--teal);
}

.grouping-header .btn-remove {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
}

.grouping-header .btn-remove:hover {
  background: var(--red-50);
  color: var(--red-500);
}

.grouping-body {
  padding: 16px 20px;
}

.selected-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--teal-light);
  color: var(--teal-dark);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.skill-tag .tag-remove {
  background: none;
  border: none;
  color: var(--teal);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.skill-tag .tag-remove:hover {
  color: var(--red-500);
}

.skill-lessons {
  font-size: 12px;
  color: var(--gray-500);
  margin-left: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--gray-200);
  margin-bottom: 8px;
}

.btn-add-skill {
  background: none;
  border: 1px dashed var(--gray-300);
  color: var(--gray-500);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.btn-add-skill:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-light);
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--teal);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--teal-dark);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-generate {
  background: var(--teal);
  color: var(--white);
  font-size: 16px;
  padding: 14px 32px;
  width: 100%;
  max-width: 300px;
}

.btn-generate:hover {
  background: var(--teal-dark);
}

/* Footer */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 16px;
  display: flex;
  justify-content: center;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

/* Output */
.output-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-top: 24px;
}

.output-section h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.output-instructions {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 16px;
}

#prompt-output {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.copy-confirmation {
  font-size: 13px;
  color: var(--green-500);
  margin-left: 12px;
  opacity: 0;
  transition: opacity 0.3s;
}

.copy-confirmation.visible {
  opacity: 1;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-content {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.search-box {
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
}

.search-box input:focus {
  outline: none;
  border-color: var(--teal);
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.category-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 0 4px 0;
  border-bottom: 1px solid var(--gray-100);
}

.skill-option {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: var(--radius);
  transition: background 0.1s;
}

.skill-option:hover {
  background: var(--gray-50);
}

.skill-option.selected {
  background: var(--teal-light);
}

.skill-option-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.skill-option input[type="checkbox"].skill-checkbox {
  margin-top: 2px;
  accent-color: var(--teal);
}

.skill-option-info {
  flex: 1;
}

.skill-option-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}

.lesson-checkboxes {
  margin-left: 28px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lesson-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-700);
}

.lesson-option:hover {
  background: rgba(26, 107, 106, 0.05);
}

.lesson-option input[type="checkbox"] {
  accent-color: var(--teal);
}

.skill-option-lessons {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
}

.empty-state p {
  font-size: 14px;
}

/* Responsive */
@media (max-width: 600px) {
  .meta-section {
    grid-template-columns: 1fr;
  }

  .modal-content {
    max-height: 90vh;
  }
}
