/* ══════════════════════════════════════════
   TERRA MIND — AUTH PAGES (login + register)
   auth.css
══════════════════════════════════════════ */

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

:root {
  --bg:        #f9dfc4;
  --topbar-bg: #fbe0cc;
  --salmon:    #d4836a;
  --salmon-dk: #b86a52;
  --brown:     #7a3a10;
  --slate:     #5a6a8a;
  --white:     #ffffff;
}

html, body {
  height: 100%;
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  overflow-x: hidden;
}

/* ══ TOP BAR ══ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 52px;
  background: var(--topbar-bg);
  /* animate in */
  animation: slideDown 0.5s ease both;
}

.topbar__logo {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
}

.logo-brain { width: 62px; height: 62px; object-fit: contain; }

.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-name { font-weight: 900; font-size: 1.65rem; letter-spacing: .06em; color: #1a1a1a; }
.logo-sub  { font-size: .56rem; font-weight: 700; letter-spacing: .28em; color: #888; text-transform: uppercase; }

.topbar__back {
  font-weight: 700; font-size: .78rem;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--salmon); text-decoration: none;
  transition: color .2s;
}
.topbar__back:hover { color: var(--brown); }

/* ══ PAGE WRAPPER ══ */
.page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 94px);
  overflow: hidden;
}

/* ══ UPPER GRID (photo + form) ══ */
.upper {
  display: grid;
  grid-template-columns: 300px 1fr;
  position: relative;
  z-index: 2;
  flex: 1;
}

/* ══ PHOTO COLUMN ══ */
.photo-col {
  padding: 40px 0 0 52px;
  animation: slideRight 0.6s ease 0.1s both;
}

.photo-frame {
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 40px rgba(100,40,10,.22);
}

.photo-frame img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  display: block;
  background: linear-gradient(160deg, #e8c0a0, #c89070);
}

.photo-btn {
  position: absolute; bottom: 26px; left: 50%;
  transform: translateX(-50%);
  background: rgba(212,131,106,.82);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-weight: 900; font-size: 1.05rem;
  letter-spacing: .16em; text-transform: uppercase;
  border: none; border-radius: 50px;
  padding: 13px 52px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .2s, transform .18s;
  white-space: nowrap;
}
.photo-btn:hover {
  background: rgba(175,75,45,.92);
  transform: translateX(-50%) translateY(-2px);
}

/* ══ FORM COLUMN ══ */
.form-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: slideLeft 0.6s ease 0.2s both;
}

.form-field {
  display: flex;
  align-items: baseline;
  gap: 28px;
  margin-bottom: 40px;
  animation: fadeUp 0.5s ease both;
}

/* Stagger each field */
.form-field:nth-child(1) { animation-delay: 0.30s; }
.form-field:nth-child(2) { animation-delay: 0.40s; }
.form-field:nth-child(3) { animation-delay: 0.50s; }
.form-field:nth-child(4) { animation-delay: 0.60s; }
.form-field:nth-child(5) { animation-delay: 0.70s; }
.form-field:nth-child(6) { animation-delay: 0.80s; }
.submit-row              { animation-delay: 0.90s !important; }

.form-field label {
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--salmon);
  text-align: right;
  flex-shrink: 0;
}

.form-field input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px dashed var(--salmon);
  outline: none;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  color: var(--brown);
  padding: 6px 2px;
  transition: border-color .2s, border-style .2s;
}
.form-field input:focus {
  border-bottom-color: var(--brown);
  border-bottom-style: solid;
}

/* Forgot password */
.forgot {
  animation: fadeUp 0.5s ease 0.58s both;
}
.forgot a {
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--slate);
  text-decoration: none;
  transition: color .2s;
}
.forgot a:hover { color: var(--salmon); }

/* Submit button */
.submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  animation: fadeUp 0.5s ease 0.78s both;
}

.submit-btn {
  background: var(--salmon);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700; font-size: .95rem;
  letter-spacing: .1em;
  border: none; border-radius: 50px;
  padding: 13px 52px;
  cursor: pointer;
  transition: background .2s, transform .18s;
}
.submit-btn:hover { background: var(--salmon-dk); transform: translateY(-2px); }

/* ══ WORLD MAP ══ */
.world-map {
  width: 100%;
  display: block;
  mix-blend-mode: multiply;
  margin-top: -60px;
  position: relative;
  z-index: 1;
  animation: fadeIn 0.9s ease 0.5s both;
}

/* ══ ANIMATIONS ══ */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

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

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

/* ══ LOGIN SPECIFIC ══ */
.login .photo-frame { width: 268px; height: 355px; }
.login .form-col    { padding: 50px 100px 20px 60px; }
.login .form-field label { font-size: 1.35rem; min-width: 150px; }
.login .form-field input { max-width: 480px; }
.login .forgot { padding-left: calc(150px + 28px); }

/* ══ REGISTER SPECIFIC ══ */
.register .photo-frame { width: 268px; height: 390px; }
.register .form-col    { padding: 40px 100px 20px 60px; }
.register .form-field label { font-size: 1.25rem; min-width: 138px; }
.register .form-field input { max-width: 480px; }
.register .submit-row { max-width: calc(138px + 28px + 480px); }

/* ══ RESPONSIVE ══ */
@media (max-width: 1024px) {
  .login .form-col    { padding: 40px 60px 20px 40px; }
  .register .form-col { padding: 30px 60px 20px 40px; }
}

@media (max-width: 900px) {
  .upper { grid-template-columns: 260px 1fr; }
  .photo-col { padding-left: 24px; }
  .login .photo-frame    { width: 224px; height: 296px; }
  .register .photo-frame { width: 224px; height: 324px; }
  .login .form-col       { padding: 40px 32px 20px 40px; }
  .register .form-col    { padding: 32px 32px 20px 40px; }
  .login .form-field label    { font-size: 1.1rem; min-width: 120px; }
  .register .form-field label { font-size: 1rem;   min-width: 110px; }
  .login .forgot { padding-left: calc(120px + 28px); }
}

@media (max-width: 640px) {

  /* ── Topbar: keep logo + back on one line ── */
  .topbar {
    padding: 12px 18px;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .logo-name { font-size: 1.25rem; }
  .logo-brain { width: 46px; height: 46px; }
  .topbar__back { font-size: .68rem; white-space: nowrap; }

  /* ── Stack layout ── */
  .upper { grid-template-columns: 1fr; }

  /* ── Photo: full width, taller, no white card look ── */
  .photo-col {
    padding: 28px 24px 0;
    display: flex;
    justify-content: center;
  }
  .login .photo-frame,
  .register .photo-frame {
    width: 100%;
    max-width: 360px;
    height: 260px;
    border-radius: 20px;
  }
  .photo-frame img {
    object-position: center 20%;
  }
  .photo-btn {
    bottom: 20px;
    font-size: .95rem;
    padding: 12px 44px;
  }

  /* ── Form: full width, comfortable padding ── */
  .login .form-col,
  .register .form-col {
    padding: 32px 24px 20px;
  }

  /* ── Fields: label above input, full width ── */
  .form-field {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
    align-items: flex-start;
  }
  .form-field label {
    text-align: left !important;
    min-width: unset !important;
    font-size: 1rem !important;
    letter-spacing: .1em;
  }
  .form-field input {
    width: 100%;
    max-width: 100% !important;
    font-size: 1rem;
    padding: 8px 2px;
  }

  /* ── Forgot / submit full width ── */
  .login .forgot { padding-left: 0; }
  .register .submit-row { max-width: 100%; justify-content: center; }
  .submit-btn { width: 100%; text-align: center; }

  /* ── Map ── */
  .world-map { margin-top: -10px; }
}

@media (max-width: 400px) {
  .logo-name { font-size: 1.1rem; }
  .logo-brain { width: 40px; height: 40px; }
  .topbar__back { font-size: .62rem; }
}


/* ══════════════════════════════════════════
   VALIDATION STYLES (register.html)
══════════════════════════════════════════ */

  /* ── Validation styles ── */
  .input-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: 100%;
    width: 100%;
  }

  .input-wrap input {
    /* inherit existing styles from auth.css */
    width: 100%;
  }

  .field-error {
    display: none;
    font-family: 'Montserrat', sans-serif;
    font-size: .75rem;
    font-weight: 600;
    color: #c0392b;
    letter-spacing: .02em;
    animation: errShake .3s ease;
  }

  .form-field.has-error .field-error {
    display: block;
  }

  .form-field.has-error input {
    border-bottom-color: #c0392b !important;
    border-bottom-style: solid !important;
  }

  .form-field.has-error label {
    color: #c0392b;
  }

  .form-field.is-valid input {
    border-bottom-color: #27ae60 !important;
    border-bottom-style: solid !important;
  }

  @keyframes errShake {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
  }

  /* Phone: hide spin arrows */
  input[type=tel]::-webkit-inner-spin-button,
  input[type=tel]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ══ Password field with eye toggle ══ */

/* input-wrap inside password field must stretch to fill form row */
#field-password .input-wrap,
#field-confirm  .input-wrap {
  flex: 1;
  width: 100%;
  max-width: 480px;   /* same as other inputs in desktop */
}

.password-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  border-bottom: 2px dashed var(--salmon);
  transition: border-color .2s, border-style .2s;
}

.password-wrap input {
  border-bottom: none !important;
  flex: 1;
  width: 100% !important;
  max-width: 100% !important;
  padding-right: 6px;
}

.password-wrap:focus-within {
  border-bottom-color: var(--brown);
  border-bottom-style: solid;
}

.form-field.has-error .password-wrap {
  border-bottom-color: #c0392b !important;
  border-bottom-style: solid !important;
}

.form-field.is-valid .password-wrap {
  border-bottom-color: #27ae60 !important;
  border-bottom-style: solid !important;
}

/* Override: when password-wrap is used, input border handled by wrap */
.form-field.has-error .password-wrap input,
.form-field.is-valid  .password-wrap input {
  border-bottom: none !important;
}

.eye-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  color: var(--salmon);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color .2s;
}
.eye-btn:hover { color: var(--brown); }

.eye-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Mobile: password fields full width */
@media (max-width: 640px) {
  #field-password .input-wrap,
  #field-confirm  .input-wrap {
    max-width: 100%;
    width: 100%;
  }
  .password-wrap {
    width: 100%;
  }
}
