/* app/assets/stylesheets/devise.css */

/* ────────────────────────────────────────────────────────────────
   Sonic Devise Auth Theme (matches React/MUI dark glass + brand)
   ──────────────────────────────────────────────────────────────── */

:root {
  --bg-default: #111217;
  --bg-paper: #282a2c;
  --metallic-dark: #161c26;

  --brand: #d7f542;

  --text: #e9eaef;
  --text-muted: rgba(233, 234, 239, 0.72);

  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  --glass-bg: rgba(20, 20, 20, 0.45);
  --glass-bg-2: rgba(20, 20, 20, 0.25);

  --error-bg: rgba(198, 49, 14, 0.15);
  --error-border: rgba(198, 49, 14, 0.35);
  --error-text: #ffb4a2;
}

/* ───────────────── Base reset ───────────────── */

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  height: 100%;
  margin: 0;
}

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

body {
  font-family: sans-serif;
  font-optical-sizing: auto;
  font-weight: 300;
  font-style: normal;
  color: var(--text);
  background:
          radial-gradient(1200px 600px at 20% 0%,
          rgba(215, 245, 66, 0.08),
          rgba(0, 0, 0, 0) 55%),
          var(--bg-default);
}

.devise-body {
  font-family: sans-serif;
  font-weight: 300;
  color: var(--text);
  background:
          radial-gradient(1200px 600px at 20% 0%,
          rgba(215, 245, 66, 0.08),
          rgba(0, 0, 0, 0) 55%),
          var(--bg-default);
}

/* ───────────────── Typography ───────────────── */

h1,
h2,
h3,
h4,
h5 {
  font-family: sans-serif;
  font-weight: 800;
  margin-top: 0;
  color: var(--text);
}

.text {
  font-size: 14px;
  color: var(--text-muted);
}

.text a {
  color: var(--brand);
  text-decoration: none;
}

.text a:hover {
  text-shadow: 0 0 8px var(--brand);
  font-weight: 400;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-shadow: 0 0 8px var(--brand);
  font-weight: 400;
}

/* ───────────────── Layout helpers ───────────────── */

.container {
  /* Use 100vh to ensure it fills the screen */
  min-height: 100vh;

  /* Switch to Flexbox for safer overflow handling */
  display: flex;
  flex-direction: column;
  align-items: center;

  /* Standard padding */
  padding: 24px;

  /* CRITICAL: Add extra top padding to reserve space for the floating logo.
     The logo is positioned -78px above the card.
     100px ensures it's never cut off, even on small screens. */
  padding-top: 100px;
}

.container > .card {
  /* 'margin: auto' in Flexbox centers the item vertically & horizontally
     when there is space. If the card grows taller than the screen,
     it safely aligns to the top (respecting the container padding)
     and lets you scroll. */
  margin: auto;
}

.mb24 { margin-bottom: 24px; }
.mb32 { margin-bottom: 32px; }
.mt8  { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.mt32 { margin-top: 32px; }
.mt38 { margin-top: 38px; }
.center { text-align: center; }

.flex-container {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.flex-1 { flex: 1; }

/* ───────────────── Glass card ───────────────── */

.card {
  position: relative;
  overflow: visible;
  margin-top: 64px;
  width: min(520px, 100%);
  max-width: 100%;
  padding: 32px;
  border-radius: 25px;

  background: var(--glass-bg);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);

  border: 1px solid var(--border);
  box-shadow:
          inset 0 0 0 1px rgba(255, 255, 255, 0.14),
          inset 0 0 18px rgba(255, 255, 255, 0.08),
          0 14px 40px rgba(0, 0, 0, 0.35);
}

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
          circle at 20% 10%,
          rgba(255,255,255,0.18),
          rgba(255,255,255,0.03) 40%,
          rgba(255,255,255,0.00) 70%
  );
  opacity: 0.9;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card::after {
  content: "";
  position: absolute;
  top: -78px;
  left: 0;
  right: 0;
  margin: auto;

  width: 200px;
  height: 50px;

  background-image: url("/assets/sonic_logo-1377ad58.avif");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;

  pointer-events: none;
  transform: translateX(-8px);
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.6));
}

.card h2 {
  margin-bottom: 24px;
}

/* ───────────────── Outlined input (pill / glass) ───────────────── */

.outlined-input {
  position: relative;
  width: 100%;
  display: flex;
  margin-bottom: 25px
}

.outlined-input input {
  flex: 1;
  height: 48px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--glass-bg-2);

  color: var(--text);
  padding: 0 22px;

  outline: none;
  transition: 0.18s ease;
}

.outlined-input input::placeholder {
  color: transparent;
}

.outlined-input input[readonly] {
  color: rgba(233, 234, 239, 0.45);
  border-color: rgba(255, 255, 255, 0.14);
}

.outlined-input label {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);

  color: var(--text-muted);
  transition: 0.18s ease;

  font-size: 1rem;
  pointer-events: none;

  padding: 0 6px;
  border-radius: 10px;
}

.outlined-input:has(.field_with_errors input:not(:placeholder-shown)) label,
.outlined-input:has(.field_with_errors input:focus) label {
  top: -8px;
  left: 16px;
  font-size: 0.75rem;

  /* Make label red to match the error state */
  color: var(--error-text);

  box-shadow: none;
  text-shadow: none;
}

.outlined-input input:not(:placeholder-shown) ~ label,
.outlined-input input:focus ~ label {
  top: -13px;
  font-size: 15px;
  color: var(--brand);
  box-shadow: none;
  text-shadow: none;
  left: -7px;
}

.outlined-input input:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.outlined-input input:focus {
  border-color: rgba(215, 245, 66, 0.65);
  box-shadow: 0 0 0 4px rgba(215, 245, 66, 0.14);
}

.outlined-input label {
  text-shadow: none;
  filter: none;
}

.outlined-input {
  filter: none;
}

.outlined-input input:-webkit-autofill,
.outlined-input input:-webkit-autofill:hover,
.outlined-input input:-webkit-autofill:focus,
.outlined-input input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;

  /* Override the browser's injected background by painting the inside */
  -webkit-box-shadow: 0 0 0px 1000px var(--glass-bg-2) inset !important;
  box-shadow: 0 0 0px 1000px var(--glass-bg-2) inset !important;

  caret-color: var(--text);
  border: 1px solid var(--border-strong);
  transition: background-color 9999s ease-out 0s; /* prevents flash */
}

/* Firefox autofill */
.outlined-input input:autofill {
  box-shadow: 0 0 0px 1000px var(--glass-bg-2) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
}

/* ───────────────── Buttons (brand / glass) ───────────────── */

.button {
  height: 48px;
  border-radius: 999px;
  padding: 0 24px;
  width: 100%;
  display: block;

  /* Neutral premium surface (dark, transparent) */
  background-color: rgba(20, 20, 20, 0.65);
  border-color: rgba(215, 245, 66, 0.65);

  /* Text */
  color: #e9eaef;
  font-family: sans-serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.2px;
  text-transform: none;
  text-shadow: none;

  cursor: pointer;
  transition: 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  user-select: none;

  /* Reset background-image to prevent inheritance */
  background-image: none;
}

/* Glass Sheen (::before) */
.button::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0; /* Explicit inset replacement */
  border-radius: inherit;
  pointer-events: none;
  z-index: 1; /* Ensure sheen is ON TOP of the background color */

  /* Radial gradient from Brand variant (lime glow at top left) */
  background: radial-gradient(
          circle at 30% 0%,
          rgba(215, 245, 66, 0.38),
          rgba(255, 255, 255, 0.06) 40%,
          rgba(255, 255, 255, 0.00) 70%
  );

  opacity: 0.85;
  transform: translateY(-2px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Bottom Accent (::after) */
.button::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  /* tiny premium accent along bottom edge */
  box-shadow: inset 0 -2px 0 rgba(215, 245, 66, 0.55);
  opacity: 0.9;
}

.button:hover {
  background-color: rgba(20, 20, 20, 0.65);
  border-color: rgba(215, 245, 66, 0.65);
  box-shadow:
          0 14px 36px rgba(0, 0, 0, 0.65),
          0 0 0 1px rgba(215, 245, 66, 0.22),
          0 0 26px rgba(215, 245, 66, 0.25),
          inset 0 1px 0 rgba(255, 255, 255, 0.12),
          inset 0 -2px 0 rgba(215, 245, 66, 0.75);
}

.button:hover::before {
  opacity: 0.95;
  transform: translateY(-3px);
}

.button:active {
  transform: translateY(1px) scale(0.99);
  background-color: rgba(16, 16, 16, 0.70);
  border-color: rgba(215, 245, 66, 0.55);
}

.button:focus-visible {
  outline: 2px solid rgba(215, 245, 66, 0.55);
  outline-offset: 2px;
  box-shadow:
          0 0 0 4px rgba(215, 245, 66, 0.14),
          0 14px 36px rgba(0, 0, 0, 0.60);
}

/* ───────────────── Google / Secondary Button ───────────────── */

.button.google {
  /* Override background to be dark/glassy */
  background: rgba(22, 28, 38, 0.6); /* --metallic-dark base */
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Remove the metallic top sheen/accent for the Google button */
.button.google::before {
  display: none;
}
.button.google::after {
  display: none;
}

/* Google Icon */
.button.google {
  background-image: url("/identity/google_icon.svg");
  background-repeat: no-repeat;
  background-position: 16px center;
  background-size: 24px 24px;
  padding-left: 48px;
}

.button.google:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--text-muted);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
  color: #fff;
}

.button.google:active {
  background-color: rgba(255, 255, 255, 0.05);
  transform: translateY(1px);
}

/* ───────────────── Errors ───────────────── */
.errors {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  padding: 12px 16px;
  border-radius: 12px;
}

.helper-text {
  color: var(--text-muted);
  font-size: 14px;
}

.field_with_errors {
  display: contents;
}
.field_with_errors input {
  border: 1px solid var(--error-border);
  box-shadow: 0 0 0 1px var(--error-text);
}

#error_explanation {

  h3{
    color: var(--error-text);
  }
  color: var(--error-text);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 26px;
  border: 1px solid var(--error-border);
  background-color: var(--error-bg);
}

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

@media (max-width: 600px) {
  html, body {
    height: auto;
  }

  .container {
    min-height: 100dvh;      /* better mobile viewport unit */
    padding-top: 110px;      /* reserve space for the floating logo */
    overflow-y: auto;
  }

  /* don't vertically center the card on mobile (prevents top clipping) */
  .container > .card {
    margin: 0;               /* was margin: auto */
  }

  /* optionally reduce how far the logo sits above the card */
  .card::after {
    top: -68px;              /* was -68px in your mobile rule */
  }
}