/* ===== Synergy X-Change — Shared Styles (PSU Navy & Gold) ===== */

:root {
  --primary: #0b3d91;
  --primary-dark: #062a66;
  --primary-light: #1e56b0;
  --gold: #f4b400;
  --gold-dark: #d69e00;
  --bg: #f3f5f9;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --success-bg: #ecfdf3;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(11, 61, 145, 0.08);
  --shadow-lg: 0 12px 32px rgba(11, 61, 145, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Sarabun', 'Noto Sans Thai', 'Tahoma', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.topbar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 28px 20px 90px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.topbar .eyebrow {
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 13px;
  text-transform: uppercase;
  margin: 0 0 10px 0;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 700;
}

.topbar h2 {
  margin: 10px 0 0 0;
  font-weight: 400;
  font-size: clamp(14px, 2.2vw, 18px);
  color: #dbe4f7;
}

.topbar .meta {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.meta-chip {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.container {
  max-width: 720px;
  margin: -60px auto 40px auto;
  padding: 0 20px;
  position: relative;
  z-index: 2;
}

.container.wide {
  max-width: 1100px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

@media (max-width: 600px) {
  .card { padding: 22px; }
}

.card h3 {
  margin-top: 0;
  font-size: 18px;
  color: var(--primary-dark);
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
}

.field label .req {
  color: var(--danger);
}

.field input[type="text"],
.field input[type="email"],
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(11,61,145,0.12);
}

.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-option {
  flex: 1;
  min-width: 140px;
  position: relative;
  display: flex;
}

.radio-option input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.radio-option .box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  background: #fff;
  transition: all .15s;
}

.radio-option input:checked + .box {
  border-color: var(--primary);
  background: #eef3fc;
  color: var(--primary-dark);
}

.radio-option .box .icon {
  font-size: 20px;
  line-height: 1;
}

.radio-option .box .box-title {
  font-size: 15px;
}

.radio-option .box .box-sub {
  font-weight: 400;
  font-size: 12px;
  color: inherit;
  opacity: .8;
}

.radio-option .box .box-seats {
  font-weight: 600;
  font-size: 11px;
  color: var(--primary);
  margin-top: 2px;
}

.radio-option.is-full .box {
  background: #f9fafb;
  color: var(--text-muted);
  border-style: dashed;
}

.radio-option.is-full .box .box-seats {
  color: var(--danger);
}

.radio-option.is-full input {
  cursor: not-allowed;
}

.submit-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.submit-btn:hover { box-shadow: 0 6px 18px rgba(11,61,145,0.3); }
.submit-btn:active { transform: translateY(1px); }
.submit-btn:disabled { opacity: .6; cursor: not-allowed; }

.spinner {
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}

.submit-btn.loading .spinner { display: inline-block; }
.submit-btn.loading .btn-text { opacity: .8; }

@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 18px;
  display: none;
}

.ep-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: all .15s;
}

.ep-picker-item:hover {
  border-color: var(--primary-light);
  background: #eef3fc;
}

.ep-picker-item strong {
  color: var(--primary);
}

.alert.show { display: block; }
.alert.success { background: var(--success-bg); color: #166534; border: 1px solid #bbf7d0; }
.alert.error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }

.success-screen {
  text-align: center;
  padding: 20px 0;
}

.success-screen .check {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px auto;
}

.footer-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 24px;
}

.site-footer {
  text-align: center;
  padding: 8px 20px 40px 20px;
  color: var(--text-muted);
}

.site-footer .org-name {
  margin: 0 0 8px 0;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary-dark);
}

.site-footer .social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

.site-footer .social-link:hover {
  text-decoration: underline;
}

/* ===== Dashboard ===== */

.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dash-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  border-left: 5px solid var(--primary);
}

.dash-card.gold { border-left-color: var(--gold); }
.dash-card.onsite { border-left-color: var(--primary); }
.dash-card.online { border-left-color: #0891b2; }

.dash-card .label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.dash-card .value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary-dark);
}

.dash-card .sublabel {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dash-card .sublabel.full {
  color: var(--danger);
  font-weight: 600;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.chart-card h3 {
  margin-top: 0;
  font-size: 15px;
  color: var(--primary-dark);
}

.chart-wrap { position: relative; }

table.reg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.reg-table th, table.reg-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

table.reg-table th {
  color: var(--text-muted);
  font-weight: 700;
  background: #f9fafb;
  position: sticky;
  top: 0;
}

.mode-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.mode-pill.onsite { background: #eef3fc; color: var(--primary-dark); }
.mode-pill.online { background: #e0f7fa; color: #0e7490; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar input[type="search"] {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  min-width: 220px;
}

.ep-selector {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  color: var(--primary-dark);
  background: #fff;
  min-width: 220px;
}

.refresh-btn {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.refresh-btn:hover { border-color: var(--primary-light); }
.refresh-btn.spinning svg { animation: spin 0.8s linear infinite; }

.table-wrap {
  max-height: 480px;
  overflow-y: auto;
  border-radius: var(--radius);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}

.last-updated {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 8px;
}

/* ===== Admin ===== */

.ep-admin-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
  border-left: 5px solid var(--border);
}

.ep-admin-card.is-open { border-left-color: var(--success); }
.ep-admin-card.is-closed { border-left-color: var(--danger); }

.ep-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ep-admin-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 4px 0;
}

.ep-admin-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.ep-admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.open { background: var(--success-bg); color: #166534; }
.status-pill.closed { background: var(--danger-bg); color: #991b1b; }
.status-pill.format { background: #eef3fc; color: var(--primary-dark); }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: .15s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .15s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.ep-admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.ep-admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  background: #f9fafb;
  border-radius: 10px;
}

.ep-admin-stats .stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-dark);
}

.ep-admin-stats .stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.ep-admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.link-copy-btn {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
}

.link-copy-btn:hover { border-color: var(--primary-light); background: #eef3fc; }

.ep-edit-toggle {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

.ep-edit-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: none;
}

.ep-edit-form.show { display: block; }

.ep-edit-form .field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.dept-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dept-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eef3fc;
  color: var(--primary-dark);
  padding: 6px 10px 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.dept-chip button {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px;
}

.dept-chip button:hover { opacity: .7; }
