@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --background: 210 20% 98%;
  --foreground: 220 20% 10%;

  --card: 0 0% 100%;
  --card-foreground: 220 20% 10%;

  --primary: 145 63% 42%;
  --primary-foreground: 0 0% 100%;

  --secondary: 220 14% 96%;
  --secondary-foreground: 220 20% 20%;

  --muted: 220 14% 96%;
  --muted-foreground: 220 10% 46%;

  --accent: 145 63% 95%;
  --accent-foreground: 145 63% 30%;

  --destructive: 0 84% 60%;
  --border: 220 13% 91%;
  --input: 220 13% 91%;

  --radius: 0.75rem;

  --gradient-bg: linear-gradient(
    135deg,
    hsl(145 63% 95%) 0%,
    hsl(200 60% 95%) 50%,
    hsl(280 60% 97%) 100%
  );
  --shadow-card: 0 4px 24px -4px hsl(220 20% 10% / 0.08),
                 0 2px 8px -2px hsl(220 20% 10% / 0.04);
  --shadow-button: 0 2px 8px -2px hsl(145 63% 42% / 0.4);
  --shadow-input-focus: 0 0 0 3px hsl(145 63% 42% / 0.15);
}

.dark {
  --background: 220 20% 8%;
  --foreground: 210 20% 98%;
  --card: 220 20% 12%;
  --card-foreground: 210 20% 98%;
  --primary: 145 63% 48%;
  --primary-foreground: 0 0% 100%;
  --secondary: 220 14% 18%;
  --secondary-foreground: 210 20% 90%;
  --muted: 220 14% 18%;
  --muted-foreground: 220 10% 60%;
  --accent: 145 40% 18%;
  --accent-foreground: 145 63% 70%;
  --destructive: 0 62% 50%;
  --border: 220 14% 20%;
  --input: 220 14% 20%;
  --gradient-bg: linear-gradient(135deg, hsl(220 20% 6%) 0%, hsl(220 20% 10%) 100%);
  --shadow-card: 0 4px 24px -4px hsl(0 0% 0% / 0.4);
}

:root {
  --hsl-bg: hsl(var(--background));
  --hsl-fg: hsl(var(--foreground));
  --hsl-card: hsl(var(--card));
  --hsl-card-fg: hsl(var(--card-foreground));
  --hsl-primary: hsl(var(--primary));
  --hsl-primary-fg: hsl(var(--primary-foreground));
  --hsl-secondary: hsl(var(--secondary));
  --hsl-secondary-fg: hsl(var(--secondary-foreground));
  --hsl-muted-fg: hsl(var(--muted-foreground));
  --hsl-border: hsl(var(--border));
  --hsl-input: hsl(var(--input));
  --hsl-destructive: hsl(var(--destructive));
  --hsl-accent: hsl(var(--accent));
}

/* Base */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--gradient-bg);
  min-height: 100vh;
  color: var(--hsl-fg);
}

/* Small mobile polish */
button, input, select {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* Layout */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Minimal utility classes used in HTML */
.flex { display:flex; }
.items-center { align-items:center; }
.justify-center { justify-content:center; }
.inline-flex { display:inline-flex; }

.text-center { text-align:center; }
.text-sm { font-size: 0.875rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }

.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-6 { margin-top: 1.5rem; }
.pt-2 { padding-top: 0.5rem; }

.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.w-16 { width: 4rem; }
.h-16 { height: 4rem; }

.rounded-2xl { border-radius: 1rem; }

.text-muted-foreground { color: var(--hsl-muted-fg); }
.text-foreground { color: var(--hsl-fg); }
.text-primary { color: var(--hsl-primary); }
.text-destructive { color: var(--hsl-destructive); }

/* ✅ Missing helpers used in HTML */
.transition-colors { transition: color 200ms ease; }
.hover\:text-foreground:hover { color: var(--hsl-fg); }

.back-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* Components */
.auth-card {
  background: var(--hsl-card);
  color: var(--hsl-card-fg);
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 24rem;
  margin: 0 auto;
  box-shadow: var(--shadow-card);
}

.auth-input {
  width: 100%;
  height: 3rem;
  padding: 0 1rem;
  font-size: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--hsl-input);
  background: var(--hsl-bg);
  color: var(--hsl-fg);
  outline: none;
  transition: all 200ms ease;
}
.auth-input::placeholder { color: var(--hsl-muted-fg); }
.auth-input:focus {
  border-color: var(--hsl-primary);
  box-shadow: var(--shadow-input-focus);
}

.auth-select {
  height: 3rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.75rem;
  border: 1px solid var(--hsl-input);
  background: var(--hsl-bg);
  color: var(--hsl-fg);
  outline: none;
  cursor: pointer;
  transition: all 200ms ease;
}
.auth-select:focus {
  border-color: var(--hsl-primary);
  box-shadow: var(--shadow-input-focus);
}

.btn-primary {
  width: 100%;
  height: 3rem;
  border-radius: 0.75rem;
  border: 0;
  cursor: pointer;
  background: var(--hsl-primary);
  color: var(--hsl-primary-fg);
  font-weight: 600;
  font-size: 1rem;
  transition: all 200ms ease;
  box-shadow: var(--shadow-button);
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  width: 100%;
  height: 3rem;
  border-radius: 0.75rem;
  border: 0;
  cursor: pointer;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  font-weight: 500;
  font-size: 1rem;
  transition: all 200ms ease;
}
.btn-secondary:hover { background: hsl(var(--muted)); }
.btn-secondary:active { transform: scale(0.98); }

.btn-text {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--hsl-muted-fg);
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 200ms ease;
}
.btn-text:hover { color: var(--hsl-fg); }

.bg-accent { background: var(--hsl-accent); }

.app-icon {
  border: 1px solid hsl(var(--border));
  box-shadow: 0 8px 18px -10px hsl(220 20% 10% / 0.25);
}

/* Remember toggle (donor style) */
.remember-toggle{
  display:flex;
  align-items:center;
  gap:0.75rem;
  cursor:pointer;
  user-select:none;
}

/* ✅ Compatibility: some builds still have remember-container/switch/slider markup */
.remember-container { display:flex; align-items:center; gap:0.75rem; }
.switch { display:inline-flex; align-items:center; justify-content:center; }

.remember-toggle__control{
  position:relative;
  display:inline-block;
  width:44px;
  height:24px;
}

.remember-toggle__input{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

.remember-toggle__track{
  position:absolute;
  inset:0;
  background: hsl(var(--muted));
  border-radius:9999px;
  transition: background-color 200ms ease;
}

.remember-toggle__thumb{
  position:absolute;
  left:2px;
  top:2px;
  width:20px;
  height:20px;
  background: var(--hsl-card);
  border-radius:9999px;
  box-shadow:0 1px 2px rgba(0,0,0,0.12);
  transition: transform 200ms ease;
}

.remember-toggle__input:checked + .remember-toggle__track{
  background: var(--hsl-primary);
}
.remember-toggle__input:checked ~ .remember-toggle__thumb{
  transform:translateX(20px);
}

.remember-toggle__text{
  font-size: 0.875rem;
  color: var(--hsl-muted-fg);
}

/* Password show/hide */
.password-field { position: relative; }
.auth-input--pad-right { padding-right: 3rem; }

.toggle-eye{
  position:absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--hsl-muted-fg);
  transition: color 200ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
}
.toggle-eye:hover { color: var(--hsl-fg); }
.toggle-eye svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }

/* ✅ Make .eye behave like a button too (your HTML uses .eye + .toggle-eye) */
.eye { cursor: pointer; }

/* Animations */
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-slide-up { animation: slideUp 0.4s ease-out; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Icons */
.icon { display:inline-block; }
.icon-sm { width: 1rem; height: 1rem; }
.icon-lg { width: 2rem; height: 2rem; }

/* Toasts (kept from donor even if unused) */
.toast-container{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  display: grid;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast{
  pointer-events: auto;
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  animation: toastIn 220ms ease-out;
}

.toast__title{
  font-weight: 700;
  font-size: 0.95rem;
}

.toast__desc{
  color: hsl(var(--muted-foreground));
  font-size: 0.9rem;
  line-height: 1.25rem;
}

.toast__row{
  display:flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.toast__close{
  border: 0;
  background: transparent;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  font-weight: 700;
  line-height: 1;
  padding: 6px;
  margin: -6px;
}

.toast__close:hover{
  color: hsl(var(--foreground));
}

@keyframes toastIn{
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   Compatibility layer for your existing RealChat classes
   (Design-only mapping; logic unchanged)
   ===================================================== */

/* ✅ Stronger hidden: avoids accidental clicks and tabbing */
.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.container { width: 100%; max-width: 24rem; margin: 0 auto; }

.green { /* keep class for JS/legacy; style comes from btn-primary */ }
.gray  { /* keep class for JS/legacy; style comes from btn-secondary */ }
.text-btn { /* keep class for JS/legacy; style comes from btn-text */ }

.error {
  min-height: 1.1em;
  line-height: 1.2rem;
  margin-top: 0.25rem;
}

.eye-wrap { position: relative; }
.eye { user-select: none; }

.button-stack { width: 100%; }
.flex-line { width: 100%; }

/* Admin button: subtle fixed action */
#adminBtn{
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.85);
  backdrop-filter: blur(8px);
  padding: 10px 12px;
  border-radius: 9999px;
  box-shadow: var(--shadow-card);
  z-index: 10000;
  cursor: pointer;
}

/* Tap zone kept invisible but safe */
#tapZone{
  position: fixed;
  inset: 0;
  pointer-events: none;
}