/* ==========================================================================
   Darsely — Auth pages (create account + login)
   Depends on tokens from layout.css
   ========================================================================== */

body.auth-page {
  background: var(--ds-bg);
}

body.auth-page::after {
  display: none;
}

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  min-height: 100vh;
  padding-top: var(--ds-header-h);
}

/* ─── Form side ──────────────────────────────────────────────────────────── */

.auth__form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 5vw, 64px) var(--ds-gutter);
  background:
    radial-gradient(600px 400px at 100% 0%, rgba(101, 220, 213, 0.18), transparent 70%),
    var(--ds-bg);
}

.auth-card {
  width: 100%;
  max-width: 620px;
  padding: clamp(24px, 4vw, 44px);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 28px;
  box-shadow: var(--ds-shadow-md);
}

.auth-card--narrow {
  max-width: 480px;
}

.auth-card__head {
  margin-bottom: 28px;
}

.auth-card__icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  font-size: 22px;
  color: #fff;
  background: linear-gradient(135deg, var(--ds-primary), var(--ds-primary-2));
  box-shadow: 0 10px 24px rgba(50, 30, 72, 0.25);
}

.auth-card__head h1 {
  color: var(--ds-ink);
  font-weight: 900;
  font-size: clamp(26px, 3vw, 32px);
  margin: 0 0 6px;
}

.auth-card__head p {
  color: var(--ds-muted);
  font-size: 15px;
  margin: 0;
}

/* Fields */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  margin-bottom: 18px;
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--ds-ink);
  font-weight: 700;
  font-size: 14px;
}

.field__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.field__label-row label {
  margin-bottom: 0;
}

.field__label-row a {
  color: var(--ds-primary-2);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none !important;
}

.field__label-row a:hover {
  color: var(--ds-accent-ink);
}

.field__control {
  position: relative;
}

.field__icon {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: #9a97ab;
  font-size: 15px;
  pointer-events: none;
  transition: color 0.2s ease;
}

.field input,
.field select {
  display: block;
  width: 100%;
  height: 52px;
  padding: 0 46px 0 16px;
  border: 1.5px solid #e4e2ec;
  border-radius: 14px;
  background-color: #fbfbfd;
  color: var(--ds-ink);
  font-family: "Cairo", sans-serif;
  font-weight: 600;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.field input[dir="ltr"] {
  text-align: right;
  letter-spacing: 0.5px;
}

.field input::placeholder {
  color: #a9a6b8;
  font-weight: 500;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6880' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
}

.field select.is-placeholder {
  color: #a9a6b8;
  font-weight: 500;
}

.field select option {
  color: var(--ds-ink);
}

.field input:hover,
.field select:hover {
  border-color: #cfcbdc;
}

.field input:focus,
.field select:focus {
  background-color: #fff;
  border-color: var(--ds-primary-2);
  box-shadow: 0 0 0 4px rgba(67, 99, 126, 0.12);
}

.field__control:focus-within .field__icon {
  color: var(--ds-primary-2);
}

.field.is-invalid input,
.field.is-invalid select {
  border-color: #d93a3a;
  background-color: #fffafa;
  box-shadow: 0 0 0 4px rgba(217, 58, 58, 0.08);
}

.field.is-invalid .field__icon {
  color: #d93a3a;
}

.field__toggle {
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #8a879c;
  cursor: pointer;
}

.field__toggle:hover {
  color: var(--ds-primary);
  background: var(--ds-bg);
}

.field__control:has(.field__toggle) input {
  padding-left: 50px;
}

/* Password strength */
.strength {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.strength span {
  height: 4px;
  border-radius: 4px;
  background: #ebe9f1;
  transition: background 0.25s ease;
}

.strength[data-level="1"] span:nth-child(1) { background: #e5484d; }
.strength[data-level="2"] span:nth-child(-n + 2) { background: #f5a524; }
.strength[data-level="3"] span { background: #17a673; }

/* Error */
.auth-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: #fff1f1;
  border: 1px solid #ffd4d4;
  color: #b42323;
  font-weight: 700;
  font-size: 14px;
}

.auth-error::before {
  content: "\f06a";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

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

/* Submit */
.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--ds-primary), var(--ds-primary-2));
  box-shadow: 0 14px 30px rgba(50, 30, 72, 0.25);
  font-family: "Cairo", sans-serif;
  font-weight: 800;
  font-size: 17px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(50, 30, 72, 0.32);
}

.auth-submit:focus-visible {
  outline: 3px solid var(--ds-accent);
  outline-offset: 2px;
}

.auth-submit:disabled {
  opacity: 0.75;
  cursor: progress;
}

.auth-submit.is-loading :is(i, svg) {
  animation: auth-spin 0.8s linear infinite;
}

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

.auth-terms {
  margin: 14px 0 0;
  text-align: center;
  color: var(--ds-muted);
  font-size: 13px;
}

.auth-terms a,
.auth-switch a {
  color: var(--ds-primary);
  font-weight: 800;
  text-decoration: none !important;
}

.auth-terms a:hover,
.auth-switch a:hover {
  color: var(--ds-accent-ink);
}

.auth-switch {
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--ds-line);
  text-align: center;
  color: var(--ds-text);
  font-weight: 600;
  font-size: 15px;
}

/* ─── Brand side ─────────────────────────────────────────────────────────── */

.auth__brand-side {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: clamp(40px, 5vw, 72px);
  background: linear-gradient(160deg, var(--ds-primary) 0%, #2b3f5c 55%, #0e7c76 100%);
  color: #fff;
}

.auth__brand-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 22px 22px;
}

.auth__brand-side::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  left: -140px;
  bottom: -140px;
  background: rgba(101, 220, 213, 0.3);
  filter: blur(40px);
}

.auth-brand {
  position: relative;
  z-index: 1;
  max-width: 480px;
}

.auth-brand__logo {
  height: 60px;
  width: auto;
  margin-bottom: 36px;
}

.auth-brand h2 {
  color: #fff;
  font-weight: 900;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.35;
  margin: 0 0 14px;
}

.auth-brand h2 span {
  color: var(--ds-accent);
}

.auth-brand > p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 17px;
  line-height: 1.8;
  margin: 0 0 32px;
}

.auth-brand__list {
  list-style: none;
  margin: 0 0 36px;
  padding: 0;
  display: grid;
  gap: 14px;
}

.auth-brand__list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-brand__list .ico {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--ds-accent);
  color: var(--ds-ink);
  font-size: 18px;
}

.auth-brand__list strong {
  display: block;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.auth-brand__list span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.auth-brand__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 24px;
}

.auth-brand__stats div + div {
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  padding-right: 20px;
}

.auth-brand__stats strong {
  display: block;
  color: #fff;
  font-size: 26px;
  font-weight: 900;
}

.auth-brand__stats span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1099px) {
  .auth {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .auth__brand-side {
    display: none;
  }
}

@media (max-width: 575px) {
  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .auth-card {
    border-radius: 22px;
  }
}
