@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

/* ═══ ROOT VARIABLES ═══ */
:root {
  --primary-dark: #003b5c;
  --primary: #004f6d;
  --accent: #2bbcb3;
  --accent-light: #4dd9c0;
  --accent-pale: #e6f9f7;
  --text: #1a2b3c;
  --text-secondary: #4a6274;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --bg: #f4f7fa;
  --white: #ffffff;
  --danger: #ef4444;
  --success: #10b981;
  --shadow-sm: 0 1px 3px rgba(0, 59, 92, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 59, 92, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  font-family:
    "Inter",
    -apple-system,
    sans-serif;
  background: var(--bg);
  min-height: 100vh;
}

/* ═══ WRAPPER ═══ */
.wrapper {
  display: flex;
  min-height: 100vh;
  justify-content: center;
  align-items: center;
  background:
    url("../images/bg-pattern.png") var(--bg),
    linear-gradient(135deg, #f8fafd 0%, #e6eff5 100%);
  background-blend-mode: multiply;
  padding: 2rem 1rem;
}

/* ═══ CONTAINER ═══ */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 600px;
}

.login-form {
  width: 100%;
  background: var(--white);
  padding: 3rem 3rem;
  border-radius: 20px;
  box-shadow:
    var(--shadow-md),
    0 10px 40px rgba(0, 59, 92, 0.08);
  position: relative;
  overflow: hidden;
}

.login-form::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    90deg,
    var(--primary-dark),
    var(--primary),
    var(--accent)
  );
}

/* ═══ STEP INDICATOR ═══ */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  gap: 0;
}

.step-indicator .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  position: relative;
}

.step-indicator .step span {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  transition: color 0.3s var(--ease);
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-muted);
  border: 2px solid var(--border);
  transition: all 0.4s var(--ease);
}

.step.active .step-number {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(0, 59, 92, 0.25);
}

.step.active span {
  color: var(--primary-dark);
  font-weight: 600;
}

.step.completed .step-number {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.step.completed span {
  color: var(--accent);
}

.step-line {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin: 0 0.5rem;
  margin-bottom: 1.2rem;
  transition: background 0.4s var(--ease);
}

.step.completed + .step-line,
.step-line:has(+ .step.active) {
  background: var(--accent);
}

/* Fix step-line coloring with JS class */
.step-line.line-active {
  background: var(--accent);
}

/* ═══ FORM STEPS ═══ */
.form-step {
  animation: fadeSlideIn 0.4s var(--ease);
}

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

/* ═══ FORM FIELDS ═══ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.form-field {
  position: relative;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="password"],
.form-field input[type="number"],
.form-field input[type="date"] {
  width: 100%;
  padding: 1rem 1rem 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  transition: all 0.25s var(--ease);
  outline: none;
}

.form-field input:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(0, 59, 92, 0.08);
}

.form-field label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.25s var(--ease);
  background: transparent;
}

.form-field input[type="date"] + label,
.form-field input:focus + label,
.form-field input:not(:placeholder-shown) + label {
  top: 0.55rem;
  transform: translateY(0);
  font-size: 0.7rem;
  color: var(--primary-dark);
  font-weight: 600;
}

.field-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  padding-left: 0.25rem;
}

/* Select fields */
.select-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.select-field .select-label {
  position: static;
  transform: none;
  pointer-events: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding-left: 0.25rem;
  margin-bottom: 0.4rem;
}

.file-upload-wrapper {
  margin-top: 0.5rem;
  border: 1.5px dashed var(--border);
  padding: 1.25rem 1rem;
  border-radius: 10px;
  background: var(--white);
  transition: all 0.25s var(--ease);
  position: relative;
}

.file-upload-wrapper:hover {
  border-color: var(--primary-dark);
  background: var(--bg);
}

.file-upload-wrapper label {
  position: static;
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  transform: none;
  pointer-events: auto;
}

.file-upload-wrapper input[type="file"] {
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 100%;
}

.file-upload-wrapper input[type="file"]::file-selector-button {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--primary-dark);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 1rem;
}

.file-upload-wrapper input[type="file"]::file-selector-button:hover {
  background: var(--border);
}

.select-field select {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

.select-field select:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(0, 59, 92, 0.08);
}

/* Password toggle */
.toggle-pw {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.25rem;
  transition: color 0.2s;
}

.toggle-pw:hover {
  color: var(--primary-dark);
}

/* Terms checkbox */
.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--accent-pale);
  border-radius: 10px;
  border: 1px solid rgba(43, 188, 179, 0.15);
}

.terms-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary-dark);
  cursor: pointer;
  flex-shrink: 0;
}

.terms-check label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  cursor: pointer;
}

.terms-check a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}

.terms-check a:hover {
  text-decoration: underline;
}

/* ═══ BUTTONS ═══ */
.step-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.btn-submit {
  flex: 1;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-submit:hover {
  background: linear-gradient(135deg, #002e47, var(--primary-dark));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 59, 92, 0.2);
}

.btn-back {
  padding: 0.9rem 1.5rem;
  background: var(--white);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-back:hover {
  border-color: var(--primary-dark);
  color: var(--primary-dark);
  background: var(--accent-pale);
}

/* ═══ ALERTS ═══ */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.alert p {
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert p:last-child {
  margin-bottom: 0;
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* ═══ LOGIN LINK ═══ */
.login-link a {
  color: var(--primary-dark);
  font-weight: 600;
  transition: color 0.2s;
}

.login-link a:hover {
  color: var(--accent);
}

/* ═══ RESPONSIVE ═══ */
/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .wrapper {
    padding: 1rem;
  }
  .login-form {
    padding: 2.5rem 1.5rem;
  }
  .container {
    padding: 0;
  }
  .step-indicator {
    gap: 0;
  }
  .step-line {
    width: 30px;
  }
  .step-indicator .step span {
    font-size: 0.65rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }
  .login-form {
    padding: 1rem 0;
  }
  .step-number {
    width: 30px;
    height: 30px;
    font-size: 0.7rem;
  }
  .step-line {
    width: 20px;
  }
}

/* ═══════════════════════════════════════════
   PIN CREATION MODAL
   ═══════════════════════════════════════════ */
.pin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 30, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
  animation: modalOverlayIn 0.4s ease-out;
}

@keyframes modalOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.pin-modal {
  background: var(--white);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  animation: modalSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pin-modal-header {
  background: linear-gradient(
    135deg,
    var(--primary-dark) 0%,
    var(--primary) 60%,
    #006d7a 100%
  );
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pin-modal-header::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -30%;
  width: 250px;
  height: 250px;
  background: radial-gradient(
    circle,
    rgba(43, 188, 179, 0.15) 0%,
    transparent 70%
  );
  border-radius: 50%;
}

.pin-modal-header::after {
  content: "";
  position: absolute;
  bottom: -40%;
  left: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    rgba(77, 217, 192, 0.1) 0%,
    transparent 70%
  );
  border-radius: 50%;
}

.pin-modal-icon {
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.pin-modal-icon-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: ringPulse 2s ease-in-out infinite;
}

@keyframes ringPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(43, 188, 179, 0.3);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(43, 188, 179, 0);
  }
}

.pin-modal-icon-ring i {
  font-size: 1.8rem;
  color: var(--white);
}

.pin-modal-success-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.pin-modal-header h2 {
  color: var(--white);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.pin-modal-header p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

.pin-modal-body {
  padding: 2rem;
}

.pin-create-section {
  margin-bottom: 1.5rem;
}

.pin-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-align: center;
}

.pin-input-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.pin-box {
  width: 60px;
  height: 65px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  transition: all 0.25s var(--ease);
  font-family: inherit;
  caret-color: var(--accent);
  outline: none;
}

.pin-box:focus {
  border-color: var(--primary-dark);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(0, 59, 92, 0.1);
  transform: translateY(-2px);
}

.pin-box:not(:placeholder-shown),
.pin-box:not([value=""]) {
  border-color: var(--accent);
  background: var(--accent-pale);
}

.pin-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
  animation: fadeInAlert 0.3s ease-out;
}

.pin-success {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  color: #166534;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
  animation: fadeInAlert 0.3s ease-out;
}

@keyframes fadeInAlert {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pin-submit-btn {
  width: 100%;
  padding: 0.95rem;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 1rem;
}

.pin-submit-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #002e47, var(--primary-dark));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 59, 92, 0.25);
}

.pin-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.pin-modal-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.pin-modal-note i {
  color: var(--accent);
}

/* Shake animation for PIN mismatch */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  50%,
  90% {
    transform: translateX(-4px);
  }
  30%,
  70% {
    transform: translateX(4px);
  }
}

.shake {
  animation: shake 0.5s ease-in-out;
  border-color: var(--danger) !important;
}

@media (max-width: 480px) {
  .pin-modal {
    border-radius: 18px;
  }
  .pin-box {
    width: 52px;
    height: 56px;
    font-size: 1.3rem;
  }
  .pin-input-row {
    gap: 8px;
  }
  .pin-modal-header {
    padding: 2rem 1.5rem 1.5rem;
  }
  .pin-modal-body {
    padding: 1.5rem;
  }
}

/* ═══ Back to Login Link in PIN Modal ═══ */
.pin-back-link-container {
  text-align: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.pin-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.25s var(--ease);
  cursor: pointer;
}

.pin-back-link i {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.pin-back-link:hover {
  background: var(--bg);
  border-color: var(--primary-dark);
  color: #002e47;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 59, 92, 0.08);
}

.pin-back-link:hover i {
  transform: translateX(-3px);
}

.pin-back-link:active {
  transform: translateY(0);
  box-shadow: none;
}
