/* =============== THEME =============== */
:root {
  --bg: #003c8a; /* brand base */
  --bg-2: #0a1a37; /* deep shade */
  --surface: #fdfdff; /* card surface (lighter) */
  --surface-2: #f5f8ff; /* alternate light */
  --line: rgba(0, 60, 138, 0.12);

  --muted: #5c6b89; /* body text secondary */
  --text: #0c1222; /* dark text for contrast */

  --brand: #003c8a; /* primary */
  --brand-2: #2aa7ff; /* bright highlight */
  --accent: #22d3ee; /* aqua */

  --shadow: 0 14px 40px rgba(0, 24, 69, 0.25);
  --shadow-2: 0 22px 70px rgba(0, 24, 69, 0.3);
  --radius: 16px;

  --danger: #b42318;
  --input-bd: rgba(0, 60, 138, 0.25);
  --input-bd-focus: #93c5fd;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, sans-serif;
  background: radial-gradient(
      1000px 600px at -10% -10%,
      rgba(0, 60, 138, 0.15),
      transparent 70%
    ),
    radial-gradient(
      900px 500px at 110% 20%,
      rgba(42, 167, 255, 0.12),
      transparent 70%
    ),
    radial-gradient(
      800px 400px at 50% 120%,
      rgba(0, 60, 138, 0.1),
      transparent 70%
    ),
    linear-gradient(180deg, #ffffff, #f8fbff 70%, #ffffff);
}

/* =============== NAVBAR (primary brand color) =============== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--brand);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.navcontainer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  width: min(1200px, 92vw);
  margin-inline: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.navlogo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.brand-text {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.navtoggle {
  display: none;
  background: none;
  border: 0;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}
.navul {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}
.navul.is-open {
  display: flex;
}
.navlink {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  opacity: 0.95;
  transition: background 0.2s ease;
}
.navlink:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #dbeafe;
}
.navlogin {
  display: inline-block;
  text-decoration: none;
  color: var(--brand);
  font-weight: 700;
  background: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.navlogin:hover {
  filter: brightness(0.96);
}

/* mobile nav */
@media (max-width: 900px) {
  .navtoggle {
    display: block;
  }
  .navul {
    position: absolute;
    top: 64px;
    right: 4vw;
    left: 4vw;
    background: linear-gradient(180deg, #003c8a, #08346f);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    padding: 10px;
    display: none;
    flex-direction: column;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  }
  .navul.is-open {
    display: flex;
  }
  .navlink {
    color: #fff;
  }
}

/* =============== LOGIN LAYOUT =============== */
.login-outer {
  min-height: calc(100dvh - 64px - 48px);
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 48px) 16px;
}
.login-card {
  width: min(480px, 96vw);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.login-logo {
  width: 200px;
  margin: 0 auto 20px;
}
.login-logo img {
  width: 100%;
  display: block;
}

.login-form {
  display: grid;
  gap: 18px;
}
.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--brand);
  font-size: 0.95rem;
}
.input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--input-bd);
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
}
.input:focus {
  outline: 2px solid rgba(42, 167, 255, 0.45);
  outline-offset: 1px;
}

/* buttons & links */
.w-100 {
  width: 100%;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: 0;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 12px 16px;
  border-radius: 12px;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 28px rgba(0, 60, 138, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
}
.subrow {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}
.link {
  color: var(--brand);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}
.link:hover {
  text-decoration: underline;
}

/* footer */
.copyright {
  text-align: center;
  color: var(--muted);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: 16px;
  padding: 12px 8px;
}
.h2head {
  margin: 0 0 16px;
  text-align: center;
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--brand);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* =============== MODAL (Sign Up) =============== */
.wm-modal-open {
  overflow: hidden;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(9, 16, 31, 0.55);
  backdrop-filter: blur(3px) saturate(1.02);
  -webkit-backdrop-filter: blur(3px) saturate(1.02);
  z-index: 1100;
  animation: fadeIn 0.18s ease-out;
}
.modal-backdrop.show {
  display: flex;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes pop {
  from {
    transform: translateY(6px) scale(0.985);
    opacity: 0.98;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-card {
  width: min(640px, 94vw);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  transform-origin: center;
  animation: pop 0.16s ease-out;

  /* NEW: make body scroll independently */
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

/* Header */
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(180deg, #f6f9ff, #eef4ff);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.modal-head h3 {
  margin: 0;
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--brand);
  letter-spacing: 0.2px;
}
.modal-close {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #334155;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.modal-close:hover {
  background: #f8fafc;
}

/* Body (scrolls if tall) */
.modal-body {
  padding: 18px;
  overflow: auto;
}

/* Form grid */
.modal-card .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-card .form-grid .full {
  grid-column: 1 / -1;
}
.modal-card .form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Required asterisk */
.req::after {
  content: " *";
  color: var(--danger);
  font-weight: 600;
}

/* Inputs */
.modal-card .form-field label {
  font-size: 0.9rem;
  color: #21406d;
}
.modal-card .form-field input {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #c8d5ee;
  font-family: "Inter", sans-serif;
  outline: none;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.modal-card .form-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 60, 138, 0.12);
}

/* Inline helpers / links */
.modal-card .help {
  font-size: 0.8rem;
  color: var(--muted);
}
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.checkbox-row a {
  color: var(--brand);
  text-decoration: underline;
}

/* Actions */
.modal-card .actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}
.modal-card .btn {
  border: 1px solid transparent;
}
.modal-card .btn-outline {
  border-color: #c8d5ee;
  color: var(--text);
  background: #fff;
}
.modal-card .btn-outline:hover {
  background: #f8fafc;
}
.modal-card .btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 60, 138, 0.25);
}
.modal-card .btn-primary:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

/* Error text (kept for optional use) */
.field-error {
  color: var(--danger);
  font-size: 0.8rem;
  display: none;
  margin-top: 4px;
}
.field-error.show {
  display: block;
}
.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 8px;
  display: none;
}
.error-text.show {
  display: block;
}

/* ===================== PASSWORD TOOLTIP (robust, fixed-position) ===================== */
.form-field.pass {
  position: relative;
}

/* Positioned by JS so it's never clipped by modal; defaults hidden off-screen */
.pass-tip {
  position: fixed; /* <-- not clipped by modal overflow */
  left: -9999px;
  top: -9999px; /* off-screen by default */
  width: min(360px, 94vw);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 14px 32px rgba(2, 12, 36, 0.16);
  font-size: 13px;
  line-height: 1.45;
  display: none;
  z-index: 2000; /* above modal content */
}
.pass-tip[data-show="true"] {
  display: block;
}

.pass-tip::after {
  /* right-pointing arrow by default (when tip is to the left of input) */
  content: "";
  position: absolute;
  left: 100%;
  top: 16px;
  border-width: 8px;
  border-style: solid;
  border-color: transparent transparent transparent #ffffff;
  filter: drop-shadow(1px 0 1px rgba(2, 12, 36, 0.08));
}
.pass-tip ul {
  margin: 6px 0 0 18px;
  padding: 0;
}
.pass-tip li {
  margin: 4px 0;
}

/* Invalid highlight used by JS */
.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

/* =============== TOAST (Centered popout) =============== */
.toast-wrap {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-left: 6px solid var(--brand);
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 14px 18px;
  min-width: 320px;
  max-width: 90vw;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.toast .icon {
  font-size: 1.4rem;
  color: var(--brand);
  line-height: 1;
}
.toast .body {
  display: grid;
  gap: 4px;
  text-align: center;
}
.toast .title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--brand);
}
.toast .msg {
  color: var(--muted);
  font-size: 0.93rem;
}
.toast .close {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  color: #5c6b89;
  padding: 4px;
  line-height: 1;
}

/* =============================== TERMS & PRIVACY VIEWER MODAL =============================== */
#docModal .modal-card {
  max-width: 820px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#docModal .modal-body {
  overflow-y: auto;
  padding: 20px 24px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Content typography */
.doc-content {
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  text-align: justify;
  word-break: break-word;
}
.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4 {
  color: var(--brand);
  font-weight: 600;
  margin: 1em 0 0.5em;
  line-height: 1.3;
}
.doc-content h1 {
  font-size: 1.8rem;
}
.doc-content h2 {
  font-size: 1.4rem;
}
.doc-content h3 {
  font-size: 1.2rem;
}
.doc-content p {
  margin: 0.6em 0;
  text-align: justify;
}
.doc-content ul,
.doc-content ol {
  margin: 0.6em 0 0.6em 1.4em;
  padding-left: 0;
}
.doc-content li {
  margin-bottom: 0.4em;
}
.doc-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 0.95em;
}
.doc-content th,
.doc-content td {
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  text-align: left;
}
.doc-content th {
  background: #f3f4f6;
  font-weight: 600;
}
.doc-content a {
  color: var(--brand-2);
  text-decoration: underline;
  transition: color 0.2s;
}
.doc-content a:hover {
  color: var(--brand);
}

/* Scrollbar */
#docModal .modal-body::-webkit-scrollbar {
  width: 8px;
}
#docModal .modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
#docModal .modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* =================== RESPONSIVE =================== */
@media (max-width: 600px) {
  .modal-card {
    width: 95%;
  }
  #docModal .modal-card {
    width: 95%;
    max-height: 85vh;
  }
  .doc-content {
    font-size: 14px;
  }
}
@media (max-width: 520px) {
  .toast {
    min-width: 260px;
  }
  .toast-wrap {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    top: 14px;
  }
  .modal-card .form-grid {
    grid-template-columns: 1fr;
  }
}
