*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple: #6f2da8;
  --purple-dark: #54207f;
  --purple-light: #8f4fd0;
  --brand-warm: #d97706;
  --purple-pale: #ede9f8;
  --purple-soft: rgba(124, 34, 212, 0.08);
  --text-dark: #1a1a2e;
  --text-muted: #6b6b7b;
  --white: #ffffff;
  --bg: #fbfaf7;
  --card-bg: rgba(255,255,255,0.96);
  --radius: 18px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
  --destructive: #dc2626;
  --border: #d8dde8;
  --border-strong: #aeb6c2;
  --transition-fast: 100ms ease;
  --transition-base: 180ms ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(111, 45, 168, 0.1), transparent 24rem),
    radial-gradient(circle at top right, rgba(217, 119, 6, 0.12), transparent 18rem),
    linear-gradient(180deg, #fffdfa 0%, var(--bg) 28%, #f4f6fb 100%);
  color: var(--text-dark);
  overflow-x: hidden;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: rgba(255,255,255,0.88);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  text-decoration: none;
}

.nav-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(111, 45, 168, 0.16);
}

.nav-actions { display: flex; align-items: center; gap: 12px; }

.btn-ghost {
  background: rgba(255,255,255,0.76);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
  padding: 10px 20px;
  border-radius: 999px;
  transition: background var(--transition-base), transform var(--transition-fast), border-color var(--transition-base), box-shadow var(--transition-base);
  text-decoration: none;
}
.btn-ghost:hover {
  background: #fff;
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 999px;
  text-decoration: none;
  transition: filter var(--transition-base), transform var(--transition-fast), box-shadow var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(111, 45, 168, 0.16);
}
.btn-primary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 48px 20px;
  display: flex;
  justify-content: center;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 760px;
  overflow: hidden;
  animation: fadeUp 0.5s ease both;
}

.card-header {
  padding: 32px 32px 0;
  text-align: center;
}

.card-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
  letter-spacing: 0;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.card-content { padding: 28px 32px 32px; }

.register-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.form-group:last-of-type { margin-bottom: 0; }

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
}

.input {
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.input::placeholder { color: #b0b0be; }

.input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(124,34,212,0.1);
  outline: none;
}

.input.error {
  border-color: var(--destructive);
}

.input.error:focus {
  box-shadow: 0 0 0 4px rgba(220,38,38,0.1);
}

.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-right: 44px;
}

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toggle-pw svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.error-msg {
  font-size: 0.82rem;
  color: var(--destructive);
  display: none;
}
.error-msg.show { display: block; }

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.checkbox-wrap {
  padding-top: 2px;
}

.checkbox-label {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
}

.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px;
  border-radius: 12px;
  margin-top: 8px;
  transition: filter var(--transition-base), transform var(--transition-fast), box-shadow var(--transition-base);
  box-shadow: 0 8px 24px rgba(111, 45, 168, 0.16);
}
.btn-submit:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}
.btn-submit:active { transform: translateY(0); }

.login-link {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 20px;
}
.login-link a {
  color: var(--purple);
  text-decoration: none;
  font-weight: 600;
}
.login-link a:hover { text-decoration: underline; }

.role-tab {
  min-width: 180px;
}

.register-form .form-group:nth-last-child(2),
.register-form .form-group:last-of-type,
.register-form .btn-submit,
.register-form .login-link {
  grid-column: 1 / -1;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  .card {
    max-width: 560px;
  }

  .register-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  nav { padding: 16px 20px; }
  main { padding: 32px 16px; }
  .card-header { padding: 24px 24px 0; }
  .card-content { padding: 24px; }
  .card-title { font-size: 1.7rem; }
}

@media (max-width: 480px) {
  nav {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .role-tab {
    width: 100%;
    min-width: 0;
  }
}

.modal-header, .modal-footer { border: none; }
.modal-title { color: var(--purple); font-weight: 700; }
.modal-body h6 { color: var(--purple); font-weight: 600; margin-top: 1rem; margin-bottom: 0.5rem; }
.modal-body p { margin-bottom: 1rem; line-height: 1.5; }
.btn-secondary { background: var(--purple); border: none; }
.btn-secondary:hover { background: var(--purple-light); }
.btn-close { filter: invert(27%) sepia(90%) saturate(6346%) hue-rotate(268deg) brightness(97%) contrast(97%); }
