/* auth.css */

@import url('general.css');

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

body {
  background: var(--color-page-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
}

/* ════════════════════════════════════════════════════════════════
   PAGE
════════════════════════════════════════════════════════════════ */
.auth-page {
  height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ════════════════════════════════════════════════════════════════
   AUTH CARD  — two-column split
════════════════════════════════════════════════════════════════ */
.auth-card {
  display: grid;
  grid-template-columns: 1fr 360px;
  width: 100%;
  max-width: 900px;
  min-height: 560px;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .10);
  overflow: hidden;
  background: var(--color-surface);
}

/* ── LEFT: form panel ────────────────────────────────────────── */
.auth-panel--form {
  padding: 2.5rem 2.5rem 2rem;
  overflow-y: auto;
  max-height: 90vh;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-dark) transparent;
  position: relative;
}

/* ── RIGHT: promo panel ──────────────────────────────────────── */
.auth-panel--promo {
  background: linear-gradient(145deg, var(--color-primary) 0%, #1e40af 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  position: relative;
  overflow: hidden;
}

/* Decorative circles in promo */
.auth-panel--promo::before,
.auth-panel--promo::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
}

.auth-panel--promo::before {
  width: 280px;
  height: 280px;
  top: -60px;
  right: -80px;
}

.auth-panel--promo::after {
  width: 200px;
  height: 200px;
  bottom: -50px;
  left: -60px;
}

/* ════════════════════════════════════════════════════════════════
   PANES  — signin / signup slide
════════════════════════════════════════════════════════════════ */
.auth-pane {
  display: none;
  animation: paneIn .25s ease;
}

/* Show the pane matching the card's current form */
[data-form="signin"] #js-signin-pane,
[data-form="signup"] #js-signup-pane {
  display: block;
}

@keyframes paneIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-pane__header {
  margin-bottom: 1.5rem;
}

.auth-pane__title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-pane__sub {
  font-size: .875rem;
  color: var(--color-text-muted);
}

/* ════════════════════════════════════════════════════════════════
   ALERTS
════════════════════════════════════════════════════════════════ */
.auth-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .84rem;
  font-weight: 500;
}

.auth-alert i {
  flex-shrink: 0;
  margin-top: 1px;
}

.auth-alert--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

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

/* ════════════════════════════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════════════════════════════ */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1rem;
}

.field:last-of-type {
  margin-bottom: 0;
}

.label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--color-text-body);
}

.field__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field__link {
  font-size: .78rem;
  color: var(--color-primary);
  text-decoration: none;
}

.field__link:hover {
  text-decoration: underline;
}

/* Input with icon */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap__icon {
  position: absolute;
  left: 14px;
  font-size: .8rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

.input-wrap .input {
  padding-left: 38px;
}

.input-wrap__eye {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: .85rem;
  padding: 4px;
  transition: color .15s;
}

.input-wrap__eye:hover {
  color: var(--color-primary);
}

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: .875rem;
  color: var(--color-text-primary);
  background: var(--color-surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.input::placeholder {
  color: var(--color-text-muted);
}

.input-wrap--password .input {
  padding-right: 40px;
}

/* Submit button */
.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.25rem;
  transition: background .15s, transform .15s;
}

.btn-submit:hover {
  background: var(--color-primary-dark);
}

.btn-submit:active {
  transform: scale(.98);
}

/* Switch link */
.auth-switch {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .84rem;
  color: var(--color-text-muted);
}

.auth-switch__btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary);
  font-weight: 600;
  font-size: .84rem;
  padding: 0;
  transition: color .15s;
}

.auth-switch__btn:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* ════════════════════════════════════════════════════════════════
   FILE UPLOAD BOXES
════════════════════════════════════════════════════════════════ */
.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.upload-box {
  position: relative;
  cursor: pointer;
  border: 2px dashed var(--color-border-dark);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .15s, background .15s;
  aspect-ratio: 1 / 1;
}

.upload-box:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.upload-box.has-file {
  border-style: solid;
  border-color: var(--color-primary);
}

.upload-box__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.upload-box__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  pointer-events: none;
}

.upload-box__icon-wrap {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--color-primary-light);
  margin-bottom: 4px;
  overflow: hidden;
}

.upload-box__placeholder-icon {
  font-size: 1.4rem;
  color: var(--color-primary);
}

.upload-box__placeholder-icon.is-pdf {
  color: #dc2626;
}

.upload-box__preview,
.upload-box__current {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: none;
  /* hidden by default */
  z-index: 1;
}

.upload-box__preview[src]:not([src=""]) {
  display: block;
}

.upload-box__label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.upload-box__sub {
  font-size: .68rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.upload-box.has-file .upload-box__sub {
  display: none;
}

/* ── Phone wrap — container for intlTelInput ────────────────── */
.phone-wrap {
  width: 100%;
}

.phone-wrap .iti {
  width: 100%;
}

/* iti renders its own border — make the input inside look like .input */
.phone-wrap .input {
  padding-left: 52px;
  /* space for flag */
  width: 100%;
}

.phone-wrap .iti--separate-dial-code .input {
  padding-left: 94px;
  /* space for flag + dial code */
}

/* ════════════════════════════════════════════════════════════════
   PROMO PANEL CONTENT
════════════════════════════════════════════════════════════════ */
.promo {
  text-align: center;
  color: #fff;
  position: relative;
  z-index: 1;
  animation: paneIn .3s ease;
}

.promo__badge {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 1.6rem;
}

.promo__title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: .75rem;
  line-height: 1.3;
}

.promo__text {
  font-size: .875rem;
  opacity: .85;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.promo__btn {
  padding: 12px 28px;
  border-radius: 50px;
  background: #fff;
  color: var(--color-primary);
  border: none;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}

.promo__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.promo__btn:active {
  transform: scale(.97);
}

.edit_profile-card {
  grid-template-columns: 1fr 280px;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════ */

/* Stack vertically on tablet — promo goes on top */
@media (max-width: 768px) {
  .auth-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    max-width: 480px;
    border-radius: 16px;
  }

  /* Promo becomes a slim banner at the top */
  .auth-panel--promo {
    order: -1;
    padding: 1.5rem 1.5rem;
    min-height: 160px;
  }

  .auth-panel--promo::before,
  .auth-panel--promo::after {
    display: none;
  }

  .auth-panel--form {
    padding: 1.75rem 1.5rem 1.5rem;
    max-height: none;
  }

  .promo__badge {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    margin-bottom: .75rem;
    border-radius: 12px;
  }

  .promo__title {
    font-size: 1.1rem;
    margin-bottom: .4rem;
  }

  .promo__text {
    display: none;
  }

  .promo__btn {
    padding: 8px 22px;
    font-size: .82rem;
  }
}

/* Phone */
@media (max-width: 480px) {
  .auth-page {
    padding: .75rem .5rem;
    align-items: flex-start;
  }

  .auth-card {
    border-radius: 12px;
    min-height: auto;
  }

  .auth-panel--form {
    padding: 1.25rem 1rem 1.25rem;
  }

  .upload-row {
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
  }

  .auth-pane__title {
    font-size: 1.3rem;
  }
}

/* ── Inline field errors (from auth.js) ─────────────────────── */
.field-error {
  font-size: .76rem;
  font-weight: 500;
  color: #dc2626;
  margin-top: 2px;
}

.field-error[hidden] {
  display: none;
}

.input.is-invalid {
  border-color: #ef4444;
}

.input.is-invalid:focus {
  box-shadow: 0 0 0 3px #fee2e2;
}

.upload-box.is-invalid {
  border-color: #ef4444;
  background: #fef2f2;
}

.iti {
  width: 100%;
}

.iti__country {
  padding: 10px;
}

.iti__country-list--dropup {
  top: 100%;
  bottom: auto;
  margin-bottom: 0;
}

.iti__country-list {
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: var(--main-background-color);
  border: 1px solid var(--background-color-dark);
  border-radius: 8px;
  max-height: 150px;
  width: 300px;
  left: 0;
  white-space: normal;
}

.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag {
  background-color: var(--background-color);
}

.iti--separate-dial-code .iti__selected-flag {
  background-color: var(--background-color);
  border-radius: 8px 0 0 8px;
}

.iti__country.iti__highlight {
  background-color: var(--background-color);
}

.container {
  width: 100%;
  margin: 10px 0 20px;
}

@media (max-width: 480px) {

  .form-container,
  .promo-container {
    padding: 15px;
  }

  .iti__country-list {
    width: 270px;
  }
}
