/* ============================================================
   AI採点モーダル — grading.css
   ============================================================ */

.grading-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.grading-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.grading-panel {
  position: relative;
  background: #fff;
  width: min(640px, 92vw);
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.grading-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.grading-panel-header h2 {
  margin: 0; font-size: 18px; color: #111827;
}
.grading-close {
  background: none; border: none; cursor: pointer;
  font-size: 28px; color: #6b7280; line-height: 1;
  padding: 0 8px;
}
.grading-close:hover { color: #111827; }
.grading-panel-body {
  padding: 20px;
  overflow-y: auto;
}

/* ---- ステップラベル ---- */
.grading-step-label {
  font-size: 12px; color: #6366f1;
  font-weight: 600; margin: 0 0 4px;
  letter-spacing: 0.04em;
}
.grading-panel-body h3 {
  margin: 0 0 16px; font-size: 18px; color: #111827;
}

/* ---- 教科グリッド ---- */
.grading-subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.grading-subject-btn {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 12px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.grading-subject-btn:hover {
  background: #eef2ff;
  border-color: #6366f1;
  transform: translateY(-2px);
}
.grading-subject-emoji { font-size: 36px; }
.grading-subject-label {
  font-size: 14px; font-weight: 600; color: #1f2937;
}

/* ---- 注意書き ---- */
.grading-notice {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
}

/* ---- スロット ---- */
.grading-slot {
  margin-bottom: 12px;
}
.grading-slot-head {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 6px;
  padding: 0 2px;
}
.grading-slot-title {
  font-size: 14px; font-weight: 600; color: #111827;
}
.grading-slot-hint {
  font-size: 11px; color: #6b7280;
}

/* ---- ドロップゾーン ---- */
.grading-slot-dropzone {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 12px;
  background: #fafafa;
  transition: all 0.15s;
}
.grading-slot-dropzone.drag-over {
  border-color: #6366f1;
  background: #eef2ff;
}
.grading-slot-dropzone.drag-over .grading-slot-drop-overlay {
  display: flex;
}
.grading-slot-drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 10px;
  align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #4338ca;
  pointer-events: none;
}

/* ---- スロット中身 ---- */
.grading-slot-contents {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 8px;
}
.grading-slot-empty {
  text-align: center;
  font-size: 12px; color: #9ca3af;
  padding: 14px 8px;
}

.grading-item {
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}
.grading-item.text { background: #eef2ff; border-color: #c7d2fe; }
.grading-item-icon { font-size: 16px; flex-shrink: 0; }
.grading-item-name {
  flex: 1;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grading-item-edit, .grading-item-remove {
  background: none;
  border: 1px solid #d1d5db;
  color: #4b5563;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}
.grading-item-remove { color: #b91c1c; border-color: #fecaca; }
.grading-item-edit:hover { background: #f3f4f6; }
.grading-item-remove:hover { background: #fef2f2; }

/* ---- スロットアクション ---- */
.grading-slot-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px dashed #e5e7eb;
}
.grading-slot-add-file {
  display: inline-flex; align-items: center; gap: 6px;
  background: #6366f1; color: #fff;
  padding: 7px 12px;
  border-radius: 8px; cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}
.grading-slot-add-file:hover { background: #4f46e5; }
.grading-slot-add-text {
  background: #fff; color: #4f46e5;
  border: 1px solid #c7d2fe;
  padding: 7px 12px;
  border-radius: 8px; cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}
.grading-slot-add-text:hover { background: #eef2ff; }

/* ---- テキストエディタ ---- */
.grading-slot-text-editor {
  background: #fff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 8px;
}
.grading-slot-textarea {
  width: 100%; min-height: 120px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.grading-slot-text-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 8px;
}
.grading-slot-cancel {
  background: #f3f4f6; color: #374151;
  border: 1px solid #d1d5db;
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
  font-size: 12px;
}
.grading-slot-save {
  background: #10b981; color: #fff;
  border: none;
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  font-size: 12px;
}
.grading-slot-save:hover { background: #059669; }

/* ---- アクション ---- */
.grading-actions {
  display: flex; justify-content: space-between;
  gap: 12px; margin-top: 8px;
}
.grading-back {
  background: none; color: #6b7280;
  border: 1px solid #d1d5db;
  padding: 10px 16px; border-radius: 8px; cursor: pointer;
  font-size: 13px;
}
.grading-back:hover { background: #f3f4f6; }
.grading-submit {
  background: #6366f1; color: #fff;
  border: none;
  padding: 10px 20px; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600;
  flex: 1;
}
.grading-submit:hover { background: #4f46e5; }
.grading-submit:disabled {
  background: #9ca3af; cursor: not-allowed;
}

/* ---- ステータス ---- */
.grading-status { margin-top: 16px; }
.grading-loader {
  display: flex; align-items: center; gap: 12px;
  background: #eef2ff; color: #3730a3;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
}
.grading-error {
  background: #fef2f2; color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}
