/* Shared form language for the teaching console and learner workspace. */
:root {
  --control-line: #c9d7e2;
  --control-fill: #fbfdff;
  --control-quiet: #edf2f5;
  --control-ring: rgba(49, 91, 255, .16);
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.form-grid, .course-section, .homework-config, .settings-fields, .ai-config, .dispatch-box, .question-editor, .homework-question-editor, .manual-grading-form)
  :is(input:where(:not([type="file"], [type="checkbox"], [type="radio"], [type="hidden"])), select:where(:not([size], [multiple])), textarea),
.app-shell :is(.smart-exam-setup, .learning-form, .dingtalk-path-body)
  :is(input:where(:not([type="checkbox"], [type="radio"], [type="hidden"])), select:where(:not([size], [multiple])), textarea),
.profile-editor input,
.login-card input {
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--control-line);
  border-radius: 12px;
  background-color: var(--control-fill);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 33, 43, .035);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.form-grid, .course-section, .homework-config, .settings-fields, .ai-config, .dispatch-box, .question-editor, .homework-question-editor, .manual-grading-form)
  :is(input:where(:not([type="file"], [type="checkbox"], [type="radio"], [type="hidden"])), select:where(:not([size], [multiple])), textarea):focus,
.app-shell :is(.smart-exam-setup, .learning-form, .dingtalk-path-body)
  :is(input:where(:not([type="checkbox"], [type="radio"], [type="hidden"])), select:where(:not([size], [multiple])), textarea):focus,
.profile-editor input:focus,
.login-card input:focus {
  outline: 0;
  border-color: var(--blue);
  background-color: #fff;
  box-shadow: 0 0 0 4px var(--control-ring);
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.form-grid, .course-section, .homework-config, .settings-fields, .ai-config, .dispatch-box, .question-editor, .homework-question-editor, .manual-grading-form)
  :is(input, textarea)::placeholder,
.app-shell :is(.smart-exam-setup, .learning-form, .dingtalk-path-body) :is(input, textarea)::placeholder,
.profile-editor input::placeholder,
.login-card input::placeholder {
  color: #8697a3;
  opacity: 1;
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.form-grid, .course-section, .homework-config, .settings-fields, .ai-config, .dispatch-box, .question-editor, .homework-question-editor, .manual-grading-form)
  :is(select:where(:not([size], [multiple])), textarea),
.app-shell :is(.smart-exam-setup, .learning-form) :is(select:where(:not([size], [multiple])), textarea) {
  padding-inline: 14px;
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.form-grid, .course-section, .ai-config, .dispatch-box, .question-editor, .homework-question-editor)
  select:not([size]):not([multiple]),
:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.filter-button, .setting-select):is(select),
.app-shell :is(.smart-exam-setup, .learning-form) select:not([size]):not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 6 4.5 4 4.5-4' fill='none' stroke='%2361717d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.filter-button, .setting-select):is(select),
:is(.admin-app, .admin-modal, .linked-courses-dialog) .date-picker:is(input) {
  min-height: 44px;
  border-color: var(--control-line);
  border-radius: 11px;
  background-color: var(--control-fill);
  color: var(--ink);
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.filter-button, .setting-select, .date-picker):focus,
:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.admin-search, .utility-search):focus-within,
.app-shell :is(.search-box, .composer):focus-within {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--control-ring);
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(input, select, textarea):disabled,
.app-shell :is(input, select, textarea):disabled {
  cursor: not-allowed;
  background-color: var(--control-quiet);
  color: #6d7d88;
  box-shadow: none;
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) .completion-number input {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
:is(.admin-app, .admin-modal, .linked-courses-dialog) .completion-number input:focus { border: 0; box-shadow: none; }
:is(.admin-app, .admin-modal, .linked-courses-dialog) .completion-number:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px var(--control-ring); outline: 0; }

/* The selected card's cobalt rule acts like a tab in a training record. */
:is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-grid { gap: 10px; }
:is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option > span {
  position: relative;
  display: grid;
  min-height: 54px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-content: center;
  align-items: center;
  column-gap: 11px;
  row-gap: 3px;
  padding: 10px 13px;
  border: 1px solid var(--control-line);
  border-radius: 12px;
  background: var(--control-fill);
  box-shadow: 0 1px 2px rgba(20, 33, 43, .035);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
:is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option > span::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--blue);
  opacity: 0;
}
:is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option i { grid-row: 1 / span 2; width: 21px; height: 21px; border-color: #9eafba; }
:is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option b { grid-column: 2; min-width: 0; line-height: 1.4; overflow-wrap: anywhere; }
:is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option small { grid-column: 2; margin: 0; line-height: 1.35; overflow-wrap: anywhere; }
:is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option input:checked + span {
  border-color: #8da6ff;
  background: #f0f4ff;
  box-shadow: 0 2px 9px rgba(49, 91, 255, .08);
}
:is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option input:checked + span::before { opacity: 1; }
:is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--control-ring);
}

:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.homework-answer-picker, .manual-answer-options) label:has(> input:checked),
.app-shell :is(.exam-question, .homework-answer-options) label:has(> input:checked) {
  border-color: #8da6ff;
  background: #f0f4ff;
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--blue);
}
:is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.homework-answer-picker, .manual-answer-options) input:is([type="checkbox"], [type="radio"]),
.app-shell :is(.exam-question, .homework-answer-options) input:is([type="checkbox"], [type="radio"]) {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

@media (hover: hover) {
  :is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option:hover > span { border-color: #8da6ff; background: #f6f8ff; }
  :is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.homework-answer-picker, .manual-answer-options) label:hover,
  .app-shell :is(.exam-question, .homework-answer-options) label:hover { border-color: #8da6ff; }
}

@media (max-width: 760px) {
  :is(.admin-app, .admin-modal, .linked-courses-dialog) :is(.form-grid, .course-section, .homework-config, .settings-fields, .ai-config, .dispatch-box, .question-editor, .homework-question-editor, .manual-grading-form)
    :is(input:where(:not([type="file"], [type="checkbox"], [type="radio"], [type="hidden"])), select:where(:not([size], [multiple])), textarea),
  .app-shell :is(.smart-exam-setup, .learning-form, .dingtalk-path-body)
    :is(input:where(:not([type="checkbox"], [type="radio"], [type="hidden"])), select:where(:not([size], [multiple])), textarea),
  .profile-editor input,
  .login-card input { font-size: 16px; }
  :is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-grid { grid-template-columns: 1fr; }
  :is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option > span { min-height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  :is(.admin-app, .admin-modal, .linked-courses-dialog) .choice-option > span,
  :is(.admin-app, .admin-modal, .linked-courses-dialog) :is(input, select, textarea),
  .app-shell :is(input, select, textarea),
  .profile-editor input,
  .login-card input { transition: none; }
}
