/* ═══════════════════════════════════════════════════════════════
   SK Eval — Student CSS (Mobile First)
═══════════════════════════════════════════════════════════════ */

/* ─── Page Layout ────────────────────────────────────────────── */
.student-page { min-height: 100vh; min-height: 100dvh; background: var(--bg-page); }

/* ─── Login Page ─────────────────────────────────────────────── */
.login-hero {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-header);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-card {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px);
  border-radius: var(--border-radius-xl);
  padding: 40px 32px;
  text-align: center;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  position: relative; z-index: 1;
  animation: fadeIn .5s ease;
}
.login-logo {
  width: 80px; height: 80px;
  border-radius: 50%;
  margin: 0 auto 20px;
  border: 4px solid var(--pink-100);
  object-fit: cover;
  box-shadow: var(--shadow-md);
}
.login-school-name {
  font-size: 1.4rem; font-weight: 800;
  background: var(--bg-header);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}
.login-subtitle { color: var(--text-muted); font-size: .9rem; margin-bottom: 28px; }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: .85rem;
  margin: 24px 0;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: #e0e0e0;
}
.login-note {
  font-size: .82rem; color: var(--text-muted);
  background: var(--blue-50); border-radius: var(--border-radius-md);
  padding: 10px 14px; margin-top: 16px; text-align: left;
  line-height: 1.6;
}
.login-error {
  background: #ffebee; color: #c62828;
  border-radius: var(--border-radius-md);
  padding: 10px 14px; font-size: .9rem;
  margin-bottom: 16px; text-align: left;
}

/* ─── Main Dashboard ─────────────────────────────────────────── */
.student-main { max-width: 768px; margin: 0 auto; padding: 16px; }

/* ─── Semester Banner ────────────────────────────────────────── */
.semester-banner {
  background: linear-gradient(135deg, var(--pink-50), var(--blue-50));
  border: 1.5px solid var(--pink-100);
  border-radius: var(--border-radius-md);
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  font-size: .9rem;
}
.semester-banner strong { color: var(--primary); }
.eval-status-open  { color: #2e7d32; font-weight: 700; }
.eval-status-close { color: #b71c1c; font-weight: 700; }

@keyframes waveBg {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ─── Add Eval Button ────────────────────────────────────────── */
.btn-add-eval {
  width: 100%;
  background: linear-gradient(135deg, var(--pink-600), var(--blue-600), var(--pink-500), var(--blue-500));
  background-size: 300% 300%;
  animation: waveBg 6s ease infinite;
  color: white;
  border: none;
  border-radius: var(--border-radius-lg);
  padding: 18px;
  font-family: 'Sarabun', sans-serif;
  font-size: 1.1rem; font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 20px;
}
.btn-add-eval:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.btn-add-eval:disabled {
  background: #bdbdbd;
  cursor: not-allowed; transform: none; box-shadow: none;
}

/* ─── History List ───────────────────────────────────────────── */
.history-section { margin-top: 8px; }
.history-semester-group { margin-bottom: 24px; }
.history-semester-label {
  font-size: .85rem; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.history-semester-label::after { content: ''; flex: 1; height: 1px; background: #e0e0e0; }

.history-item {
  background: white;
  border-radius: var(--border-radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  border-left: 4px solid var(--pink-300, #f48fb1);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  transition: var(--transition);
}
.history-item:hover { box-shadow: var(--shadow-md); transform: translateX(3px); }
.history-item-info { flex: 1; min-width: 0; }
.history-item-teacher { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-subject { font-size: .85rem; color: var(--text-secondary); margin-top: 2px; }
.history-item-meta   { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.history-item-actions { flex-shrink: 0; }
.btn-edit-eval {
  background: var(--blue-50);
  color: var(--blue-700);
  border: 1.5px solid var(--blue-200);
  border-radius: var(--border-radius-sm);
  padding: 4px 10px;
  font-family: 'Sarabun', sans-serif;
  font-size: .75rem; font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-edit-eval:hover { background: var(--blue-100); }

/* ─── Evaluation Flow Modal ──────────────────────────────────── */
.eval-flow-modal .sk-modal {
  max-width: 580px;
  max-height: 100%;
  overflow-y: auto;
  padding: 28px 24px;
}

/* ─── Step Indicator ─────────────────────────────────────────── */
.step-indicator {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 24px;
}
.step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #9e9e9e;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700;
  position: relative; z-index: 1;
  transition: var(--transition);
  flex-shrink: 0;
}
.step-dot.active { background: var(--primary); color: white; box-shadow: 0 0 0 4px var(--pink-100); }
.step-dot.done   { background: #2e7d32; color: white; }
.step-line { flex: 1; height: 2px; background: #e0e0e0; }
.step-line.done { background: #2e7d32; }

/* ─── Evaluation Form ────────────────────────────────────────── */
.eval-form-header {
  background: linear-gradient(135deg, var(--pink-50), var(--blue-50));
  border-radius: var(--border-radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  border-left: 4px solid var(--primary);
  font-size: .9rem; line-height: 1.8;
  text-align: center;
}

/* ─── Rating Section ─────────────────────────────────────────── */
.rating-section {
  border: 1.5px solid var(--pink-100);
  border-radius: var(--border-radius-md);
  padding: 16px;
  margin-bottom: 16px;
  background: white;
}
.rating-section-title {
  font-size: .88rem; font-weight: 700;
  color: var(--primary);
  background: var(--pink-50);
  border-radius: var(--border-radius-sm);
  padding: 6px 12px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}

.rating-item {
  display: flex; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  gap: 10px;
}
.rating-item:last-child { border-bottom: none; padding-bottom: 0; }

.rating-question {
  flex: 1;
  font-size: .88rem;
  color: var(--text-primary);
  line-height: 1.5;
  min-width: 0;
}

.rating-buttons {
  display: flex; gap: 4px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.rating-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: #f5f5f5;
  font-size: .78rem; font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Sarabun', sans-serif;
  flex-shrink: 0;
}
.rating-btn:hover { transform: scale(1.1); }

.rating-btn[data-val="5"]:hover,
.rating-btn[data-val="5"].selected  { background: var(--score-5); color: white; border-color: var(--score-5); }
.rating-btn[data-val="4"]:hover,
.rating-btn[data-val="4"].selected  { background: var(--score-4); color: white; border-color: var(--score-4); }
.rating-btn[data-val="3"]:hover,
.rating-btn[data-val="3"].selected  { background: var(--score-3); color: white; border-color: var(--score-3); }
.rating-btn[data-val="2"]:hover,
.rating-btn[data-val="2"].selected  { background: var(--score-2); color: white; border-color: var(--score-2); }
.rating-btn[data-val="1"]:hover,
.rating-btn[data-val="1"].selected  { background: var(--score-1); color: white; border-color: var(--score-1); }
.rating-btn[data-val="na"]:hover,
.rating-btn[data-val="na"].selected { background: var(--score-na); color: white; border-color: var(--score-na); }

/* Score legend */
.score-legend {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-size: .78rem; margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--blue-50); border-radius: var(--border-radius-sm);
}
.score-legend-item { display: flex; align-items: center; gap: 4px; }
.score-dot {
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700; color: white;
}

/* ─── Open Questions ─────────────────────────────────────────── */
.open-section { margin-top: 16px; }
.open-item { margin-bottom: 14px; }
.open-label { font-size: .88rem; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }

/* ─── Thank you screen ───────────────────────────────────────── */
.thankyou-screen {
  text-align: center; padding: 32px 16px;
  animation: fadeIn .5s ease;
}
.thankyou-icon { font-size: 4rem; display: block; margin-bottom: 12px; }
.thankyou-title { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.thankyou-msg { color: var(--text-secondary); margin-bottom: 20px; font-size: .95rem; }

/* ─── Mobile-specific ────────────────────────────────────────── */
@media (max-width: 576px) {
  .student-main { padding: 12px; }
  .rating-item { flex-direction: column; align-items: flex-start; }
  .rating-buttons { margin-top: 8px; width: 100%; justify-content: flex-start; }
  .rating-btn { width: 40px; height: 40px; font-size: .85rem; }
  .eval-flow-modal .sk-modal { padding: 20px 16px; border-radius: var(--border-radius-lg); }
  .login-card { padding: 32px 20px; }
  .btn-add-eval { padding: 16px; font-size: 1rem; }
  .mobile-break { display: none; }
}

@media (max-width: 480px) {
  .mobile-break { display: block; }
}

/* ─── Grade Selection Grid ───────────────────────────────────── */
.grade-selection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 280px;
  margin: 0 auto;
}

.grade-radio-btn {
  display: block;
  cursor: pointer;
}
.grade-radio-btn input[type="radio"] {
  display: none;
}
.grade-radio-btn span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background-color: var(--white);
  border: 2px solid var(--pink-100);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.grade-radio-btn:hover span {
  border-color: var(--pink-300);
  background-color: var(--pink-50);
}
.grade-radio-btn input[type="radio"]:checked + span {
  border-color: var(--primary);
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 8px rgba(225, 41, 104, 0.2);
  transform: translateY(-2px);
}

@media (min-width: 577px) {
  .rating-btn { width: 38px; height: 38px; }
}

/* ─── Privacy Modal ──────────────────────────────────────────── */
.privacy-modal-box {
  width: 95vw !important;
  max-width: 800px !important;
  max-height: 100% !important;
  display: flex;
  flex-direction: column;
}
.privacy-modal-box .sk-modal-body {
  flex: 1;
}
#privacy-text {
  font-size: .8rem;
  line-height: 1.8;
  color: var(--text-secondary);
}
#privacy-text strong {
  font-size: 1.05rem;
  color: var(--text-primary);
}

/* ─── Support Chat Modal ─────────────────────────────────────── */
.sk-support-modal {
  width: 95vw !important;
  max-width: 450px !important;
  height: 85dvh !important; /* dVH adapts to mobile keyboard */
  max-height: 600px !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important; /* Override default sk-modal padding */
  overflow: hidden;
}
.sk-support-modal .sk-modal-title {
  padding: 16px;
  background: linear-gradient(135deg, var(--pink-50), var(--blue-50));
  border-bottom: 1px solid var(--pink-100);
  margin-bottom: 0;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}
.support-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.support-chat-footer {
  padding: 12px;
  background: white;
  border-top: 1px solid #e0e0e0;
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}
.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.chat-bubble.student {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-bubble.admin {
  align-self: flex-start;
  background: white;
  border: 1px solid #e0e0e0;
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.chat-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  align-self: flex-end;
}
.chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
}
.chat-bubble-wrapper.student {
  align-items: flex-end;
}
.chat-bubble-wrapper.admin {
  align-items: flex-start;
}

@keyframes pulseRed {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.badge-pulse {
  animation: pulseRed 1.5s infinite;
}
