
/* ============================================================
   TEACHING SUPERVISION FORM — STYLE.CSS
   Emerald/Teal Premium Theme | Sarabun Font
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary:        #059669;
  --primary-dark:   #047857;
  --primary-light:  #d1fae5;
  --primary-mid:    #6ee7b7;
  --teal:           #0d9488;
  --teal-dark:      #0f766e;
  --teal-light:     #ccfbf1;

  --text-dark:      #0f172a;
  --text-mid:       #334155;
  --text-light:     #64748b;
  --text-muted:     #94a3b8;

  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --surface-3:      #f1f5f9;
  --border:         #e2e8f0;
  --border-focus:   #34d399;

  --danger:         #ef4444;
  --warning:        #f59e0b;
  --success:        #10b981;

  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;
  --radius-xl:      28px;

  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:      0 12px 40px rgba(0,0,0,.10);
  --shadow-card:    0 2px 8px rgba(5,150,105,.06), 0 8px 32px rgba(5,150,105,.04);

  --transition:     .2s ease;
  --transition-md:  .35s cubic-bezier(.4,0,.2,1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Sarabun', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dark);
  background: #ecfdf5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ---------- Background Orbs ---------- */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
}
.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #6ee7b7, #34d399);
  top: -200px; right: -150px;
  animation: floatOrb 14s ease-in-out infinite;
}
.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #99f6e4, #2dd4bf);
  bottom: 100px; left: -180px;
  animation: floatOrb 18s ease-in-out infinite reverse;
}
.orb-3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #a7f3d0, #6ee7b7);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: floatOrb 22s ease-in-out infinite;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0); }
  33%       { transform: translate(20px, -30px); }
  66%       { transform: translate(-15px, 20px); }
}

/* ---------- Container ---------- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 16px 80px;
  position: relative;
  z-index: 1;
}

/* ---------- Card ---------- */
.card {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 32px;
  margin-bottom: 24px;
  transition: box-shadow var(--transition-md);
}
.card:hover { box-shadow: var(--shadow-lg); }

/* ---------- Header Card ---------- */
.header-card {
  background: linear-gradient(135deg, #059669 0%, #0d9488 50%, #0891b2 100%);
  border: none;
  padding: 0;
  overflow: hidden;
  color: white;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 36px 40px 28px;
}

.school-logo-wrap {
  flex-shrink: 0;
}

.school-logo {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.5);
  background: white;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.header-text { flex: 1; }

.header-sub {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.75);
  margin-bottom: 4px;
}

.header-title {
  font-family: 'Prompt', sans-serif;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  color: white;
}

.header-school {
  font-size: 16px;
  color: rgba(255,255,255,.85);
  margin-top: 4px;
}

/* ---------- Progress Bar ---------- */
.progress-container {
  background: rgba(0,0,0,.15);
  padding: 20px 40px 24px;
  border-top: 1px solid rgba(255,255,255,.15);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.progress-labels span {
  font-size: 12px;
  color: rgba(255,255,255,.75);
  font-weight: 500;
}

.progress-bar-wrap {
  height: 8px;
  background: rgba(255,255,255,.2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #34d399, #a7f3d0);
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 12px rgba(52,211,153,.6);
}

.progress-text {
  font-size: 12px;
  color: rgba(255,255,255,.65);
  text-align: right;
  margin-top: 6px;
}

/* ---------- Section Header ---------- */
.section-card { padding: 32px; }

.section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--primary-light);
}

.section-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}

.section-title {
  font-family: 'Prompt', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--teal-dark);
  margin-bottom: 4px;
}

.section-desc {
  font-size: 14px;
  color: var(--text-light);
}

/* ---------- Form Grid ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.form-group { display: flex; flex-direction: column; }
.col-1 { grid-column: span 1; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 6px;
}

.required { color: var(--danger); margin-left: 2px; }

.form-input {
  width: 100%;
  padding: 11px 14px;
  font-family: 'Sarabun', sans-serif;
  font-size: 15px;
  color: var(--text-dark);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(52,211,153,.2);
  background: white;
}

.form-input::placeholder { color: var(--text-muted); }

.form-select { cursor: pointer; }

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

/* ---------- Questions ---------- */
.questions-section {
  margin-bottom: 24px;
}

.questions-section-title {
  font-family: 'Prompt', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  padding: 10px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.question-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.question-row:hover {
  border-color: var(--primary-mid);
  background: white;
  box-shadow: var(--shadow-sm);
}
.question-row.answered {
  border-color: var(--primary);
  background: linear-gradient(90deg, rgba(5,150,105,.04), transparent);
}

.question-text {
  font-size: 15px;
  color: var(--text-mid);
  line-height: 1.5;
}

.radio-group {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.radio-item { position: relative; }

.radio-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  background: white;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.radio-label:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.radio-item input[type="radio"]:checked + .radio-label {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: white;
  box-shadow: 0 4px 12px rgba(5,150,105,.4);
  transform: scale(1.08);
}

/* Score value color coding */
.radio-item:nth-child(1) input:checked + .radio-label { background: linear-gradient(135deg,#059669,#0d9488); }
.radio-item:nth-child(2) input:checked + .radio-label { background: linear-gradient(135deg,#16a34a,#059669); }
.radio-item:nth-child(3) input:checked + .radio-label { background: linear-gradient(135deg,#ca8a04,#d97706); }
.radio-item:nth-child(4) input:checked + .radio-label { background: linear-gradient(135deg,#ea580c,#dc2626); }
.radio-item:nth-child(5) input:checked + .radio-label { background: linear-gradient(135deg,#dc2626,#9f1239); }

/* Score labels header */
.question-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 6px 18px;
  margin-bottom: 4px;
  align-items: center;
}
.question-header-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: .02em;
}
.score-header-labels {
  display: flex;
  gap: 6px;
}
.score-header-label {
  width: 38px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
}

/* ---------- Score Summary ---------- */
.score-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
  padding: 24px;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border-radius: var(--radius-lg);
  border: 2px solid var(--primary-light);
}

.score-box {
  text-align: center;
  padding: 16px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.score-box:hover { transform: translateY(-2px); }

.score-label {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
  margin-bottom: 8px;
}

.score-value {
  font-family: 'Prompt', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
  transition: all var(--transition-md);
}

.score-max {
  font-size: 13px;
  color: var(--text-muted);
}

.result-text {
  font-size: 22px;
  color: var(--teal-dark);
}

/* ---------- Gauge Bar ---------- */
.gauge-wrap {
  margin-top: 20px;
  padding: 0 4px;
}

.gauge-bar-bg {
  height: 12px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.1);
}

.gauge-bar {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 30%, #eab308 50%, #22c55e 70%, #059669 100%);
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 8px rgba(5,150,105,.4);
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}
.gauge-labels span {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------- Feedback Grid ---------- */
.feedback-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.feedback-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 14px;
  margin-right: 6px;
}
.feedback-icon.strength  { background: #dcfce7; }
.feedback-icon.weakness  { background: #fee2e2; }
.feedback-icon.suggestion{ background: #dbeafe; }

/* ---------- Upload Area ---------- */
.upload-area {
  margin-top: 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  background: var(--surface-2);
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-title { font-size: 17px; font-weight: 600; color: var(--text-mid); margin-bottom: 4px; }
.upload-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: white;
  border: 1.5px solid var(--primary);
  border-radius: 99px;
  color: var(--primary);
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-upload:hover {
  background: var(--primary);
  color: white;
}

.file-count {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
.file-count.has-files { color: var(--primary); }
.file-count.error { color: var(--danger); }

.image-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.preview-thumb {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 2px solid var(--primary-light);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.preview-thumb:hover { transform: scale(1.05); }

/* ---------- Signature ---------- */
.sig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.sig-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sig-role-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--teal-dark);
}

.sig-name-input { max-width: 100%; }

.canvas-wrap {
  position: relative;
  background: white;
  border: 1.5px dashed var(--border-focus);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sig-pad {
  display: block;
  width: 100%;
  height: 150px;
  cursor: crosshair;
  touch-action: none;
}

.canvas-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
  transition: opacity var(--transition);
  user-select: none;
}
.canvas-wrap.has-sig .canvas-hint { opacity: 0; }

.btn-clear-sig {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--danger);
  font-family: 'Sarabun', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--transition);
}
.btn-clear-sig:hover { background: #fee2e2; }

/* ---------- Action Row ---------- */
.action-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  font-family: 'Sarabun', sans-serif;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-md);
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(.97); }
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.15);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn:hover::after { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: white;
  box-shadow: 0 6px 20px rgba(5,150,105,.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(5,150,105,.45);
}
.btn-primary:disabled {
  background: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: white;
  color: var(--primary-dark);
  border: 1.5px solid var(--primary);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-icon { font-size: 18px; }

/* ---------- Status Message ---------- */
.status-message {
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  margin-top: 16px;
  animation: fadeIn .4s ease;
}
.status-message.success {
  background: #dcfce7;
  color: #166534;
  border: 1.5px solid #bbf7d0;
}
.status-message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1.5px solid #fecaca;
}
.status-message.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Footer ---------- */
.form-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.8;
  padding-top: 24px;
  margin-top: 32px;
  border-top: 1px solid var(--border);
}
.form-footer strong { color: var(--primary-dark); }

/* ---------- Responsive: Tablet (max 768px) ---------- */
@media (max-width: 768px) {
  .container { padding: 16px 12px 80px; }
  .card, .section-card { padding: 20px 16px; }
  .header-inner { gap: 16px; padding: 24px 20px 20px; }
  .school-logo { width: 72px; height: 72px; }
  .header-title { font-size: clamp(18px, 4vw, 26px); }
  .progress-container { padding: 16px 20px 20px; }

  /* Form grid: 2 cols on tablet */
  .form-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .col-3 { grid-column: span 2; }

  /* Questions */
  .question-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 14px;
  }
  .radio-group { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
  .radio-label { width: 40px; height: 40px; font-size: 14px; }
  .score-header-label { width: 40px; }
  .question-header { display: none; } /* hide header on small screen */

  /* Score summary */
  .score-summary { grid-template-columns: 1fr 1fr; gap: 12px; }
  .score-box:last-child { grid-column: span 2; }
  .score-value { font-size: 28px; }

  /* Sig */
  .sig-grid { grid-template-columns: 1fr; gap: 16px; }

  /* Buttons */
  .action-row { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; justify-content: center; padding: 14px 20px; }

  /* Upload */
  .upload-area { padding: 20px 16px; }
  .upload-icon { font-size: 36px; }
}

/* ---------- Responsive: Mobile (max 480px) ---------- */
@media (max-width: 480px) {
  body { font-size: 15px; }
  .container { padding: 12px 10px 70px; }
  .card, .section-card { padding: 16px 12px; border-radius: 16px; }

  /* Header */
  .header-inner { flex-direction: column; text-align: center; padding: 20px 16px 16px; gap: 12px; }
  .school-logo { width: 64px; height: 64px; }
  .header-title { font-size: 20px; }
  .header-school { font-size: 13px; }
  .progress-container { padding: 14px 16px 16px; }
  .progress-labels span { font-size: 10px; }

  /* Section */
  .section-icon { font-size: 22px; }
  .section-title { font-size: 15px; }
  .section-desc { font-size: 13px; }

  /* Form: 1 col */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .col-1, .col-2, .col-3 { grid-column: span 1; }
  .form-input { font-size: 15px; padding: 12px; }

  /* Questions */
  .radio-label { width: 44px; height: 44px; font-size: 15px; }
  .radio-group { gap: 6px; }
  .question-text { font-size: 14px; }

  /* Score summary: 1 col */
  .score-summary { grid-template-columns: 1fr; gap: 10px; }
  .score-box:last-child { grid-column: span 1; }
  .score-value { font-size: 32px; }

  /* Gauge labels */
  .gauge-labels span { font-size: 9px; }

  /* Feedback */
  .form-textarea { min-height: 80px; }

  /* Upload */
  .upload-area { padding: 16px 12px; }
  .upload-icon { font-size: 32px; margin-bottom: 8px; }
  .upload-title { font-size: 15px; }
  .preview-thumb { width: 80px; height: 80px; }

  /* Signature */
  .sig-pad { height: 130px; }
  .sig-card { padding: 16px 12px; }

  /* Buttons */
  .btn { font-size: 15px; padding: 13px 16px; }
  .btn-icon { font-size: 16px; }
  .status-message { padding: 14px 16px; font-size: 15px; }

  /* Footer */
  .form-footer { font-size: 12px; }
}

/* ---------- Smooth scroll offset ---------- */
[id] { scroll-margin-top: 64px; }


