/* ── style-auth.css ──────────────────────────────────────────────────────────
   Auth modal (login / register), login button in top-controls,
   and language-aware font overrides.
   Loaded by index.html after style.css.
*/

/* ── Auth overlay & modal box ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.auth-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px 28px;
  width: min(400px, 90vw);
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.auth-close:hover { color: var(--text); }

/* ── Auth panels ── */
.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.38s ease;
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.auth-field input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input::placeholder { color: var(--muted); }

.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}

.auth-error {
  color: #f87171;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.82rem;
  min-height: 0;
  display: none;
}

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

.auth-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--glow);
  transition: opacity 0.2s, transform 0.15s;
  margin-top: 2px;
}

.auth-submit:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-switch {
  text-align: center;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.auth-switch a {
  color: var(--accent2);
  cursor: pointer;
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

.auth-hint-text {
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* ── Login button (top-controls) ── */
#login-btn {
  padding: 7px 16px;
  background: rgba(15, 15, 20, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

#login-btn:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

#login-btn.logged-in {
  border-color: rgba(139, 92, 246, 0.45);
  color: var(--accent2);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 6px;
}

/* Avatar circle inside login button */
.login-btn-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

/* Initials fallback */
.login-btn-initials {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent2);
  flex-shrink: 0;
  line-height: 1;
}

.login-btn-name {
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.76rem;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── User dropdown menu ── */
#user-menu-wrap {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
  min-width: 160px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1100;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.user-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.user-dropdown-item {
  background: none;
  border: none;
  color: var(--text);
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.82rem;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-dropdown-item:hover {
  background: var(--surface2);
}

.user-dropdown-logout {
  color: #f87171;
}

.user-dropdown-logout:hover {
  background: rgba(248, 113, 113, 0.12);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

/* ── Report overlay ── */
.report-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2100;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.report-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.report-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px 24px;
  width: min(440px, 92vw);
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.report-close:hover { color: var(--text); }

.report-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
}

.report-type-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.report-type-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.83rem;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: border-color 0.2s, color 0.2s;
}

.report-type-label:has(input:checked) {
  border-color: var(--accent2);
  color: var(--accent2);
}

.report-type-label input { display: none; }

.report-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: "Noto Serif SC", Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.report-textarea::placeholder { color: var(--muted); }

.report-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}

.report-error {
  color: #f87171;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.82rem;
  min-height: 0;
  display: none;
}

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

.report-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--glow);
  transition: opacity 0.2s, transform 0.15s;
}

.report-submit:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.report-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #134e26;
  color: #86efac;
  border: 1px solid #166534;
  padding: 12px 28px;
  border-radius: 8px;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── EN language fonts ── */
html[lang='en'] body {
  font-family: Georgia, "Times New Roman", serif;
}

html[lang='en'] button,
html[lang='en'] input,
html[lang='en'] label.field-label,
html[lang='en'] .auth-submit,
html[lang='en'] .auth-switch,
html[lang='en'] .auth-error,
html[lang='en'] #length-display,
html[lang='en'] footer {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
