@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root {
  --pink: #e6017f;
  --plum: #84195c;
  --bright: #ff17b0;
  --bright-light: #ff7fd3;
  --bg: #fdf4f9;
  --ink: #2b1420;
  --muted: #8a6b78;
  --card-bg: #ffffff;
  --border: #f3d7e6;
  --good: #3B6D11;
  --warn: #b8860b;
  --bad: #b71c1c;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(132, 25, 92, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Kanit', sans-serif;
  min-height: 100%;
  overflow-x: hidden;
}

a { color: var(--pink); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(90deg, var(--plum), var(--bright));
  color: #fff;
  box-shadow: var(--shadow);
  position: relative;
  gap: 10px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.05rem; min-width: 0; }
.topbar .brand img { height: 30px; flex-shrink: 0; }
.topbar .brand .brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .nav { display: flex; align-items: center; }
.topbar .nav a { color: #fff; opacity: 0.9; margin-left: 16px; font-size: 0.92rem; white-space: nowrap; }
.topbar .nav a:hover { opacity: 1; text-decoration: underline; }
.nav-toggle {
  display: none;
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .topbar .brand .brand-text { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .topbar .nav {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 12px;
    background: var(--plum);
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.3);
    min-width: 190px;
    z-index: 950;
  }
  .topbar .nav.open { display: flex; }
  .topbar .nav a, .topbar .nav span { margin: 7px 0; }
  .topbar .nav a { margin-left: 0 !important; }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}

h1 { font-size: 1.5rem; font-weight: 700; color: var(--plum); margin: 0 0 6px; }
h2 { font-size: 1.15rem; font-weight: 600; color: var(--plum); margin: 0 0 10px; }
h3 { font-size: 1rem; font-weight: 600; color: var(--ink); margin: 0 0 8px; }
p.lead { color: var(--muted); margin: 0 0 18px; }

label { display: block; font-size: 0.88rem; font-weight: 500; margin: 14px 0 6px; color: var(--ink); }
input[type=text], input[type=password], input[type=tel], input[type=url], input[type=datetime-local], textarea, select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Kanit', sans-serif;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--pink); }
textarea { resize: vertical; min-height: 90px; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.error-box { background: #fdecec; border: 1px solid #f5b5b5; color: var(--bad); padding: 10px 14px; border-radius: 10px; font-size: 0.88rem; margin: 12px 0; }
.success-box { background: #eaf3de; border: 1px solid #b7d98c; color: var(--good); padding: 10px 14px; border-radius: 10px; font-size: 0.88rem; margin: 12px 0; }
.info-box { background: #fff8e1; border: 1px solid #f9d97a; color: #7a5b00; padding: 10px 14px; border-radius: 10px; font-size: 0.85rem; margin: 12px 0; }

button, .btn {
  display: inline-block;
  background: var(--pink);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 999px;
  font-family: 'Kanit', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
button:hover, .btn:hover { opacity: 0.92; text-decoration: none; }
button:active, .btn:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--pink); border: 1.5px solid var(--pink); }
.btn-outline:hover { background: #fdf0f6; color: var(--pink); }
.btn-muted { background: #f0e2ea; color: var(--plum); }
.btn-muted:hover { color: var(--plum); }
.btn-sm { padding: 7px 16px; font-size: 0.85rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.round-card { padding: 14px 4px; margin: 0; border: none; border-bottom: 1.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.round-card:last-child { border-bottom: none; }
.round-card:hover { background: #fdf7fa; }
.round-card.locked { opacity: 0.6; }
.round-card.locked:hover { background: transparent; }
.round-card-left { flex: 1; min-width: 0; }
.round-card-right { flex-shrink: 0; text-align: right; padding-right: 6px; }
.round-name { font-size: 1.3rem; font-weight: 700; color: var(--plum); }
.round-card-meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.round-status { font-size: 0.78rem; padding: 4px 10px; border-radius: 999px; font-weight: 500; }
.round-card.submitted { border-left: 4px solid var(--good); padding-left: 12px; background: #f8fcf3; }
.submitted-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #dff0c8, #c8e8a8);
  color: var(--good);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 999px;
}
.status-open { background: linear-gradient(135deg, #eaf3de, #d9f0c4); color: var(--good); }
.status-notyet { background: #fff8e1; color: var(--warn); }
.status-closed { background: #f3e3e3; color: var(--bad); }

.countdown { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--bright); font-size: clamp(1.1rem, 5vw, 2rem); line-height: 1.15; display: inline-block; white-space: nowrap; }
.countdown-notyet { font-variant-numeric: tabular-nums; font-weight: 800; color: #4a4a4a; font-size: clamp(0.85rem, 3.4vw, 1.5rem); line-height: 1.2; display: inline-block; white-space: nowrap; }
#roundsList { padding-bottom: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
#submissionsList, #summaryTable, #adminSubmissionsList { overflow-x: auto; -webkit-overflow-scrolling: touch; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--plum); font-weight: 600; background: #fdf0f6; }
tr:hover td { background: #fffafc; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; background: var(--border); color: var(--plum); }

.stars { display: inline-flex; gap: 4px; cursor: pointer; }
.stars .star { font-size: 1.6rem; color: #e0c8d2; }
.stars .star.filled { color: #f9a825; }

.modal-overlay { position: fixed; inset: 0; background: rgba(43,20,32,0.55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 26px 24px; max-width: 640px; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
.modal-box iframe, .modal-box video { width: 100%; border-radius: 10px; border: none; }

.chat-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: linear-gradient(135deg, var(--pink), var(--plum));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  box-shadow: 0 6px 18px rgba(132,25,92,0.35);
  font-family: 'Kanit', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-fab:hover { opacity: 0.95; }

@media (max-width: 480px) {
  .chat-fab { padding: 11px 16px; font-size: 0.78rem; bottom: 14px; right: 14px; max-width: calc(100vw - 28px); }
}

.chat-menu {
  position: fixed;
  bottom: 82px;
  right: 22px;
  z-index: 901;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.18s ease;
}
.chat-menu.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.chat-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(132,25,92,0.18);
  white-space: nowrap;
}
.chat-menu a:hover { text-decoration: none; background: #fdf0f6; }
.chat-overlay { position: fixed; inset: 0; z-index: 899; display: none; }
.chat-overlay.open { display: block; }

footer.mupa-footer {
  text-align: center;
  padding: 34px 18px 40px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.9;
}
footer.mupa-footer img { height: 36px; max-width: 90%; margin-bottom: 8px; opacity: 0.85; }

.loading { text-align: center; padding: 30px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--pink); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > div { flex: 1; min-width: 180px; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: #f0e2ea; color: var(--plum); }
.tabs button.active { background: var(--pink); color: #fff; }

.small-muted { color: var(--muted); font-size: 0.8rem; }

/* --- Friendlier form "field cards" with icon + live status (PDF attach, links, etc.) --- */
.field-card {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 16px 0;
  background: #fffdfe;
}
.field-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.field-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fdeaf3, #f6d7e8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.field-card-title { font-weight: 600; color: var(--plum); font-size: 1rem; }
.field-card-sub { font-size: 0.8rem; color: var(--muted); margin-top: 1px; }
.field-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  margin-top: 10px;
}
.field-status.status-yes { background: #eaf3de; color: var(--good); }
.field-status.status-no { background: #fff3d6; color: var(--warn); }
.field-card .hint { margin-top: 8px; }
.field-card input[type=text], .field-card input[type=url] { margin-top: 10px; }

/* Custom-styled file input so it matches the rest of the form, not the raw OS control */
.file-drop {
  margin-top: 10px;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: #fdf7fa;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover { border-color: var(--pink); background: #fdf0f6; }
.file-drop input[type=file] { display: none; }
.file-drop .file-drop-label { font-size: 0.88rem; color: var(--plum); font-weight: 500; }
.file-drop .file-drop-sub { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }

/* --- Youthful hero branding for student-facing pages (landing, dashboard) --- */
.hero-logo-wrap {
  text-align: center;
  padding: 28px 10px 8px;
  position: relative;
}
.hero-logo-wrap img { max-width: 260px; width: 60%; height: auto; filter: drop-shadow(0 6px 16px rgba(255,23,176,0.25)); }
.hero-tagline { color: var(--muted); font-size: 0.95rem; margin-top: 6px; }

.dept-badge-large {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 12px auto 0;
  max-width: 480px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 10px 20px;
  box-shadow: var(--shadow);
}
.dept-badge-large img { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.dept-badge-large span { font-size: 0.98rem; font-weight: 600; color: var(--plum); line-height: 1.3; }

.dept-title-block { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.dept-title-block img { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.dept-title-block h1 { font-size: 1.2rem; margin: 0; text-align: left; }
@media (max-width: 480px) {
  .dept-title-block { flex-direction: column; }
  .dept-title-block h1 { text-align: center; font-size: 1.1rem; }
}

button, .btn { transition: transform 0.12s, opacity 0.15s, box-shadow 0.12s; }
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255,23,176,0.28); }
button:active, .btn:active { transform: translateY(0) scale(0.97); box-shadow: none; }

.badge-bright { background: linear-gradient(135deg, var(--bright), var(--bright-light)); color: #fff; }

@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.deco-note {
  position: absolute;
  font-size: 1.6rem;
  opacity: 0.5;
  animation: floaty 3.5s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}
