/* Auth layout and visual polish */
body[data-auth-page] {
  min-height: 100vh;
  margin: 0;
  background-color: #f2f5fd;
  background-image:
    radial-gradient(ellipse at 12% 18%, rgba(197, 179, 245, 0.45) 0%, transparent 40%),
    radial-gradient(ellipse at 88% 82%, rgba(255, 229, 107, 0.45) 0%, transparent 42%),
    radial-gradient(circle at 50% 50%, rgba(154, 200, 255, 0.3) 0%, transparent 60%),
    url("../images/polka-dots.svg");
  background-size: 100% 100%, 100% 100%, 100% 100%, 24px 24px;
  position: relative;
  overflow-x: hidden;
}

/* Floating Corner Accents in Viewport */
body[data-auth-page]::before {
  content: "✦";
  position: fixed;
  top: 36px;
  left: 4%;
  font-size: 64px;
  line-height: 1;
  color: #ffe56b;
  -webkit-text-stroke: 3px var(--ink);
  filter: drop-shadow(4px 4px 0 var(--ink));
  transform: rotate(18deg);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

body[data-auth-page]::after {
  content: "✳";
  position: fixed;
  bottom: 32px;
  right: 4%;
  font-size: 58px;
  line-height: 1;
  color: var(--lavender, #c5b3f5);
  -webkit-text-stroke: 3px var(--ink);
  filter: drop-shadow(4px 4px 0 var(--ink));
  transform: rotate(-14deg);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.auth-wrap {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* Decorative floating badges around the auth container */
.auth-wrap::before {
  content: "GRAPERU ✦ OFFICIAL";
  position: absolute;
  top: 18px;
  right: 28px;
  background: #ffe56b;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
  transform: rotate(4deg);
  pointer-events: none;
  user-select: none;
}

.auth-wrap::after {
  content: "BẢO HÀNH CHU ĐÁO ✓";
  position: absolute;
  bottom: 22px;
  left: 28px;
  background: #ffffff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.6px;
  transform: rotate(-3deg);
  pointer-events: none;
  user-select: none;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 10px;
  background: #ffffff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.2px;
  text-decoration: none;
  margin-bottom: 24px;
  cursor: pointer;
  user-select: none;
  width: fit-content;
  min-height: 42px;
  box-sizing: border-box;
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.3, 1),
              box-shadow 0.14s ease,
              background-color 0.14s ease,
              color 0.14s ease;
}

.auth-back:hover {
  background-color: #ffe56b;
  color: var(--ink);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
  text-decoration: none;
}

.auth-back:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.auth-back:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.auth-back .back-arrow,
.auth-back-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: var(--lavender, #d6dbff);
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  flex-shrink: 0;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1),
              background-color 0.15s ease;
}

.auth-back:hover .back-arrow,
.auth-back:hover .auth-back-arrow {
  transform: translateX(-3px);
  background-color: #ffffff;
}

.auth-sub-back {
  margin-top: 16px;
  margin-bottom: 0;
  background-color: var(--ice, #eef2ff);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

.auth-brand {
  position: relative;
  background: var(--lavender);
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px 24px;
}

.auth-brand img {
  width: 90px;
  height: 90px;
  border: var(--line);
  border-radius: 18px;
  box-shadow: 6px 6px var(--ink);
  transform: rotate(-6deg);
}

.auth-brand h2 {
  font-size: clamp(22px, 3.5vw, 36px);
  line-height: 1.25;
  margin: 20px 0 14px;
  letter-spacing: -0.5px;
  overflow-wrap: break-word;
}

.auth-brand mark {
  background: #ffe56b;
  border: var(--line);
  border-radius: 0;
  line-height: 1.5;
  padding: 0 6px;
}

.auth-brand p {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  color: var(--ink);
}

.auth-panel {
  background: white;
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
  min-width: 0;
}

.auth-panel h1 {
  font-size: clamp(20px, 4vw, 28px);
  letter-spacing: -0.5px;
  margin: 0 0 10px;
  overflow-wrap: break-word;
}

.auth-panel p {
  font-size: 14px;
}

.auth-panel label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin: 16px 0 7px;
}

.auth-panel input {
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--page);
}

.password-wrap {
  display: flex;
  gap: 6px;
}

.password-wrap button {
  font-size: 12px;
  padding: 8px;
}

.auth-panel .wide {
  margin-top: 18px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  margin: 20px 0;
  font-size: 12px;
}

.auth-divider:before,
.auth-divider:after {
  content: "";
  height: 2px;
  flex: 1;
  background: var(--ink);
}

.google-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: white;
  padding: 12px;
  border: var(--line);
  box-shadow: 3px 3px var(--ink);
  border-radius: 6px;
  font-weight: 700;
}

.google-login svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.auth-switch a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 700;
}

.auth-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.auth-label-row label {
  margin-top: 0 !important;
}

.auth-panel button.auth-forgot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 3px 10px;
  background: #ffffff;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 1.5px 1.5px 0 var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.3;
  min-height: auto;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.12s ease;
}
.auth-panel button.auth-forgot:hover {
  background: var(--yellow);
  color: var(--ink);
  transform: translate(-1px, -1px);
  box-shadow: 2.5px 2.5px 0 var(--ink);
  text-decoration: none;
}
.auth-panel button.auth-forgot:active {
  transform: translate(1px, 1px);
  box-shadow: 0.5px 0.5px 0 var(--ink);
}

#auth-status {
  min-height: 22px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-weight: 700;
  color: var(--primary);
}

#auth-status[data-error="true"] {
  color: #9d2828;
}

.auth-panel button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.auth-account {
  overflow-wrap: anywhere;
}

.account-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

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

.auth-account-link {
  font-size: 13px;
  padding: 9px 12px;
  background: var(--ice);
  border: var(--line);
  border-radius: 6px;
  box-shadow: 3px 3px var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 700px) {
  body[data-auth-page]::before {
    font-size: 34px;
    top: 12px;
    left: 8px;
    -webkit-text-stroke: 2px var(--ink);
    filter: drop-shadow(2px 2px 0 var(--ink));
    opacity: 0.4;
  }
  body[data-auth-page]::after {
    font-size: 32px;
    bottom: 12px;
    right: 8px;
    -webkit-text-stroke: 2px var(--ink);
    filter: drop-shadow(2px 2px 0 var(--ink));
    opacity: 0.4;
  }
  .auth-wrap::before,
  .auth-wrap::after {
    display: none;
  }
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .auth-panel {
    padding: 20px;
  }
  .auth-panel h1 {
    font-size: 22px;
  }
  .auth-wrap {
    padding: 16px 14px 40px;
  }
  .auth-account-link {
    padding: 7px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-auth-page]::before,
  body[data-auth-page]::after,
  .auth-wrap::before,
  .auth-wrap::after,
  .auth-brand img {
    transition: none !important;
    transform: none !important;
  }
}