/* auth.css — Premium, atmospheric design system for Herely Auth sub-project */

:root {
  --bg: #F7F6F3;
  --bg-2: #EFEDE7;
  --ink: #0B0B0D;
  --ink-2: #1B1B1F;
  --mute: #6B6B70;
  --mute-2: #A8A8A8;
  --line: rgba(11, 11, 13, 0.10);
  --line-2: rgba(11, 11, 13, 0.06);

  /* Mood signals - used to accent interactives */
  --m-blue: #3A7FCC;
  --m-amber: #F5A623;
  --m-teal: #00C49A;
  --m-coral: #FF6B6B;
  --m-grey: #A8A8A8;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

/* Midnight mode rules */
.midnight, html.midnight, body.midnight {
  --bg: #0B0B0D;
  --bg-2: #131316;
  --ink: #F4F2EE;
  --ink-2: #E7E4DE;
  --mute: #8A8A90;
  --mute-2: #5C5C61;
  --line: rgba(255, 255, 255, 0.10);
  --line-2: rgba(255, 255, 255, 0.06);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(58, 127, 204, 0.20);
  color: inherit;
}

/* ─── Layout primitives ─── */
.auth-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(100% 70% at 50% 30%, transparent 40%, var(--bg) 100%),
              linear-gradient(180deg, transparent 50%, var(--bg) 100%);
}

.auth-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-size: 18px;
  margin-bottom: 28px;
  cursor: default;
  animation: logo-in 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.auth-logo .mark {
  width: 20px;
  height: 20px;
  position: relative;
  display: inline-block;
}

.auth-logo .mark::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.25px solid var(--ink);
  border-radius: 50%;
  transition: border-color 0.4s ease;
}

.auth-logo .mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--m-teal);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--m-teal) 18%, transparent);
}

/* ─── Auth Cards (Glassmorphism) ─── */
.auth-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset,
              0 30px 80px rgba(11, 11, 13, 0.08),
              0 4px 12px rgba(11, 11, 13, 0.02);
  overflow: hidden;
  padding: 36px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.midnight .auth-card {
  background: color-mix(in oklab, #131316 88%, transparent);
  border-color: var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset,
              0 30px 80px rgba(0, 0, 0, 0.5);
}

/* ─── Typography overrides ─── */
.auth-header {
  margin-bottom: 24px;
}

.auth-title {
  font-size: clamp(24px, 2.5vw, 32px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 8px;
}

.auth-title .ed {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--mute);
  line-height: 1.45;
  margin: 0;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mute);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.eyebrow::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .6;
}

/* ─── Form elements ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 500;
}

.form-control-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.form-control {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 400;
  background: rgba(11, 11, 13, 0.02);
  border: 1px solid var(--line);
  color: var(--ink);
  outline: none;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.midnight .form-control {
  background: rgba(255, 255, 255, 0.02);
}

.form-control::placeholder {
  color: var(--mute);
  opacity: 0.5;
}

.form-control:hover {
  border-color: var(--mute);
}

.form-control:focus {
  border-color: var(--m-blue);
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--m-blue) 14%, transparent);
}

.midnight .form-control:focus {
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--m-blue) 18%, transparent);
}

/* Password toggler */
.pass-toggle-btn {
  position: absolute;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--mute);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  opacity: 0.65;
  transition: opacity 0.2s, color 0.2s;
}

.pass-toggle-btn:hover {
  opacity: 1;
  color: var(--ink);
}

/* Error States */
.has-error .form-control {
  border-color: var(--m-coral) !important;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--m-coral) 12%, transparent) !important;
}

.field-error-msg {
  font-size: 12px;
  color: var(--m-coral);
  margin-top: 4px;
}

/* Remember me & Forgot Pass row */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 13.5px;
}

.checkbox-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: default;
  user-select: none;
  color: var(--ink-2);
}

.checkbox-custom {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(11, 11, 13, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.midnight .checkbox-custom {
  background: rgba(255, 255, 255, 0.02);
}

input[type="checkbox"] {
  display: none;
}

input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--ink);
  border-color: var(--ink);
}

input[type="checkbox"]:checked + .checkbox-custom::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid var(--bg);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.text-link {
  color: var(--mute);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.text-link:hover {
  color: var(--ink);
}

/* ─── Password Strength indicator ─── */
.pwd-strength-container {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pwd-strength-bar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  height: 3px;
  width: 100%;
}

.pwd-strength-segment {
  border-radius: 10px;
  background: var(--line-2);
  transition: background-color 0.4s ease;
}

.pwd-strength-segment.active-weak { background: var(--m-coral); }
.pwd-strength-segment.active-fair { background: var(--m-amber); }
.pwd-strength-segment.active-strong { background: var(--m-teal); }

.pwd-strength-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mute);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  cursor: default;
  text-decoration: none;
  justify-content: center;
  transition: transform .25s ease, background .25s ease, color .25s ease, border-color .25s ease, opacity .25s ease, box-shadow .25s ease;
  user-select: none;
}

.btn .arrow {
  width: 14px;
  height: 14px;
  display: inline-block;
  transition: transform .25s ease;
}

.btn:hover .arrow {
  transform: translateX(3px);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: color-mix(in oklab, var(--ink) 90%, white);
  box-shadow: 0 10px 24px rgba(11, 11, 13, 0.12);
}

.midnight .btn-primary:hover {
  background: color-mix(in oklab, var(--ink) 90%, black);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.btn-primary:disabled {
  opacity: 0.45;
  transform: none !important;
  box-shadow: none !important;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: rgba(11, 11, 13, 0.03);
}

.midnight .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--ink);
}

.btn-full {
  width: 100%;
}

/* ─── Social Login Divider ─── */
.social-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 28px 0;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.social-divider::before,
.social-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--line-2);
}

.social-divider:not(:empty)::before {
  margin-right: 16px;
}

.social-divider:not(:empty)::after {
  margin-left: 16px;
}

.social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.btn-social {
  height: 44px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13.5px;
  border-radius: 12px;
  font-weight: 500;
  gap: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: background-color 0.2s, border-color 0.2s;
}

.btn-social:hover {
  border-color: var(--ink);
  background: rgba(11, 11, 13, 0.03);
}

.midnight .btn-social:hover {
  background: rgba(255, 255, 255, 0.04);
}

.btn-social svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ─── Auth Card Footer ─── */
.auth-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 13.5px;
  color: var(--mute);
}

.auth-footer .text-link {
  margin-left: 5px;
}

/* ─── OTP Grid ─── */
.otp-input-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.otp-box {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  text-align: center;
  background: rgba(11, 11, 13, 0.02);
  border: 1px solid var(--line);
  color: var(--ink);
  outline: none;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.midnight .otp-box {
  background: rgba(255, 255, 255, 0.02);
}

.otp-box:hover {
  border-color: var(--mute);
}

.otp-box:focus {
  border-color: var(--m-blue);
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--m-blue) 14%, transparent);
}

.midnight .otp-box:focus {
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--m-blue) 18%, transparent);
}

.otp-timer {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
  text-align: center;
}

.otp-timer .time {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 500;
}

/* ─── Mode toggle button inside Auth Card ─── */
.auth-viewport .mode-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 100;
}

.auth-viewport .mode-toggle:hover {
  background: rgba(11, 11, 13, 0.04);
  border-color: var(--ink);
}

.auth-viewport.midnight .mode-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ─── Animations & Screen Transitions ─── */
.fade-in {
  animation: auth-fade-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.fade-out {
  animation: auth-fade-out 0.4s ease-in both;
}

@keyframes auth-fade-in {
  0% { opacity: 0; transform: translateY(14px); filter: blur(6px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes auth-fade-out {
  0% { opacity: 1; transform: translateY(0); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-10px); filter: blur(6px); }
}

@keyframes logo-in {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ─── Loader & Shimmer states ─── */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );
  animation: shimmer-anim 1.8s infinite linear;
}

@keyframes shimmer-anim {
  100% { transform: translateX(100%); }
}

/* Success Checkmark visual */
.success-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.success-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--m-teal) 12%, transparent);
  border: 1.5px solid var(--m-teal);
  color: var(--m-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 0 20px color-mix(in oklab, var(--m-teal) 22%, transparent);
  animation: success-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes success-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-circle svg {
  width: 24px;
  height: 24px;
}

/* Adaptive mobile layout adjustments */
@media (max-width: 480px) {
  .auth-card {
    padding: 24px;
    border-radius: 20px;
  }
  .auth-wrapper {
    padding: 16px;
  }
  .social-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
