/* =========================================================
   Auth styles (refactored)
   - Keeps existing selectors to avoid HTML changes
   - Consolidates tokens + removes duplicated body rules
   ========================================================= */

/* -----------------------------
   1) Base reset
   ----------------------------- */
*{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

/* -----------------------------
   2) Theme (backgrounds + text)
   ----------------------------- */
body.light-mode{
  background-image: url('../images/lightbg.png');
  background-size: cover;
  background-position: center;
  color: #333;
}

body.dark-mode{
  background-image: url('../images/darkbg.png');
  background-size: cover;
  background-position: center;
  color: #fff;
}

/* Body for Login/Register (page layout) */
body{
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  transition: background-image .5s ease, color .5s ease;
}

/* -----------------------------
   3) Auth form container
   ----------------------------- */
.form-container{
  position: relative;
  width: 90%;
  max-width: 400px;
  padding: 40px;

  background: rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  box-shadow: 0 0 25px rgba(0,0,0,.30);
}

body.dark-mode .form-container{
  background: rgba(0,0,0,.50);
}

.form-container h2{
  margin-bottom: 20px;
  font-size: 24px;
  text-align: center;
  font-weight: 800;
}

body.dark-mode .form-container h2{ color: #fff; }

/* Inputs */
.form-container input{
  width: 100%;
  padding: 15px;
  margin: 15px 0;

  border: 1px solid rgba(255,255,255,.30);
  border-radius: 10px;
  font-size: 16px;

  background-color: rgba(0,0,0,.50);
  color: #fff;
}

body.light-mode .form-container input{
  background-color: rgba(255,255,255,.80);
  border: 1px solid rgba(0,0,0,.10);
  color: #000;
}

.form-container input::placeholder{ color: rgba(255,255,255,.80); }
body.light-mode .form-container input::placeholder{ color: rgba(0,0,0,.60); }

/* Buttons */
.form-container button{
  width: 100%;
  padding: 15px;

  border: none;
  border-radius: 10px;
  font-size: 16px;
  margin-top: 10px;
  cursor: pointer;

  transition: background-color .5s ease, color .5s ease, transform .15s ease;
}
.form-container button:active{ transform: translateY(1px); }

.login-btn{ background-color: #28a745; color: #fff; }
.register-btn{ background-color: #007bff; color: #fff; }

.toggle-buttons{
  text-align: center;
  margin-top: 20px;
}

.toggle-buttons a{
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  margin: 10px;

  font-size: 14px;
  font-weight: 800;
  transition: color .5s ease;
}

body.light-mode .toggle-buttons a{ color: #000; }
body.dark-mode .toggle-buttons a{ color: #fff; }

/* -----------------------------
   4) Toggle switch (auth page)
   ----------------------------- */
.toggle-switch{
  position: absolute;
  top: 20px;
  right: 20px;
}

.toggle-switch label{
  display: flex;
  align-items: center;
}

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

.toggle-switch .slider{
  width: 40px;
  height: 20px;
  background-color: #ccc;
  border-radius: 34px;
  position: relative;
  transition: .4s;
}

.toggle-switch .slider::before{
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background-color: #fff;
  bottom: 2px;
  left: 2px;
  transition: .4s;
}

.toggle-switch input:checked + .slider{ background-color: #2196F3; }
.toggle-switch input:checked + .slider::before{ transform: translateX(20px); }

/* -----------------------------
   5) Modal
   ----------------------------- */
.modal{
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  background-color: rgba(0,0,0,.50);
}

.modal-content{
  background-color: #fff;
  margin: 10% auto;
  padding: 30px;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  text-align: center;
  font-size: 18px;
  position: relative;
}

body.dark-mode .modal-content{ color: #333; }

.close{
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 28px;
  font-weight: 800;
}
.close:hover,
.close:focus{
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.modal p{
  margin-bottom: 20px;
  line-height: 1.6;
}

.code-block{
  font-family: monospace;
  font-size: 16px;
  color: #333;
  background-color: #f4f4f4;
  padding: 10px;
  border-radius: 4px;
  word-wrap: break-word;
}

#instructionText{ margin-top: 20px; }

#confirmVerification{
  margin-top: 20px;
  background-color: #4CAF50;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;

  display: block;
  margin-left: auto;
  margin-right: auto;
}
#confirmVerification:hover{ background-color: #45a049; }

/* -----------------------------
   6) Textarea (kept, cleaned)
   ----------------------------- */
.textarea{
  width: 100%;
  min-height: 10rem;
  resize: vertical;

  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--ta-border);
  background: var(--ta-bg);
  color: var(--ta-color);

  font: inherit;
  line-height: 1.45;
  letter-spacing: .2px;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 8px 30px rgba(0,0,0,.35);
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.textarea::placeholder{ color: rgba(255,255,255,.55); }
.textarea:hover{ background: rgba(255,255,255,.08); }
.textarea:focus{
  outline: none;
  border-color: var(--ta-accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 0 0 2px color-mix(in srgb, var(--ta-accent) 25%, transparent),
    0 10px 34px rgba(0,0,0,.45);
}
.textarea:disabled{ opacity: .6; cursor: not-allowed; }
.textarea.is-invalid{
  border-color: #ff3b3b;
  box-shadow: 0 0 0 2px rgba(255,59,59,.25);
}
.textarea--sm{ min-height: 6rem;  padding: 10px 12px; }
.textarea--lg{ min-height: 14rem; padding: 16px 18px; }

/* -----------------------------
   7) Fullscreen loader
   ----------------------------- */
.loader-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loader{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 28px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.loader-text{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 15px;
  color: #222;
}

.spinner{
  width: 42px;
  height: 42px;
  border: 4px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

@keyframes spin{ to{ transform: rotate(360deg); } }

/* lock scroll when loader active */
.body--loading{ overflow: hidden; }
