/**
 * Varuna Sentinels BV - Registration Modal v2.0
 * Theme: #335596 (navy), #74c5b5 (teal), Poppins
 * Enhanced: animations, VS logo, responsive, dark mode
 */

/* === Animations === */
@keyframes vsRegSlideIn {
  0% { opacity: 0; transform: translateY(-40px) scale(0.92); }
  60% { opacity: 1; transform: translateY(6px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes vsRegFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes vsRegPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes vsRegHeaderGlow {
  0%, 100% { border-bottom-color: #74c5b6; }
  50% { border-bottom-color: #5fb8a8; }
}
@keyframes vsRegCheckBounce {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes vsRegConfetti1 { 0% { transform: translate(0,0) rotate(0); opacity:1; } 100% { transform: translate(-60px,-80px) rotate(200deg); opacity:0; } }
@keyframes vsRegConfetti2 { 0% { transform: translate(0,0) rotate(0); opacity:1; } 100% { transform: translate(60px,-70px) rotate(-180deg); opacity:0; } }
@keyframes vsRegConfetti3 { 0% { transform: translate(0,0) rotate(0); opacity:1; } 100% { transform: translate(-40px,-90px) rotate(150deg); opacity:0; } }
@keyframes vsRegConfetti4 { 0% { transform: translate(0,0) rotate(0); opacity:1; } 100% { transform: translate(50px,-60px) rotate(-120deg); opacity:0; } }
@keyframes vsRegShimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}

/* Overlay */
.vs-reg-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  padding: 16px;
}
.vs-reg-overlay.vs-reg-visible { opacity: 1; visibility: visible; }

/* Dialog */
.vs-reg-dialog {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 25px 80px rgba(0,0,0,0.35), 0 0 0 1px rgba(116,197,181,0.1);
  animation: vsRegSlideIn 0.5s cubic-bezier(0.25,0.46,0.45,0.94);
  font-family: "Poppins", sans-serif;
}

/* Header with logo */
.vs-reg-header {
  background: linear-gradient(135deg, #335596 0%, #2a4578 50%, #1d3461 100%);
  color: #fff;
  padding: 18px 24px;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  border-bottom: 3px solid #74c5b6;
  animation: vsRegHeaderGlow 3s ease-in-out infinite;
}
.vs-reg-header-logo {
  width: 38px; height: 38px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  animation: vsRegPulse 2.5s ease-in-out infinite;
  margin-right: 14px;
}
.vs-reg-header-text { flex: 1; min-width: 0; }
.vs-reg-header-title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.3px;
}
.vs-reg-header-sub {
  font-size: 0.78rem;
  opacity: 0.8;
  font-weight: 400;
  margin-top: 2px;
}
.vs-reg-close {
  background: rgba(255,255,255,0.12);
  border: none; color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.25s, transform 0.25s;
  flex-shrink: 0;
  margin-left: 10px;
}
.vs-reg-close:hover { background: rgba(255,255,255,0.25); transform: rotate(90deg); }

/* Body */
.vs-reg-body {
  padding: 24px 24px 20px;
}

/* Animated field entrance */
.vs-reg-field {
  margin-bottom: 16px;
  animation: vsRegFadeUp 0.4s ease both;
}
.vs-reg-field:nth-child(1) { animation-delay: 0.05s; }
.vs-reg-field:nth-child(2) { animation-delay: 0.1s; }
.vs-reg-field:nth-child(3) { animation-delay: 0.15s; }
.vs-reg-field:nth-child(4) { animation-delay: 0.2s; }
.vs-reg-field:nth-child(5) { animation-delay: 0.25s; }
.vs-reg-row { display: flex; gap: 14px; margin-bottom: 0; animation: vsRegFadeUp 0.4s ease both; }
.vs-reg-row:nth-child(2) { animation-delay: 0.1s; }
.vs-reg-row:nth-child(3) { animation-delay: 0.15s; }
.vs-reg-row:nth-child(4) { animation-delay: 0.2s; }
.vs-reg-row .vs-reg-field { flex: 1; animation: none; }

/* Labels */
.vs-reg-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #335596;
  margin-bottom: 5px;
  font-family: "Poppins", sans-serif;
}
.vs-reg-field label .vs-reg-req {
  color: #e74c3c;
  margin-left: 2px;
}

/* Inputs */
.vs-reg-field input,
.vs-reg-field select,
.vs-reg-field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #dde3ed;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: "Poppins", sans-serif;
  color: #333;
  background: #f9fafb;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
  outline: none;
}
.vs-reg-field input:focus,
.vs-reg-field select:focus,
.vs-reg-field textarea:focus {
  border-color: #74c5b5;
  box-shadow: 0 0 0 3px rgba(116,197,181,0.15);
  background: #fff;
}
.vs-reg-field input.vs-reg-error,
.vs-reg-field select.vs-reg-error {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}
.vs-reg-field textarea { resize: vertical; min-height: 70px; }
.vs-reg-field .vs-reg-err-msg {
  color: #e74c3c; font-size: 0.75rem; margin-top: 4px; display: none;
}
.vs-reg-field input.vs-reg-error ~ .vs-reg-err-msg,
.vs-reg-field select.vs-reg-error ~ .vs-reg-err-msg { display: block; }

/* Role selector pills */
.vs-reg-role-pills { display: flex; gap: 10px; }
.vs-reg-role-pill {
  flex: 1; padding: 14px 10px; text-align: center;
  border: 2px solid #dde3ed; border-radius: 12px;
  cursor: pointer; transition: all 0.3s cubic-bezier(0.25,0.46,0.45,0.94);
  background: #f9fafb; font-family: "Poppins", sans-serif;
  position: relative; overflow: hidden;
}
.vs-reg-role-pill::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(116,197,181,0.08), transparent);
  transition: left 0.5s ease;
}
.vs-reg-role-pill:hover::before { left: 100%; }
.vs-reg-role-pill:hover {
  border-color: #74c5b5;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(116,197,181,0.15);
}
.vs-reg-role-pill.active {
  border-color: #335596;
  background: linear-gradient(135deg, rgba(51,85,150,0.06), rgba(116,197,181,0.06));
  box-shadow: 0 4px 16px rgba(51,85,150,0.15);
  transform: translateY(-2px);
}
.vs-reg-role-pill i {
  display: block; font-size: 1.4rem; color: #74c5b5;
  margin-bottom: 6px; transition: transform 0.3s ease, color 0.3s ease;
}
.vs-reg-role-pill:hover i { transform: scale(1.15); }
.vs-reg-role-pill.active i { color: #335596; transform: scale(1.15); }
.vs-reg-role-pill span { font-size: 0.85rem; font-weight: 600; color: #555; transition: color 0.3s; }
.vs-reg-role-pill.active span { color: #335596; }

/* Role badge (preset) */
.vs-reg-role-badge {
  padding: 11px 16px;
  background: linear-gradient(135deg, rgba(116,197,181,0.08), rgba(51,85,150,0.05));
  border: 1.5px solid rgba(116,197,181,0.3);
  border-radius: 10px;
  font-size: 0.92rem;
  color: #335596;
  font-weight: 600;
  display: flex;
  align-items: center;
}
.vs-reg-role-badge i { color: #74c5b5; margin-right: 10px; font-size: 1.1rem; }

/* Footer / Actions */
.vs-reg-footer {
  padding: 0 24px 20px;
  display: flex;
  gap: 10px;
  animation: vsRegFadeUp 0.4s ease 0.3s both;
}
.vs-reg-submit {
  flex: 1; padding: 13px 20px;
  background: linear-gradient(135deg, #335596, #74c5b5);
  color: #fff; border: none; border-radius: 10px;
  font-size: 0.95rem; font-weight: 600;
  font-family: "Poppins", sans-serif;
  cursor: pointer; transition: all 0.3s ease;
  letter-spacing: 0.3px;
  position: relative; overflow: hidden;
}
.vs-reg-submit::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 0; height: 0; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transform: translate(-50%,-50%);
  transition: width 0.4s, height 0.4s;
}
.vs-reg-submit:hover::after { width: 300px; height: 300px; }
.vs-reg-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(51,85,150,0.35);
}
.vs-reg-submit:disabled {
  opacity: 0.6; cursor: not-allowed;
  transform: none; box-shadow: none;
}
.vs-reg-submit:disabled::after { display: none; }
.vs-reg-cancel {
  padding: 13px 20px; background: transparent;
  color: #555; border: 1.5px solid #dde3ed;
  border-radius: 10px; font-size: 0.92rem; font-weight: 500;
  font-family: "Poppins", sans-serif;
  cursor: pointer; transition: all 0.25s ease;
}
.vs-reg-cancel:hover { border-color: #335596; color: #335596; }

/* Privacy note */
.vs-reg-privacy {
  font-size: 0.72rem; color: #888; text-align: center;
  padding: 0 24px 16px; line-height: 1.5;
  animation: vsRegFadeUp 0.4s ease 0.35s both;
}
.vs-reg-privacy a { color: #74c5b5; text-decoration: none; }
.vs-reg-privacy a:hover { text-decoration: underline; }

/* ===== Success State ===== */
.vs-reg-success {
  text-align: center;
  padding: 36px 28px 40px;
  animation: vsRegFadeUp 0.5s ease both;
}
.vs-reg-success-anim {
  position: relative;
  width: 90px; height: 90px;
  margin: 0 auto 22px;
}
.vs-reg-success-icon {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #335596, #74c5b5);
  color: #fff; font-size: 2.2rem;
  display: flex; align-items: center; justify-content: center;
  animation: vsRegCheckBounce 0.6s cubic-bezier(0.68,-0.55,0.27,1.55) both;
  box-shadow: 0 8px 30px rgba(116,197,181,0.35);
}
/* Confetti particles */
.vs-reg-confetti { position: absolute; width: 8px; height: 8px; border-radius: 2px; }
.vs-reg-confetti:nth-child(2) { top: 10px; left: 5px; background: #74c5b5; animation: vsRegConfetti1 0.8s ease 0.3s both; }
.vs-reg-confetti:nth-child(3) { top: 10px; right: 5px; background: #335596; animation: vsRegConfetti2 0.8s ease 0.35s both; }
.vs-reg-confetti:nth-child(4) { top: 20px; left: 15px; background: #e8c547; animation: vsRegConfetti3 0.8s ease 0.4s both; }
.vs-reg-confetti:nth-child(5) { top: 20px; right: 15px; background: #74c5b5; animation: vsRegConfetti4 0.8s ease 0.45s both; }

.vs-reg-success-logo {
  width: 50px; height: auto; margin-bottom: 16px;
  animation: vsRegFadeUp 0.4s ease 0.4s both;
}
.vs-reg-success h3 {
  color: #335596; font-weight: 700; font-size: 1.25rem;
  margin-bottom: 8px;
  animation: vsRegFadeUp 0.4s ease 0.5s both;
}
.vs-reg-success .vs-reg-success-sub {
  color: #74c5b5; font-size: 0.85rem; font-weight: 600;
  margin-bottom: 14px;
  animation: vsRegFadeUp 0.4s ease 0.55s both;
}
.vs-reg-success p {
  color: #555; font-size: 0.92rem; line-height: 1.65; margin-bottom: 22px;
  animation: vsRegFadeUp 0.4s ease 0.6s both;
}
.vs-reg-success-btn {
  display: inline-block; padding: 12px 36px;
  background: linear-gradient(135deg, #335596, #74c5b5);
  color: #fff; border: none; border-radius: 10px;
  font-size: 0.95rem; font-weight: 600;
  cursor: pointer; font-family: "Poppins", sans-serif;
  transition: all 0.3s ease;
  animation: vsRegFadeUp 0.4s ease 0.65s both;
}
.vs-reg-success-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(51,85,150,0.3); }

/* Large monitors (1400px+) */
@media (min-width: 1400px) {
  .vs-reg-dialog { max-width: 600px; }
  .vs-reg-header { padding: 22px 28px; }
  .vs-reg-header-logo { width: 42px; height: 42px; }
  .vs-reg-header-title { font-size: 1.2rem; }
  .vs-reg-body { padding: 28px 28px 22px; }
  .vs-reg-field input, .vs-reg-field select, .vs-reg-field textarea { padding: 12px 16px; font-size: 0.95rem; }
  .vs-reg-footer { padding: 0 28px 24px; }
  .vs-reg-submit { padding: 14px 24px; font-size: 1rem; }
}

/* Tablet (577px - 768px) */
@media (max-width: 768px) {
  .vs-reg-dialog { max-width: 95%; }
  .vs-reg-header { padding: 16px 20px; }
  .vs-reg-body { padding: 20px 20px 16px; }
  .vs-reg-footer { padding: 0 20px 18px; }
  .vs-reg-privacy { padding: 0 20px 14px; }
}

/* Mobile (max-width: 576px) */
@media (max-width: 576px) {
  .vs-reg-overlay { padding: 10px; }
  .vs-reg-dialog { max-width: 100%; border-radius: 12px; max-height: 95vh; }
  .vs-reg-header { padding: 14px 16px; border-radius: 12px 12px 0 0; }
  .vs-reg-header-logo { width: 32px; height: 32px; margin-right: 10px; padding: 3px; }
  .vs-reg-header-title { font-size: 0.95rem; }
  .vs-reg-header-sub { font-size: 0.72rem; }
  .vs-reg-body { padding: 16px 16px 12px; }
  .vs-reg-row { flex-direction: column; gap: 0; }
  .vs-reg-field { margin-bottom: 14px; }
  .vs-reg-field label { font-size: 0.8rem; }
  .vs-reg-field input, .vs-reg-field select, .vs-reg-field textarea { padding: 10px 12px; font-size: 0.88rem; border-radius: 8px; }
  .vs-reg-footer { padding: 0 16px 16px; flex-direction: column; }
  .vs-reg-submit { padding: 12px 16px; font-size: 0.9rem; }
  .vs-reg-cancel { padding: 11px 16px; font-size: 0.88rem; }
  .vs-reg-privacy { padding: 0 16px 14px; font-size: 0.68rem; }
  .vs-reg-role-pills { gap: 8px; }
  .vs-reg-role-pill { padding: 10px 8px; border-radius: 10px; }
  .vs-reg-role-pill i { font-size: 1.1rem; }
  .vs-reg-role-pill span { font-size: 0.78rem; }
  .vs-reg-success { padding: 24px 16px 28px; }
  .vs-reg-success-anim { width: 70px; height: 70px; }
  .vs-reg-success-icon { width: 70px; height: 70px; font-size: 1.8rem; }
  .vs-reg-success h3 { font-size: 1.1rem; }
  .vs-reg-success p { font-size: 0.85rem; }
}

/* Very small devices (max-width: 380px) */
@media (max-width: 380px) {
  .vs-reg-overlay { padding: 6px; }
  .vs-reg-dialog { border-radius: 10px; }
  .vs-reg-header { padding: 12px 12px; border-radius: 10px 10px 0 0; }
  .vs-reg-header-logo { width: 28px; height: 28px; margin-right: 8px; }
  .vs-reg-header-title { font-size: 0.88rem; }
  .vs-reg-header-sub { font-size: 0.68rem; }
  .vs-reg-close { width: 30px; height: 30px; font-size: 1.1rem; }
  .vs-reg-body { padding: 14px 12px 10px; }
  .vs-reg-field { margin-bottom: 12px; }
  .vs-reg-field label { font-size: 0.75rem; margin-bottom: 4px; }
  .vs-reg-field input, .vs-reg-field textarea { padding: 9px 10px; font-size: 0.85rem; }
  .vs-reg-role-pill { padding: 8px 6px; }
  .vs-reg-role-pill i { font-size: 1rem; margin-bottom: 3px; }
  .vs-reg-role-pill span { font-size: 0.72rem; }
  .vs-reg-footer { padding: 0 12px 12px; gap: 8px; }
  .vs-reg-submit { padding: 11px 14px; font-size: 0.85rem; }
  .vs-reg-cancel { padding: 10px 14px; font-size: 0.82rem; }
  .vs-reg-privacy { padding: 0 12px 10px; font-size: 0.65rem; }
  .vs-reg-success-anim { width: 60px; height: 60px; }
  .vs-reg-success-icon { width: 60px; height: 60px; font-size: 1.5rem; }
  .vs-reg-success-logo { width: 40px; }
  .vs-reg-success h3 { font-size: 1rem; }
  .vs-reg-success p { font-size: 0.8rem; }

  /* Prevent iOS zoom on input focus */
  .vs-reg-field input, .vs-reg-field select, .vs-reg-field textarea { font-size: 16px; }
}

/* Dark mode */
body.vs-dark .vs-reg-dialog { background: #1e2a3a; }
body.vs-dark .vs-reg-field input,
body.vs-dark .vs-reg-field select,
body.vs-dark .vs-reg-field textarea { background: #2a3a4e; border-color: #3a4f68; color: #e0e6ed; }
body.vs-dark .vs-reg-field input::placeholder,
body.vs-dark .vs-reg-field textarea::placeholder { color: #6b7f99; }
body.vs-dark .vs-reg-field label { color: #74c5b5; }
body.vs-dark .vs-reg-role-pill { background: #2a3a4e; border-color: #3a4f68; }
body.vs-dark .vs-reg-role-pill span { color: #ccc; }
body.vs-dark .vs-reg-role-badge { background: rgba(116,197,181,0.1); border-color: rgba(116,197,181,0.25); }
body.vs-dark .vs-reg-cancel { color: #aaa; border-color: #3a4f68; }
body.vs-dark .vs-reg-privacy { color: #666; }
body.vs-dark .vs-reg-success h3 { color: #74c5b5; }
body.vs-dark .vs-reg-success p { color: #bbb; }
