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

:root {
  --bg-page: #0b0e14;
  --bg-card: #161b24;
  --bg-input: #1c2230;
  --bg-input-hover: #202736;
  --border: #2a3347;
  --border-focus: #4a6fa5;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-placeholder: #4d5566;
  --accent-green: #28a745;
  --accent-green-hover: #22913c;
  --accent-blue: #58a6ff;
  --error: #f85149;
  --radius: 8px;
  --transition: 0.2s ease;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Site Header ─────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 24px;
  background: rgba(11, 14, 20, 0.85);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.site-logo {
  height: 32px;
  width: auto;
}

/* ── Main area (background image + card) ─────────────────── */
.site-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  position: relative;
  background:
    linear-gradient(to bottom, rgba(11,14,20,0.45) 0%, rgba(11,14,20,0.55) 100%),
    url('https://affiliate.thevault.ag/assets/img/affiliate-login-bg.jpg') center center / cover no-repeat;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 28px 32px 32px;
  width: 100%;
  max-width: 700px;
  position: relative;
  z-index: 1;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Back button */
.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  margin-bottom: 16px;
  transition: background var(--transition), border-color var(--transition);
}
.back-btn:hover {
  background: var(--bg-input-hover);
  border-color: var(--border-focus);
}

/* Title */
.title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
}

/* ── Form grid ───────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin-bottom: 20px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Inputs ──────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 13px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

input::placeholder {
  color: var(--text-placeholder);
}

input:hover {
  border-color: #3d4d63;
}

input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-hover);
}

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

/* Password wrapper */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  padding-right: 40px;
}

.eye-btn {
  position: absolute;
  right: 11px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  padding: 0;
  transition: color var(--transition);
}

.eye-btn:hover { color: var(--text-primary); }
.eye-icon.hidden { display: none; }

/* ── Selects ─────────────────────────────────────────────── */
.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 34px 10px 13px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

select:hover { border-color: #3d4d63; }
select:focus { border-color: var(--border-focus); background: var(--bg-input-hover); }
select option { background: #1c2230; color: var(--text-primary); }

.select-arrow {
  position: absolute;
  right: 10px;
  pointer-events: none;
  color: var(--text-secondary);
}

/* ── Phone ───────────────────────────────────────────────── */
.phone-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  transition: border-color var(--transition);
}

.phone-wrapper:focus-within {
  border-color: var(--border-focus);
  background: var(--bg-input-hover);
}

.phone-flag-select {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 9px;
  cursor: pointer;
  border-right: 1px solid var(--border);
  height: 40px;
  min-width: 62px;
  position: relative;
  user-select: none;
  flex-shrink: 0;
}

.phone-flag-select:hover { background: var(--bg-input-hover); }

.flag-emoji { font-size: 17px; line-height: 1; }

.phone-dial-code {
  padding: 0 6px 0 4px;
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

.phone-wrapper input[type="tel"] {
  border: none;
  background: transparent;
  flex: 1;
  padding: 10px 10px 10px 2px;
  min-width: 0;
}

.phone-wrapper input[type="tel"]:focus {
  border: none;
  background: transparent;
}

/* Flag dropdown */
.flag-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #1e2636;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 220px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.flag-dropdown.open { display: block; }

.flag-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background var(--transition);
}

.flag-option:hover { background: var(--bg-input-hover); }
.flag-option .opt-flag { font-size: 17px; line-height: 1; flex-shrink: 0; }
.flag-option .opt-name { flex: 1; }
.flag-option .opt-code { color: var(--text-secondary); font-size: 12px; }

.flag-dropdown::-webkit-scrollbar { width: 5px; }
.flag-dropdown::-webkit-scrollbar-track { background: transparent; }
.flag-dropdown::-webkit-scrollbar-thumb { background: #3d4d63; border-radius: 3px; }

/* ── Field errors ────────────────────────────────────────── */
.field-error {
  font-size: 11px;
  color: var(--error);
  min-height: 14px;
  display: block;
}

/* ── Terms ───────────────────────────────────────────────── */
.terms-row {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] { display: none; }

.custom-checkbox {
  width: 19px;
  height: 19px;
  border-radius: 4px;
  border: 2px solid var(--border-focus);
  background: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .custom-checkbox {
  background: var(--border-focus);
}

.checkbox-label input[type="checkbox"]:checked + .custom-checkbox::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

.terms-text { font-size: 13px; color: var(--text-secondary); }
.terms-link { color: var(--accent-blue); text-decoration: none; }
.terms-link:hover { text-decoration: underline; }

/* ── Register button ─────────────────────────────────────── */
.register-btn {
  display: block;
  width: 55%;
  margin: 0 auto 14px;
  padding: 13px;
  background: var(--accent-green);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s;
}

.register-btn:hover:not(:disabled) { background: var(--accent-green-hover); }
.register-btn:active:not(:disabled) { transform: scale(0.98); }
.register-btn:disabled { opacity: 0.65; cursor: not-allowed; }

/* ── Form message ────────────────────────────────────────── */
.form-message {
  text-align: center;
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
}
.form-message.success { color: var(--accent-green); }
.form-message.error   { color: var(--error); }

/* ── Login link ──────────────────────────────────────────── */
.login-link {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.login-link a { color: var(--accent-blue); text-decoration: none; }
.login-link a:hover { text-decoration: underline; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  background: #0b0f18;
  padding: 32px 60px 28px;
  flex-shrink: 0;
}

/* Row 1: logo + badges */
.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.footer-logo {
  height: 36px;
  width: auto;
}

.footer-badges {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-badge {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity var(--transition);
}

.footer-badge:hover { opacity: 0.8; }

.footer-badge img {
  height: 42px;
  width: auto;
}

/* Dividers */
.footer-hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 0 0 28px;
}

/* Nav columns */
.footer-nav {
  display: flex;
  gap: 0;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 120px;
}

.footer-col-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.footer-col a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-col a:hover { color: var(--text-primary); }

/* Company description */
.footer-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: center;
  margin-bottom: 28px;
}

/* Bottom bar: copyright + social */
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

.footer-copy {
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 18px;
}

.footer-social a {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.footer-social a:hover { color: var(--text-primary); }

/* ── Success Modal ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.modal-id-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-id-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.modal-id-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent-green);
}

.modal-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
  opacity: 0.8;
}

.modal-btn {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--accent-green);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition);
}

.modal-btn:hover { background: var(--accent-green-hover); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .card {
    padding: 22px 18px 26px;
  }

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

  .register-btn {
    width: 100%;
  }

  .site-footer {
    padding: 24px 20px 20px;
  }

  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-nav {
    gap: 20px;
  }

  .footer-col {
    min-width: 100px;
  }

  .footer-desc {
    text-align: left;
  }

  .register-btn {
    width: 100%;
  }
}
