/* ============================================================
   Auth Modal — auth-modal.css
   ============================================================ */

/* ── Overlay: full-screen, card anchored to top ─────────────── */
.am-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem 1rem;
  animation: am-fade-in 0.18s ease;
}

@keyframes am-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes am-scale-in {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.am-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 0;
}

/* ── Card: constrained width, centred ───────────────────────── */
.am-card {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 460px;
  padding: 2.25rem 2rem 2rem;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.22);
  animation: am-scale-in 0.2s ease;
  max-height: 90vh;
  overflow-y: auto;
}

/* ── Close button ──────────────────────────────────────────── */
.am-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  z-index: 2;
}

.am-close:hover {
  color: #111;
}

/* ── Logo ──────────────────────────────────────────────────── */
.am-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.4rem;
}

.am-logo img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.am-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111;
  font-family: Georgia, serif;
}

/* ── Headings & switch ─────────────────────────────────────── */
.am-title {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  color: #111;
  margin: 0 0 0.3rem;
  font-family: Georgia, serif;
}

.am-switch {
  text-align: center;
  font-size: 0.875rem;
  color: #777;
  margin-bottom: 1.35rem;
}

.am-link {
  background: none;
  border: none;
  cursor: pointer;
  color: #111;
  font-weight: 600;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  font-family: inherit;
}

/* ── Form fields ───────────────────────────────────────────── */
.am-field {
  position: relative;
  margin-bottom: 0.7rem;
}

.am-field input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid #d5d2cb;
  border-radius: 4px;
  font-size: 0.9375rem;
  color: #111;
  background: #fff;
  box-sizing: border-box;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.am-field input::placeholder {
  color: #bbb;
}

.am-field input:focus {
  border-color: #111;
}

.am-eye {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  padding: 0;
  display: flex;
  align-items: center;
}

.am-eye svg {
  width: 17px;
  height: 17px;
}

/* ── Password strength indicator ───────────────────────────── */
.am-pw-strength {
  display: none;
  margin: -0.25rem 0 0.7rem;
  padding: 0.5rem 0.65rem;
  background: #f9f9f7;
  border: 1px solid #e8e5df;
  border-radius: 4px;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem 0.75rem;
}

.am-pw-strength.am-pw-visible {
  display: grid;
}

.am-pw-rule {
  font-size: 0.775rem;
  color: #bbb;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.am-pw-rule::before {
  content: '○';
  font-size: 0.7rem;
}

.am-pw-rule.met {
  color: #2e7d32;
}

.am-pw-rule.met::before {
  content: '✓';
}

/* ── Terms acceptance checkbox ─────────────────────────────── */
.am-terms-check {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: #888;
  line-height: 0.5;
  margin-bottom: 0.9rem;
  cursor: pointer;
}

.am-terms-check input[type="checkbox"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
  width: 15px;
  height: 5px;
  cursor: pointer;
  accent-color: #111;
}

.am-terms-check a {
  color: #555;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Supporting text ───────────────────────────────────────── */

.am-forgot {
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  color: #555;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-bottom: 1rem;
  padding: 0;
  font-family: inherit;
  text-align: left;
}

.am-hint {
  font-size: 0.875rem;
  color: #777;
  margin-bottom: 1.1rem;
  line-height: 1.5;
}

/* ── Buttons ───────────────────────────────────────────────── */
.am-btn-primary {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  font-family: Georgia, serif;
  letter-spacing: 0.01em;
  transition: background 0.15s;
}

.am-btn-primary:hover {
  background: #333;
}

.am-btn-primary:disabled {
  background: #aaa;
  cursor: not-allowed;
}

.am-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: #bbb;
  font-size: 0.8rem;
}

.am-divider::before,
.am-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e8e5df;
}

.am-btn-google {
  width: 100%;
  padding: 0.7rem 1rem;
  background: #fff;
  color: #111;
  border: 1px solid #d5d2cb;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.am-btn-google:hover {
  background: #f9f9f7;
  border-color: #aaa;
}

.am-btn-microsoft {
  width: 100%;
  padding: 0.7rem 1rem;
  margin-top: 0.5rem;
  background: #fff;
  color: #111;
  border: 1px solid #d5d2cb;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.am-btn-microsoft:hover {
  background: #f3f6fb;
  border-color: #0078d4;
}

/* ── Error / success banner ────────────────────────────────── */
.am-error {
  background: #fff0f0;
  border: 1px solid #f5c0c0;
  color: #c00;
  border-radius: 4px;
  padding: 0.55rem 0.8rem;
  font-size: 0.825rem;
  margin-bottom: 0.85rem;
  display: none;
}

.am-error.visible {
  display: block;
}

.am-error.success {
  background: #f0faf0;
  border-color: #a8d5a8;
  color: #2e7d32;
}

/* ── Header Auth UI ────────────────────────────────────────── */
.sgad-auth-ui {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sgad-user-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sgad-user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: inherit;
  white-space: nowrap;
}

#login-btn-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.am-login-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid #d5d2cb;
  color: #111;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}

.am-login-btn:hover {
  border-color: #111;
  background: #f5f5f5;
}

.am-login-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Account dropdown ──────────────────────────────────────── */
.am-account-menu {
  position: relative;
}

.am-account-trigger {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--sgad-darkgreen, #115A41);
  border: 1px solid var(--sgad-darkgreen, #115A41);
  color: #fff;
  padding: 0.45rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.am-account-trigger:hover {
  background: #0e4a35;
  border-color: #0e4a35;
}

.am-chevron {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.8);
  transition: transform 0.15s;
}

.am-account-trigger[aria-expanded="true"] .am-chevron {
  transform: rotate(180deg);
}

.am-account-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 180px;
  z-index: 10000;
  overflow: hidden;
}

.am-account-item {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  color: #111;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s;
}

.am-account-item:hover {
  background: #f5f5f5;
}

.am-account-signout {
  border-top: 1px solid #f0f0f0;
  color: #c00;
  margin-top: 2px;
}

.am-account-signout:hover {
  background: #fff0f0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 520px) {
  .am-overlay {
    padding: 0.75rem 0.5rem 0.5rem;
  }

  .am-card {
    padding: 1.75rem 1.25rem 1.5rem;
  }
}
