/* =========================================================
   SGROLLO · Auth — modal + user menu
   Uses the design tokens declared in style.css :root.
   ========================================================= */

/* The [hidden] attribute must win over the `display` rules below — an author
   `display:` declaration otherwise overrides the UA's `[hidden]{display:none}`,
   which would leave the sign-in modal and user menu permanently visible.
   (Same convention used throughout style.css, e.g. `.toast[hidden]`.) */
.auth-modal[hidden],
.user-menu[hidden],
.google-slot[hidden] { display: none; }

/* ----- header: logged-in user chip ----- */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-soft);
  font-weight: 600;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.user-chip:hover { border-color: var(--primary); }
.user-chip:active { transform: translateY(1px); }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  background-size: cover;
  background-position: center;
  flex: none;
}
.user-avatar.has-img { color: transparent; }

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 232px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  box-shadow: var(--shadow-card);
  padding: 6px;
  z-index: 60;
}
.user-dropdown-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.user-dropdown-name { font-weight: 700; color: var(--ink); }
.user-dropdown-email {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: left;
}
.user-dropdown-item:hover { background: var(--bg-1); color: var(--ink); }

/* ----- modal shell ----- */
body.auth-open { overflow: hidden; }

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 40, .45);
  backdrop-filter: blur(3px);
}

.auth-dialog {
  position: relative;
  width: min(400px, 100%);
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 30px 28px 22px;
  animation: auth-pop .18s ease-out;
}
@keyframes auth-pop {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.auth-close:hover { background: var(--bg-1); color: var(--ink); }

.auth-head { text-align: center; margin-bottom: 22px; }
.auth-logo { font-size: 34px; line-height: 1; }
.auth-title {
  margin: 8px 0 4px;
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}
.auth-sub { margin: 0; color: var(--muted); font-size: 14px; }

/* ----- google ----- */
.google-slot {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}
#google-btn {
  display: flex;
  justify-content: center;
  min-height: 40px;
}

/* Shown when Google sign-in isn't configured, or on a sign-in error. */
.auth-unavailable {
  background: var(--bg-1);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.auth-unavailable code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(91, 61, 240, .1);
  padding: 1px 5px;
  border-radius: 6px;
}

.auth-fineprint {
  margin: 18px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .auth-dialog { padding: 26px 18px 18px; }
  .user-name { display: none; }
}
