/**
 * Unified Auth Frontend Styles
 * Consolidates previous inline styles from index.html into a shared stylesheet.
 * Copyright 2021 Google LLC
 * Licensed under the Apache License, Version 2.0.
 */

:root {
  /* Theme tokens */
  --bg: #0b0c0d; /* page bg under banner (if used on alt pages) */
  --panel-bg: #fff;
  --panel-border: #e2e6eb;
  --accent: #1357f5;
  --accent-hover: #0d46c3;
  --danger: #d92e2e;
  --muted: #6a7785;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --focus-ring: 3px solid rgba(19, 87, 245, 0.35);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --font-size-base: 16px;
  --line-height-base: 1.5;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 6px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font: var(--font-size-base)/var(--line-height-base) var(--font-family);
  background: #fff;
  color: #1a232b;
  min-height: 100vh;
}

/* Top bar */
#topbar {
  background: #111;
  border-bottom: 1px solid #222;
  color: #eee;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px;
  font-size: 14px;
}
#topbar .title {
  font-weight: 600;
  letter-spacing: .5px;
}
#topbar a {
  color: #4ea3ff;
  text-decoration: none;
  font-weight: 500;
}
#topbar a:hover { text-decoration: underline; }

/* Layout */
main {
  margin: 60px auto 70px;
  padding: 0 40px 20px;
  width: 100%;
  max-width: 720px;
}
h1 {
  margin: 0 0 14px;
  font-size: 30px;
  letter-spacing: .4px;
  font-weight: 600;
  text-align: center;
}
.tag {
  margin: 0 0 38px;
  font-size: 15px;
  color: var(--muted);
  text-align: center;
}

/* Forms */
form {
  margin: 0 0 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .3px;
  margin-bottom: 4px;
  display: block;
  color: #2d3a45;
  padding-left: 13px; /* align with input text start */
  text-align: left;
}
input[type=email],
input[type=password],
input[type=text] {
  width: 100%;
  font: 14px/1.4 var(--font-family);
  padding: 12px 14px;
  border: 1px solid #c8d1da;
  border-radius: var(--radius);
  background: #fcfdfe;
  transition: background .15s, border-color .15s, outline-color .15s;
}
input:focus {
  outline: var(--focus-ring);
  border-color: var(--accent);
  background: #fff;
}

/* Buttons */
button {
  font-family: var(--font-family);
}
button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 13px 18px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: .4px;
  transition: background .15s;
}
button.primary:hover { background: var(--accent-hover); }

.alt-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
button.ms {
  background: #fff;
  color: #222;
  border: 1px solid #c8d1da;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
button.ms:hover {
  background: #f1f5f9;
  border-color: #b9c5cf;
}

/* Provider icon (Microsoft only; Google skipped per instruction) */
.provider-icon {
  width:20px;
  height:20px;
  display:inline-block;
  object-fit:contain;
  vertical-align:-2px;
}

/* Disabled / busy states */
form.busy {
  opacity: .85;
  filter: none;
  transition: opacity .25s;
}

button:disabled,
button[disabled] {
  background: #8fa2b5;
  color: #fff;
  cursor: not-allowed;
  opacity: .85;
}

button.primary:disabled {
  background: var(--accent);
  filter: brightness(0.85);
}

button.ms:disabled {
  background: #fff;
  color: #555;
  border-color: #c8d1da;
  opacity: .75;
}

input:disabled {
  background: #f7f9fb;
  color: #4a5660;
  border-color: #ccd5dd;
}

#signout {
  margin-top: 24px;
  background: #222;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
#signout:hover { background: #111; }

/* Auxiliary links */
.aux-links {
  max-width: 420px;
  margin: 8px auto 0;
  display: flex;
  justify-content: center;
  font-size: 12px;
  gap: 14px;
}
.aux-links a {
  color: var(--accent);
  text-decoration: none;
}
.aux-links a:hover { text-decoration: underline; }

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #909aa4;
  margin: 40px auto 24px;
  max-width: 420px;
}
.divider:before,
.divider:after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e1e6eb;
}

/* Status messages */
.status {
  margin: 16px 0 0;
  padding: 12px 14px;
  font-size: 13px;
  border-radius: var(--radius);
  border: 1px solid #d9e1e8;
  background: #f0f4f8;
  color: #1a232b;
}
.status.err {
  background: #fff2f2;
  border-color: #f5b5b5;
  color: #8e1d1d;
}
.status.ok {
  background: #e9f9f2;
  border-color: #b4e8cf;
  color: #0e5e3a;
}

/* Panels & code chips for restricted/access pages */
.panel {
  background: #fcfdfe;
  border: 1px solid var(--panel-border);
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.code {
  font: 13px/1.4 SFMono-Regular, Consolas, Menlo, monospace;
  background: #f5f8fa;
  border: 1px solid #c8d1da;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  display: inline-block;
  color: #2d3a45;
}
footer {
  margin-top: 70px;
  font-size: 11px;
  letter-spacing: .45px;
  color: var(--muted);
  text-transform: uppercase;
  text-align: center;
  padding: 0 40px;
}

/* Utilities */
.hidden { display: none !important; }
.center-msg {
  margin: 120px auto 0;
  max-width: 520px;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  color: #2d3a45;
}

/* Responsive */
@media (max-width: 760px) {
  main { padding: 0 24px; }
  form,
  .divider,
  .alt-buttons,
  #signout { max-width: 100%; }
  footer { padding: 0 24px; }
}

/* Focus accessibility for non-input interactive elements */
button:focus,
a:focus {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* Loading state & spinner */
button.loading {
  position: relative;
  pointer-events: none;
}

button.loading span.btn-text {
  opacity: 1;
}

button.loading .spinner {
  display: inline-block;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-right: 8px;
}

button.ms .spinner {
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: #222;
}

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

/* Inline error message under button */
.error-msg {
  margin: 8px auto 0;
  max-width: 420px;
  font-size: 13px;
  color: #8e1d1d;
  background: #fff2f2;
  border: 1px solid #f5b5b5;
  padding: 8px 12px;
  border-radius: var(--radius);
  display: none;
}

.error-msg.visible {
  display: block;
}

/* Redirect-back link styling */
#redirect-back {
  display: block;
  text-align: center;
  margin: 12px auto 0;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
#redirect-back:hover { text-decoration: underline; }

/* Removed pulseTitle animation per updated UX (spinner before title replaces pulse). */
