/* ==========================================================
   Root Variables
   ========================================================== */


:root {
  --primary: #4f46e5;
  --text: #1f1f1f;
  --bg: #ffffff;
  --input-bg: #f9f9f9;
  --border: #ccc;
  --error: #ff4d4f;
  --radius: 8px;
  --duration: 0.3s;
  --weak: #ff4d4f;
  --medium: #ffc107;
  --strong: #4caf50;
}

/* Dark mode variables override */
body.dark-mode {
  --primary: #818cf8;
  --text: #f5f5f5;
  --bg: #121212;
  --input-bg: #1e1e1e;
  --border: #444;
  --error: #ff6b6b;
  --weak: #ff6b6b;
  --medium: #ffd666;
  --strong: #81c784;
}

/* ==========================================================
   General Body and Layout
   ========================================================== */
body {
  background: linear-gradient(135deg, #f0f4ff, #ffffff);
  color: var(--text);
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  box-sizing: border-box;
  transition: all var(--duration) ease;
}

body.dark-mode {
  background: linear-gradient(135deg, #1a1a1a, #121212);
}

/* ==========================================================
   Wrapper Layouts
   ========================================================== */


.login-wrapper,
.register-wrapper{
  background: var(--bg);
  padding: 40px 30px;
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 460px;
  margin: auto;
  box-sizing: border-box;
  outline: none;
  z-index: 2;
}

.login-wrapper:focus,
.register-wrapper:focus,
.success-wrapper:focus {
  outline: none;
}


/* ==========================================================
   Theme Switcher
   ========================================================== */

.theme-switch {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* ==========================================================
   Form and Field Styles
   ========================================================== */
h2 {
  color: var(--text);
  text-align: center;
  margin: 0 auto 12px auto;
}

.form-group {
  position: relative;
  margin-bottom: 30px;
}

.form-group input {
  width: 100%;
  padding: 14px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.3s ease;
  color: var(--text);
}

.form-group select {
  width: 100%;
  padding: 14px 12px;
  background-color: var(--input-bg) !important;   /* <- Force background */
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

select {
  height: 44px;
  font-size: 16px;
  border-radius: 8px;
  max-width: 100%;
}

@media (max-width: 500px) {
  select {
    height: 36px;
    font-size: 14px;
  }
}




.form-group select + label {
  top: -8px;
  left: 10px;
  font-size: 13px;
  color: var(--primary);
  background-color: var(--bg);
  background: #2a2a2a;
  border-left: 1px solid var(--bg);
  border-right: 1px solid var(--bg);
  appearance: none;
}
.cuspass button
{
 position: absolute;
 top: 40% !important;
}
.cuspass label
{
 position: absolute;
 top: 40% !important;
}
.form-group label {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: #888;
  font-size: 16px;
  background-color: transparent !important;
  padding: 0 4px;
  pointer-events: none;
  transition: 0.2s ease all;
  z-index: 1;
  line-height: 1;
}


.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group select:focus + label,
.form-group select:valid + label {
  top: -10px !important;
  left: 10px;
  font-size: 13px;
  color: var(--primary);
  background-color: var(--bg);
  background: var(--input-bg);
  border-left: 1px solid var(--bg);
  border-right: 1px solid var(--bg);
   
}

input::placeholder {
  color: transparent;
}

input.invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}

select.invalid {
    border-color: var(--error);
  box-shadow: 0 0 0 0.1px var(--error);
}

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

.validation-msg {
  display: block;
  font-size: 13px;
  color: var(--error);
  position: absolute;
  bottom: -18px;
  left: 0;
  height: 18px;
  line-height: 1;
  font-weight: 400;
}


.password-strength {
  height: 6px;
  border-radius: 4px;
  margin-top: -20px;
  margin-bottom: 20px;
  background-color: #eee;
  overflow: hidden;
}

.password-strength .bar {
  height: 100%;
  width: 0;
  transition: width 0.4s ease;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
}

.toggle-password img {
  width: 18px;
  height: 18px;
  opacity: 0.8;
  transition: 0.2s;
  filter: invert(0);
}

.toggle-password img:hover {
  opacity: 1;
}


/* ==========================================================
   Buttons and Navigation
   ========================================================== */

.btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 5px;
  font-size: 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s ease;
  margin-top: 4px;
  border-radius:5px;
}

.btn:hover {
  transform: scale(1.02);
}

.btn:disabled {
  background: #ccc;
  color: #777;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

.register-nav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 30px;
}

.register-nav button {
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  font-size: 15px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.register-nav button:hover {
  background: #3f38c5;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -8px;
  font-size: 14px;
  color: var(--text);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

.checkbox-label {
  display: inline;
  cursor: pointer;
  user-select: none;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.link-button:hover {
  text-decoration: none;
}



/* ==========================================================
   Divider and Redirect Text
   ========================================================== */

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #aaa;
  margin: 28px 0 18px 0;
  font-size: 14px;
  position: relative;
}
.divider:before, .divider:after {
  content: "";
  flex: 1;
  border-bottom: 1.5px solid #e3e3e3;
  margin: 0 10px;
}
.divider span {
  color: #999;
  font-weight: 500;
  letter-spacing: 1px;
}

.form-options {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 18px;
  align-items: center;
}

.form-options a,
.redirect a {
  color: var(--primary);
  text-decoration: none;
}

.form-options a:hover,
.redirect a:hover {
  text-decoration: underline;
}

body.dark-mode .divider:before,
body.dark-mode .divider:after {
  border-bottom: 1.5px solid #333;
}

body.dark-mode .divider span {
  color: #bbb;
}


/* ==========================================================
   Social Icons (Login Options)
   ========================================================== */



/* Social icon row */
.social-icons {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-bottom: 22px;
}

.social-icon-link {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  box-shadow: 0 1px 4px rgba(60,60,60,0.04);
  transition: border 0.2s, box-shadow 0.2s, transform 0.13s;
  cursor: pointer;
  text-decoration: none;
}

.social-icon-link img {
  width: 26px;
  height: 26px;
}

.social-icon-link:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 14px rgba(60,60,60,0.07);
  border-color: var(--primary);
}

/* Brand color ring (optional) */
.social-icon-link.google:hover { box-shadow: 0 0 0 2px #4285f425; }
.social-icon-link.github:hover { box-shadow: 0 0 0 2px #18171744; }
.social-icon-link.facebook:hover { box-shadow: 0 0 0 2px #1877f233; }
.social-icon-link.microsoft:hover { box-shadow: 0 0 0 2px #ffba0840; }


body.dark-mode .social-icon-link {
  background: #232323;
  border-color: #3a3a3a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

body.dark-mode .social-icon-link:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px #6366f133;
}

/* Optional: Make icons invert color for dark backgrounds, EXCEPT Microsoft/Google which are full-color */
body.dark-mode .social-icon-link.github img {
  filter: invert(1) brightness(1.5);
}

/* ==========================================================
   Captcha Styles
   ========================================================== */

.captcha-group {
  margin-bottom: 24px;
}

.captcha-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.captcha-group .validation-msg{
    left: 181px !important;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#captchaCanvas {
  border-radius: 6px;
  border: 1px solid var(--border);
  background: linear-gradient(120deg, #f7f7fc 80%, #e3eafe 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#captchaInput {
  flex: 1;
  min-width: 0;
  margin-left: 8px;
  padding-left: 12px;
}

.refresh-captcha {
  background: none;
  border: none;
  font-size: 1.3em;
  cursor: pointer;
  color: var(--primary);
  transition: color 0.2s;
  padding: 2px 6px;
  border-radius: 4px;
}

.refresh-captcha:hover {
  color: #3f38c5;
  background: #eee;
}

/* ==========================================================
   Modal (for Terms & Conditions)
   ========================================================== */


.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
  background: var(--bg);
  padding: 20px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh; 
  overflow-y: auto;         
  border-radius: var(--radius);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  color: var(--text);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 18px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
}

.terms-container label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}


/* ==========================================================
   Loader Overlay and Spinner
   ========================================================== */

/* Loader Overlay */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease-in-out;
}

.loader-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--primary);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

/* ==========================================================
   Toast Notification
   ========================================================== */

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  max-width: 90vw;
  background: #4caf50;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  animation: fadeDown 4s ease forwards;
  font-size: 1rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-word;
  text-align: center;
  pointer-events: none;
}

/* Responsive adjustments for very small screens */
@media (max-width: 480px) {
  .toast {
    top: 8px;
    padding: 10px 8px;
    font-size: 0.95rem;
    border-radius: 6px;
    max-width: 96vw;
  }
}


/* ==========================================================
   Success Page
   ========================================================== */

.success-wrapper {
      max-width: 460px;
      margin: auto;
      padding: 40px 20px;
      text-align: center;
      background-color: var(--bg);
      border-radius: var(--radius);
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
      animation: fadeIn 0.6s ease;
    }
    .success-wrapper h2 {
      color: var(--strong);
      margin-bottom: 10px;
    }
    .success-wrapper p {
      color: var(--text);
      margin-bottom: 30px;
    }
    .success-btn {
      padding: 14px 30px;
      background-color: var(--primary);
      color: #fff;
      border-radius: var(--radius);
      text-decoration: none;
      transition: transform 0.2s ease;
      display: inline-block;
    }
    .success-btn:hover {
      transform: scale(1.05);
    }

    .success-icon {
      font-size: 50px;
      color: var(--strong);
      margin-bottom: 20px;
      animation: bounce 1s ease infinite alternate;
      }


/* ==========================================================
   Animations
   ========================================================== */


@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}



@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

@keyframes fadeDown {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  10% { opacity: 1; transform: translate(-50%, 0); }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}


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


/* ==========================================================
   Responsive Design
   ========================================================== */
@media (max-width: 500px) {
  .login-wrapper, .register-wrapper,.success-wrapper { padding: 24px 16px; }
  .form-navigation { flex-direction: column; gap: 10px; }
}

/* ==========================================================
   Dark Mode Adjustments
   ========================================================== */


body.dark-mode .form-group select {
  background-color: #2a2a2a !important;
  color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ccc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}


body.dark-mode .form-group input,
body.dark-mode .form-group label,
body.dark-mode .form-options,
body.dark-mode .trust,
body.dark-mode .redirect {
  color: #f0f0f0;
}

body.dark-mode .login-wrapper,
body.dark-mode .register-wrapper,
body.dark-mode .success-wrapper {
  background: #1d1d1d;
}

body.dark-mode .btn {
  background: #6366f1;
}

body.dark-mode .form-group input {
  background: #2a2a2a;
  border-color: #444;
}

body.dark-mode .modal-content {
  background: #1d1d1d;
  color: #f0f0f0;
}


body.dark-mode .toggle-password img {
  filter: invert(1) brightness(1.3);
}

body.dark-mode .strength-feedback img {
  filter: invert(1);
}

.register-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.bar.weak { background: var(--weak); width: 33%; }
.bar.medium { background: var(--medium); width: 66%; }
.bar.strong { background: var(--strong); width: 100%; }



/* ==========================================================
   Common Adjustments
   ========================================================== */

.trust {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: #999;
}

.redirect {
  font-size: 14px;
  margin-top: 16px;
  text-align: center;
}


.progress-container {
  background: #eee;
  height: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 30px;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.4s ease;
}

.step { display: none; animation: fadeIn 0.4s ease; }
.step.active { display: block; }

.password-strength {
  height: 6px;
  background: #e0e0e0;
  border-radius: 4px;
  margin-top: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  position: relative;
}

#strengthBar {
  height: 100%;
  width: 0%;
  transition: width 0.5s ease, background-color 0.3s ease;
  border-radius: 4px;
}

#resetstrengthBar
{
  height: 100%;
  width: 0%;
  transition: width 0.5s ease, background-color 0.3s ease;
  border-radius: 4px;
}

.form-group label[for="terms"] {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.form-group input#terms {
  margin-top: 0;
}



/* ==========================================================
   Auto compete 
   ========================================================== */

   .autocomplete-suggestions {
  position: absolute;
  top: 48px; /* adjust if input height changes */
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 180px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  display: none;
}
.autocomplete-suggestion {
  padding: 12px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
}
.autocomplete-suggestion:hover, .autocomplete-suggestion.active {
  background: var(--primary);
  color: #fff;
}
body.dark-mode .autocomplete-suggestions {
  background: #222;
  border-color: #444;
}
