/* Library page: base and the sign-in screen. */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(#d1d5db 1.2px, transparent 1.2px);
  background-size: 16px 16px;
  min-height: 100vh;
  color: var(--black);
  -webkit-font-smoothing: antialiased;
}

/* ── Login View ── */
/* Hidden until we know you're signed out; signed-in people see #authLoading instead */
#authLoading {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-weight: 800;
  color: var(--muted, #64748b);
}
#authLoading img { width: 44px; height: 44px; animation: authPulse 1.2s ease-in-out infinite; }
@keyframes authPulse { 50% { transform: scale(0.9); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { #authLoading img { animation: none; } }
#loginSection {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 3px solid var(--border);
  border-radius: 14px;
  padding: 36px 30px;
  box-shadow: 6px 6px 0 var(--border);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-brand img {
  width: 44px;
  height: 44px;
  border: none;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
  display: block;
}

.login-brand-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.login-title {
  margin-bottom: 8px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.4px;
}

.login-switch {
  margin-top: 18px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
}

.login-switch a { color: var(--black); font-weight: 800; }

.login-fine {
  margin-top: 18px;
  padding-top: 14px;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--muted);
  border-top: 1.5px solid #e2e8f0;
}

.login-fine a { color: var(--black); font-weight: 700; }

.login-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.auth-tabs-wrap {
  display: flex;
  background: #f1f5f9;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 18px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  border: 1.5px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.12s ease;
}

.auth-tab-btn.active {
  background: #fff;
  color: var(--border);
  border-color: var(--border);
  box-shadow: 2px 2px 0 var(--border);
}

.input-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--border);
}

.text-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: 2.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--border);
  box-shadow: 2px 2px 0 var(--border);
  outline: none;
  transition: transform 0.1s, box-shadow 0.1s;
  margin-bottom: 16px;
}

.text-input:focus {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--border);
  border-color: var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  border: 2.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--border);
  transition: all 0.08s;
  white-space: nowrap;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--border);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--border);
}

.btn-primary {
  background: var(--lime);
  color: var(--border);
  width: 100%;
}

.btn-primary:hover {
  background: var(--lime-light);
}

.btn-secondary {
  background: #fff;
  color: var(--border);
}

.btn-secondary:hover {
  background: var(--muted-light);
}

.btn-danger {
  background: #fee2e2;
  color: var(--error);
  border-color: var(--border);
}

.login-error {
  font-size: 12px;
  font-weight: 700;
  color: var(--error);
  background: #fef2f2;
  border: 1.5px solid var(--error);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  display: none;
}

/* Google OAuth Button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  color: #1f2937;
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: 2.5px 2.5px 0 var(--border);
  cursor: pointer;
  transition: all 0.1s ease;
  margin-top: 6px;
  margin-bottom: 4px;
}
.btn-google:hover {
  background: #f9fafb;
  transform: translate(-1px, -1px);
  box-shadow: 3.5px 3.5px 0 var(--border);
}
.btn-google:active {
  transform: translate(1px, 1px);
  box-shadow: 0px 0px 0 var(--border);
}

/* Google OAuth Processing State */
.oauth-processing-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  margin-top: 10px;
  animation: fadeIn 0.2s ease-in;
}

.processing-spinner-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.processing-spinner {
  width: 38px;
  height: 38px;
  border: 3.5px solid #e2e8f0;
  border-top-color: var(--lime);
  border-right-color: var(--border);
  border-radius: 50%;
  animation: spin 0.75s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

.processing-pulse {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--lime);
  opacity: 0.5;
  animation: pulseWave 1.5s ease-out infinite;
}

.processing-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--border);
  margin-bottom: 3px;
}

.processing-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

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

@keyframes pulseWave {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
