/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* ── Header ──────────────────────────────────────────────── */
header {
  text-align: center;
  margin-bottom: 2rem;
}

/* ── Fixed top-right action bar ─────────────────────────── */
.top-actions {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 50;
}

#logged-out-actions,
#logged-in-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#logged-out-actions[hidden],
#logged-in-actions[hidden] { display: none; }

.btn-login,
.btn-new-user,
.btn-logout {
  white-space: nowrap;
  padding: 0.42rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: background 0.2s;
}

.btn-new-user {
  background: #2b6cb0;
  color: #fff;
}
.btn-new-user:hover { background: #2c5282; }

.btn-login {
  background: #fff;
  color: #2b6cb0;
  border: 1.5px solid #2b6cb0;
}
.btn-login:hover { background: #ebf4ff; }

.btn-logout {
  background: #fff5f5;
  color: #c53030;
  border: 1.5px solid #fc8181;
}
.btn-logout:hover { background: #fed7d7; }

.user-email-label {
  font-size: 0.78rem;
  color: #4a5568;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Modal overlay ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: #fff;
  border-radius: 14px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  position: relative;
}

.modal h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2b6cb0;
  margin-bottom: 1.5rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #718096;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}
.modal-close:hover { background: #edf2f7; color: #1a202c; }

/* ── Modal form fields ────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid #cbd5e0;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
input[type="email"]:focus,
input[type="password"]:focus {
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49,130,206,0.2);
}

.field-error {
  color: #c53030;
  font-size: 0.8rem;
  margin: 0;
}

/* ── Password rule checklist ──────────────────────────────── */
.pwd-privacy-note {
  font-size: 0.76rem;
  color: #2c7a7b;
  background: #e6fffa;
  border: 1px solid #81e6d9;
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  margin-top: 0.1rem;
}

.pwd-rules {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.3rem;
}

.rule {
  font-size: 0.78rem;
  color: #718096;
  padding-left: 1.2rem;
  position: relative;
}
.rule::before { content: '○'; position: absolute; left: 0; }
.rule-pass { color: #276749; }
.rule-pass::before { content: '✓'; }
.rule-fail { color: #c53030; }
.rule-fail::before { content: '✗'; }

/* ── Success message ──────────────────────────────────────── */
.success-msg {
  color: #276749;
  font-size: 0.875rem;
  background: #f0fff4;
  border: 1px solid #9ae6b4;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

/* ── Register button inside modal ─────────────────────────── */
#nu-submit-btn {
  width: 100%;
  background: #2b6cb0;
  color: #fff;
  margin-top: 0.25rem;
}
#nu-submit-btn:hover:not(:disabled) { background: #2c5282; }

/* ── Layout ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 480px;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #2b6cb0;
  letter-spacing: -0.5px;
}

.subtitle {
  margin-top: 0.5rem;
  color: #718096;
  font-size: 0.95rem;
}

/* ── Form ─────────────────────────────────────────────────── */
#lookup-form {
  background: #ffffff;
  border-radius: 16px;
  padding: 2.25rem 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.09);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4a5568;
}

/* ── Icon-wrapped input ───────────────────────────────────── */
.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  width: 1.1rem;
  height: 1.1rem;
  color: #a0aec0;
  pointer-events: none;
  flex-shrink: 0;
}

.input-icon-wrap input[type="number"] {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.6rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1.05rem;
  background: #f7fafc;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}
.input-icon-wrap input[type="number"]::-webkit-inner-spin-button,
.input-icon-wrap input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

.input-icon-wrap input[type="number"]:focus {
  border-color: #3182ce;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.18);
}

input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  outline: none;
}

input[type="text"]:focus {
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

/* ── Buttons ──────────────────────────────────────────────── */
button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

button:disabled { opacity: 0.6; cursor: not-allowed; }

#submit-btn {
  background: #2b6cb0;
  color: #ffffff;
  margin-top: 0.25rem;
}

#submit-btn:hover:not(:disabled) { background: #2c5282; }

button.secondary {
  background: #edf2f7;
  color: #4a5568;
  width: 100%;
  margin-top: 1.25rem;
}

button.secondary:hover { background: #e2e8f0; }

/* ── Error message ────────────────────────────────────────── */
.error {
  color: #c53030;
  font-size: 0.875rem;
  background: #fff5f5;
  border: 1px solid #feb2b2;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}

/* ── Result card ──────────────────────────────────────────── */
.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #276749;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #c6f6d5;
}

dl { display: grid; row-gap: 1rem; }

dt {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #718096;
}

dd {
  font-size: 1rem;
  color: #1a202c;
  margin-top: 0.2rem;
  word-break: break-word;
}

/* ── Profile card ──────────────────────────────────────── */
.profile-card {
  margin-top: 1.5rem;
}

.profile-card h2 {
  color: #2b6cb0;
  border-bottom: 2px solid #bee3f8;
}

input[type="tel"],
textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid #cbd5e0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}

input[type="tel"]:focus,
textarea:focus {
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49,130,206,0.2);
}

.readonly-field {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #f7fafc;
  color: #718096;
  cursor: default;
  outline: none;
}

#pf-submit-btn {
  width: 100%;
  background: #2b6cb0;
  color: #fff;
  margin-top: 0.25rem;
}
#pf-submit-btn:hover:not(:disabled) { background: #2c5282; }

/* Submit buttons in login modal */
#li-submit-btn {
  width: 100%;
  background: #2b6cb0;
  color: #fff;
  margin-top: 0.25rem;
}
#li-submit-btn:hover:not(:disabled) { background: #2c5282; }
