@import url("https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

:root {
  --primary-color: #4b2c7c;
  --secondary-color: #3a5a8a;
  --accent-color: #ff914d;
  --light-color: #f8f9fa;
  --dark-color: #2c3e50;
  --success-color: #4caf50;
  --border-radius: 10px;
  --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", "Nunito", "Segoe UI", sans-serif;
}

body {
  background: url('../../photo/waterfallsBg.png') no-repeat center center / cover;
}

/* === MAIN CONTAINER === */
.firstpage {
  background: white;
  border-radius: var(--border-radius);
  width: 95%;
  max-width: 450px;
  box-shadow: 0 6px #9e9e9e;
  position: relative;
  overflow: hidden;
  border: 1px solid #e0e8f5;
  margin: 1rem auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: floatIn 0.6s ease-out;
}

.firstpage::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background: linear-gradient(90deg, #4a6fa5, #ff914d, #4caf50);
}

/* === HEADER STYLES === */
.header {
  background-color: var(--primary-color);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-shadow: var(--box-shadow);
}

.logo-container {
  display: flex;
  align-items: center;
  padding: 0.8rem 1.5rem;
  text-decoration: none;
  color: white;
}

.nav-links {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links li {
  padding: 0.8rem 1.2rem;
}

.mobile-menu-btn {
  padding: 0.8rem 1.5rem;
  display: none;
}

/* === TYPOGRAPHY === */
h1 {
  text-align: center;
  font-weight: 700;
  color: var(--dark-color);
  font-size: clamp(1rem, 2vw, 1.4rem);
  position: relative;
}

h5 {
  text-align: center;
  font-size: 1.2rem;
  color: var(--dark-color);
}

p {
  text-align: center;
  color: #666;
  font-size: clamp(0.8rem, 1.8vw, 0.9rem);
}

a {
  color: #4B2C7C;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.login {
  font-weight: 900;
}

/* === FORM LAYOUT === */
.form-two {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: stretch;
  justify-content: center;
  gap: 0;
}

.firstbox, .secondbox, .thirdbox, .fourthbox {
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 0.8rem;
    animation: fadeIn 0.3s ease-in-out;
}

.firstbox.step-active, 
.secondbox.step-active, 
.thirdbox.step-active,
.fourthbox.step-active {
    display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* === STEP INDICATORS AND NAVIGATION === */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 0 0;
  border-top: 1px solid #eee;
  width: 100%;
}

.prev-btn, .next-btn {
  padding: 12px 25px;
  background-color: coral;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: background-color 0.3s ease;
  min-width: 100px;
}

.prev-btn:hover, .next-btn:hover {
  background-color: #ff7f50;
}

.prev-btn:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

.prev-btn:disabled:hover {
  background-color: #cccccc;
}

/* === SUBMIT BUTTON STYLES === */
.next-btn:last-child {
    background-color: var(--primary-color);
}

.next-btn:last-child:hover {
    background-color: #3a1c63;
}

/* Update step indicators for 4 steps */
.step-indicators {
    display: flex;
    gap: 0;
    align-items: center;
    position: relative;
}

.step-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    z-index: 2;
}

/* Connecting lines between steps */
.step-circle:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    width: 20px;
    height: 2px;
    background-color: #ddd;
    transform: translateY(-50%);
    z-index: 1;
}

.step-circle.active {
    background-color: coral;
    color: white;
    border-color: coral;
}

.step-circle.completed {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.step-circle.active:not(:last-child)::after,
.step-circle.completed:not(:last-child)::after {
    background-color: #4CAF50;
}

/* === RESET BUTTON STYLES === */
.reset-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.reset-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

/* === INPUT FIELD STYLES === */
input[type="text"],
input[type="date"],
input[type="tel"],
input[type="email"],
input[type="password"],
select,
.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #66666666; /* Default gray for empty fields */
    border-radius: 5px;
    font-size: 14px;
    transition: var(--transition);
    box-sizing: border-box;
    background-color: #f8fafc;
}

/* When user focuses or types in a field */
input:focus,
select:focus,
.form-control:focus,
input.dirty,
select.dirty,
.image-preview-container.dirty {
    border-color: var(--primary-color); /* Primary color when active/typed */
    outline: none;
    box-shadow: 0 0 0 3px rgba(75, 44, 124, 0.1);
    background-color: white;
}

/* Error state (after validation fails) */
input.error,
select.error,
.image-preview-container.error {
    border-color: red !important;
}

/* Success state (after validation passes) */
input.valid,
select.valid {
    border-color: #4CAF50 !important;
}

/* Image preview container default state */
.image-preview-container {
    border: 3px solid #add8e6;
    transition: var(--transition);
}

/* Radio button styling */
.gender-container input[type="radio"] {
    accent-color: var(--primary-color);
}

/* File input styling */
#image {
    border: 2px solid #66666666;
}

#image.dirty {
    border-color: var(--primary-color);
}

#image.error {
    border-color: red;
}

/* Checkbox styling */
input[type="checkbox"] {
    accent-color: var(--primary-color);
}

/* === FORM ELEMENTS === */
label {
  display: block;
  font-weight: 600;
  color: var(--dark-color);
  font-size: clamp(0.75rem, 1.5vw, 0.85rem);
}

/* === FORM GROUP STYLING === */
.form-group {
  margin-bottom: 1rem;
}

.form-group h3 {
  color: var(--dark-color);
  font-size: 1.1rem;
}

/* === GENDER RADIO BUTTONS === */
.gender-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.gender-container input[type="radio"] {
  transform: scale(1.2);
  cursor: pointer;
}

.gender {
  font-size: 14px;
  color: var(--dark-color);
}

/* === IMAGE UPLOAD PREVIEW === */
.image-preview-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0f8ff;
  box-sizing: border-box;
}

.image-preview-container:hover {
  cursor: pointer;
}

.image-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 2;
}

#fallback-text {
  position: absolute;
  text-align: center;
  font-size: 0.9rem;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#image {
  display: none;
}

/* === ADDRESS SECTION === */
.address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}

.full-width {
  grid-column: 1 / -1;
}

/* === TERMS AND CONDITIONS === */
.terms-link {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  margin: 1rem 0;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  color: #555;
  cursor: pointer;
}

.terms-checkbox-error {
  display: block;
  color: red;
  font-size: 0.8rem;
}

.optional-label {
  color: #666;
  font-weight: 500;
}

/* === BUTTONS === */
.button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.85rem;
  border-radius: var(--border-radius);
  font-size: clamp(1rem, 2vw, 1.1rem);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  letter-spacing: 0.5px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.button:hover {
  background-color: #3a1c63;
  transform: translateY(-2px);
}

/* === ERROR MESSAGES === */
.text-warning {
  color: red;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

small {
  color: red;
  display: block;
  font-size: 0.8rem;
}

/* === FIELD ERROR STYLES === */
.field-error {
    color: red;
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
}

/* === MODAL STYLES === */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 20px;
  border-radius: 8px;
  width: 60%;
  max-width: 600px;
  position: relative;
}

.close {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
}

.terms-box {
  height: 200px;
  overflow-y: auto;
  border: 1px solid #ccc;
  padding: 10px;
  font-size: 14px;
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
  }

  .mobile-menu-btn {
    display: block;
    order: 2;
  }

  .nav-links {
    width: 100%;
    flex-direction: column;
    display: none;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links li {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .firstpage {
    padding: 1.5rem;
  }

  .address-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .image-preview-container {
    width: 150px;
    height: 150px;
  }

  .nav-buttons {
    flex-direction: row-reverse;
    gap: 15px;
    padding-top: 15px;
  }

  .step-indicators {
    order: 2;
  }

  .prev-btn, .next-btn {
    width: 100%;
    max-width: 120px;
  }

  .reset-btn {
    width: 100%;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .firstpage {
    width: 98%;
    padding: 1.5rem;
    max-width: 100%;
  }
  
  .image-preview-container {
    width: 120px;
    height: 120px;
  }

  .step-circle {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .step-circle:not(:last-child)::after {
    width: 20px;
  }

  .prev-btn, .next-btn {
    padding: 10px 15px;
    font-size: 12px;
    min-width: 80px;
  }

  input[type="text"],
  input[type="date"],
  input[type="tel"],
  input[type="email"],
  input[type="password"],
  select {
    padding: 10px;
    font-size: 13px;
  }

  .reset-btn {
    padding: 8px 16px;
    font-size: 12px;
  }
}

/* Ensure no extra spacing */
body {
  margin: 0;
  padding: 0;
}