/**
 * zero-fouc-shell.css
 * Quy tắc CSS nền tảng cho nhóm nút phân đoạn (Segmented Buttons), thanh tab biểu điểm (Rubric Mode Tabs)
 * và tương phản biểu mẫu Chế độ Tối (Dark Mode Form Controls).
 * Được tách từ head.html nhằm tuân thủ nghiêm ngặt trần <= 800 dòng/tệp (SOLID / SoC).
 * Định danh thương hiệu: AUTOGRADING.
 */

.segmented-button-group {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  background: #e2e8f0 !important;
  padding: 6px !important;
  border-radius: 14px !important;
  border: 2px solid #cbd5e1 !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06) !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
@media (max-width: 540px) {
  .segmented-button-group {
    grid-template-columns: 1fr !important;
  }
}
.segmented-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 0.75rem 1rem !important;
  min-height: 48px !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  font-size: 0.9rem !important;
  cursor: pointer !important;
  user-select: none !important;
  border: 2px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #475569 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-decoration: none !important;
}
.segmented-btn:hover:not(.active) {
  color: #0f172a !important;
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08) !important;
}
.segmented-btn.active {
  background: linear-gradient(135deg, #4338ca 0%, #312e81 100%) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border-color: #312e81 !important;
  box-shadow: 0 4px 14px rgba(67, 56, 202, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  transform: scale(1.02) !important;
  z-index: 2 !important;
}
.segmented-btn .seg-status-badge {
  font-size: 0.7rem !important;
  padding: 2px 8px !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  letter-spacing: 0.02em !important;
}
.segmented-btn.active .seg-status-badge {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
}
.segmented-btn:not(.active) .seg-status-badge {
  display: none !important;
}

/* Critical Rubric Tabs Dual-Mode Resilience */
.rubric-mode-tabs {
  display: flex !important;
  gap: 0.35rem !important;
  background: var(--surface-hover) !important;
  padding: 0.3rem !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border-color) !important;
  margin-bottom: 0.75rem !important;
  overflow-x: auto !important;
}
.rubric-tab-btn {
  flex: 1 !important;
  text-align: center !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  padding: 0.45rem 0.6rem !important;
  border-radius: var(--radius-xs) !important;
  color: var(--text-secondary) !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  user-select: none !important;
}
.rubric-tab-btn:hover {
  color: var(--text-main) !important;
  background: var(--surface-active) !important;
}
.rubric-tab-btn.active {
  background: var(--card-bg) !important;
  color: var(--primary) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}
[data-theme="dark"] .rubric-tab-btn {
  color: #94a3b8 !important;
}
[data-theme="dark"] .rubric-tab-btn:hover {
  color: #f8fafc !important;
  background: rgba(255, 255, 255, 0.08) !important;
}
[data-theme="dark"] .rubric-tab-btn.active {
  background: #1e293b !important;
  color: #60a5fa !important;
  border-color: rgba(96, 165, 250, 0.35) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}
.btn-success {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25) !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}
.btn-success:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 50%, #10b981 100%) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.38) !important;
  transform: translateY(-1px) !important;
}

/* Rubric Question Editor & Universal Form Controls */
.btn-add-rubric-question {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  padding: 0.28rem 0.7rem !important;
  border-radius: var(--radius-xs, 6px) !important;
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  color: #2563eb !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}
.btn-add-rubric-question:hover {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
}
[data-theme="dark"] .btn-add-rubric-question {
  background: rgba(59, 130, 246, 0.18) !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
  color: #93c5fd !important;
}
[data-theme="dark"] .btn-add-rubric-question:hover {
  background: rgba(59, 130, 246, 0.32) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}

.rubric-criteria-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #15803d;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.rubric-solution-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
[data-theme="dark"] .rubric-criteria-label {
  color: #4ade80 !important;
}
[data-theme="dark"] .rubric-solution-label {
  color: #60a5fa !important;
}

.rubric-textarea,
.rubric-q-detail textarea {
  width: 100% !important;
  font-size: 0.78rem !important;
  padding: 0.4rem 0.6rem !important;
  border: 1px solid var(--border-color, #cbd5e1) !important;
  border-radius: var(--radius-xs, 6px) !important;
  resize: vertical !important;
  min-height: 52px !important;
  background: var(--input-bg, #ffffff) !important;
  color: var(--input-text, #0f172a) !important;
  font-family: inherit !important;
  line-height: 1.45 !important;
}
.rubric-deduction-field {
  background: #fff1f2 !important;
  color: #991b1b !important;
  border: 1px solid #fecdd3 !important;
}
.rubric-deduction-field::placeholder {
  color: #f87171 !important;
}
[data-theme="dark"] .rubric-deduction-field {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
[data-theme="dark"] .rubric-deduction-field::placeholder {
  color: #f87171 !important;
}

.rubric-delete-btn {
  color: #ef4444 !important;
  border: 1px solid #fca5a5 !important;
  background: transparent !important;
}
.rubric-delete-btn:hover {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}
[data-theme="dark"] .rubric-delete-btn {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #f87171 !important;
}
[data-theme="dark"] .rubric-delete-btn:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}

/* Universal Dark Form Controls and Inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  color-scheme: dark;
}

[data-theme="dark"] .rubric-textarea,
[data-theme="dark"] .rubric-q-detail textarea,
[data-theme="dark"] .q-criteria-input,
[data-theme="dark"] .q-solution-input,
[data-theme="dark"] textarea,
[data-theme="dark"] input.form-control,
[data-theme="dark"] input.input-form,
[data-theme="dark"] input.input-gate,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] select.form-control,
[data-theme="dark"] select {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}
[data-theme="dark"] textarea::placeholder,
[data-theme="dark"] input::placeholder {
  color: #64748b !important;
}
[data-theme="dark"] select option,
[data-theme="dark"] optgroup {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}
[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] {
  accent-color: #4f46e5;
}

/* Universal Dark File Upload Buttons */
[data-theme="dark"] input[type="file"]::file-selector-button,
[data-theme="dark"] input[type="file"]::-webkit-file-upload-button {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #475569 !important;
  border-radius: 6px !important;
  padding: 0.35rem 0.75rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}
[data-theme="dark"] input[type="file"]::file-selector-button:hover,
[data-theme="dark"] input[type="file"]::-webkit-file-upload-button:hover {
  background: #334155 !important;
  border-color: #64748b !important;
}

[data-theme="dark"] .badge-score-invalid {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}
