/* Waterwair admin panel — brand-quality redesign.
   Matches app.waterwair.com tokens: Outfit font, dark navy + mint
   accent, frosted-glass cards, glow effects, smooth animations. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --bg1: #041320;
  --bg2: #052033;
  --bg3: #08324d;
  --accent: #34f2d2;
  --accent2: #0aa88a;
  --accent-soft: rgba(52, 242, 210, .13);
  --accent-strong: rgba(52, 242, 210, .35);
  --glow: 0 0 30px rgba(52, 242, 210, .28);
  --glow-sm: 0 0 20px rgba(52, 242, 210, .18);
  --txt: #e9fbf7;
  --txt-dim: #bde0ee;
  --txt-faint: #7da8bc;
  --card: rgba(12, 31, 49, .92);
  --card-elev: rgba(15, 38, 60, .96);
  --border: rgba(52, 242, 210, .18);
  --border2: rgba(52, 242, 210, .08);
  --shadow: 0 20px 60px rgba(0, 0, 0, .5);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, .25);
  --red: #E24B4A;
  --red-soft: rgba(226, 75, 74, .12);
  --green: #1D9E75;
  --green-soft: rgba(29, 158, 117, .12);
  --r: 14px;
}

body {
  background: var(--bg1);
  color: var(--txt);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Subtle radial glow at the top — matches app.waterwair.com hero */
body::before {
  content: '';
  position: fixed;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(52,242,210,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: .85; }

/* ── Top bar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(4, 19, 32, .92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border2);
  height: 64px;
  display: flex; align-items: center;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; width: 100%;
  padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none;
  transition: transform .18s ease;
}
.brand:hover { transform: translateY(-1px); }
.brand-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #032420; font-weight: 800; font-size: 18px;
  box-shadow: var(--glow-sm);
}
.brand-name {
  color: var(--txt); font-weight: 700; font-size: 17px; letter-spacing: -.01em;
}

.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topnav a {
  color: var(--txt-dim); padding: 10px 14px; border-radius: 8px;
  font-size: 14px; font-weight: 500; min-height: 44px;
  display: inline-flex; align-items: center;
  transition: .18s ease;
}
.topnav a:hover {
  color: var(--accent); background: var(--accent-soft);
  opacity: 1; transform: translateY(-1px);
}
.logout {
  background: none; border: 1px solid var(--border2);
  color: var(--txt-dim); padding: 10px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; min-height: 44px;
  font-family: inherit; transition: .18s ease;
}
.logout:hover { border-color: var(--red); color: var(--red); }

/* ── Layout ──────────────────────────────────────────────────── */
.wrap {
  max-width: 1280px; margin: 0 auto;
  padding: 32px 24px 80px;
  position: relative; z-index: 1;
}

.hidden { display: none !important; }

/* ── Loading / auth states ───────────────────────────────────── */
.state-card {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 56px 32px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: fadeIn .35s ease-out;
  box-shadow: var(--shadow-card);
}
.state-icon { font-size: 44px; }
.state-text { color: var(--txt-dim); font-size: 15px; max-width: 480px; }
.state-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px; flex-wrap: wrap;
  margin-bottom: 28px;
  animation: fadeIn .4s ease-out;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: 32px; font-weight: 700; letter-spacing: -.02em;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subline { margin: 0; color: var(--txt-dim); font-size: 15px; }
.hero-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  background: var(--card); border: 1px solid var(--border2);
  padding: 8px 14px; border-radius: 999px;
  font-size: 13px; color: var(--txt-dim);
  transition: .18s ease;
}
.pill:hover { border-color: var(--border); color: var(--txt); }

/* ── Stat grid ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: .25s ease;
  animation: slideInUp .45s ease-out backwards;
}
.stat-card:nth-child(1) { animation-delay: .04s; }
.stat-card:nth-child(2) { animation-delay: .08s; }
.stat-card:nth-child(3) { animation-delay: .12s; }
.stat-card:nth-child(4) { animation-delay: .16s; }
.stat-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 0%, var(--accent-soft) 200%);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border);
  box-shadow: var(--shadow-card), var(--glow-sm);
}
.stat-card:hover::before { opacity: .6; }
.stat-label {
  color: var(--txt-faint); font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 10px;
  position: relative; z-index: 1;
}
.stat-value {
  font-size: 36px; font-weight: 800; color: var(--accent);
  line-height: 1; margin-bottom: 8px;
  position: relative; z-index: 1;
  text-shadow: 0 0 20px rgba(52, 242, 210, .25);
}
.stat-sub {
  color: var(--txt-faint); font-size: 12px;
  position: relative; z-index: 1;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 26px;
  margin-bottom: 22px;
  transition: border-color .18s ease;
  animation: slideInUp .5s ease-out backwards;
}
.card:hover { border-color: var(--border); }
.card:nth-of-type(2) { animation-delay: .05s; }
.card:nth-of-type(3) { animation-delay: .1s; }
.card:nth-of-type(4) { animation-delay: .15s; }

.card-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.card-head h2 {
  margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em;
}
.card-note {
  color: var(--txt-dim); font-size: 14px; margin: 0 0 18px;
  line-height: 1.6;
}
.pill-light {
  background: var(--accent-soft); color: var(--accent);
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border2);
}
.pill-light.warn {
  background: rgba(251, 191, 36, .15); color: #fbbf24;
  border-color: rgba(251, 191, 36, .3);
}

/* ── Invite form ─────────────────────────────────────────────── */
.invite-form {
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 14px;
}
.row:last-child { margin-bottom: 0; }
.grp { display: flex; flex-direction: column; }
.grp-end { justify-content: flex-end; }
.grp label {
  font-size: 11px; font-weight: 700; color: var(--txt-faint);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px;
}
.grp input[type="text"], .grp input[type="email"] {
  background: var(--bg1); border: 1px solid var(--border2);
  color: var(--txt); padding: 13px 16px; border-radius: 9px;
  font-size: 14px; font-family: inherit; min-height: 44px;
  transition: .18s ease;
}
.grp input::placeholder { color: var(--txt-faint); }
.grp input:focus, .grp-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52, 242, 210, .15);
}
.grp-select {
  background: var(--bg1); border: 1px solid var(--border2);
  color: var(--txt); padding: 12px 40px 12px 16px; border-radius: 9px;
  font-size: 14px; font-family: inherit; min-height: 44px;
  width: 100%;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2334f2d2' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
  transition: .18s ease;
}
.hint { color: var(--txt-faint); font-size: 12px; margin-top: 6px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 13px 24px;
  min-height: 44px;
  background: linear-gradient(135deg, #52f5e0 0%, var(--accent) 100%);
  color: #032420;
  border: none;
  border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit;
  transition: .2s ease;
  box-shadow: 0 6px 20px rgba(52, 242, 210, .28);
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(52, 242, 210, .55);
  text-decoration: none;
}
.btn-primary:disabled {
  opacity: .5; cursor: not-allowed;
  transform: none; box-shadow: none;
}

.btn-ghost {
  background: none; border: 1px solid var(--border2);
  color: var(--txt-dim); padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; min-height: 36px;
  transition: .18s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Info box (post-invite) ──────────────────────────────────── */
.info-box {
  background: var(--accent-soft);
  border: 1px solid var(--accent-strong);
  border-radius: 10px;
  padding: 18px;
  font-size: 14px; line-height: 1.6;
  margin-bottom: 18px;
  animation: fadeIn .4s ease-out;
}
.temp-pw {
  font-family: 'DM Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 16px; font-weight: 700; color: var(--accent);
  background: rgba(0, 0, 0, .45); padding: 12px 16px;
  border-radius: 7px; margin: 12px 0;
  letter-spacing: .05em; user-select: all;
  display: inline-block;
  border: 1px dashed var(--border);
}

/* ── Lists (team / convo / agents) ───────────────────────────── */
.team-list, .convo-list, .agent-analytics {
  display: flex; flex-direction: column; gap: 10px;
}
.team-row, .convo-row, .analytic-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border2);
  border-radius: 10px;
  transition: .2s ease;
  text-decoration: none;
  color: inherit;
  animation: slideInUp .4s ease-out backwards;
}
.team-list > *:nth-child(n+1), .convo-list > *:nth-child(n+1), .agent-analytics > *:nth-child(n+1) {
  animation-delay: calc(.04s * var(--i, 0));
}
.team-row:hover, .convo-row:hover, .analytic-row:hover {
  border-color: var(--border);
  transform: translateX(2px);
}
.row-icon { font-size: 22px; flex-shrink: 0; width: 36px; text-align: center; }
.row-info { flex: 1 1 0; min-width: 0; }
.row-name {
  color: var(--txt); font-weight: 600; font-size: 14.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-meta {
  color: var(--txt-faint); font-size: 12.5px; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.row-action {
  background: none; border: 1px solid var(--border2); color: var(--txt-dim);
  padding: 7px 14px; border-radius: 7px; font-size: 13px;
  cursor: pointer; font-family: inherit; min-height: 32px;
  transition: .18s ease;
}
.row-action:hover { border-color: var(--accent); color: var(--accent); }
.row-action.danger:hover { border-color: var(--red); color: var(--red); }

.empty {
  padding: 32px 20px; color: var(--txt-faint);
  text-align: center; font-size: 14px;
  background: rgba(255, 255, 255, .015);
  border: 1px dashed var(--border2);
  border-radius: 10px;
}

/* Online dots — pulsing animation */
.dot-online {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); display: inline-block; margin-right: 7px;
  position: relative;
  box-shadow: 0 0 0 0 rgba(52, 242, 210, .7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 242, 210, .55); }
  70% { box-shadow: 0 0 0 8px rgba(52, 242, 210, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 242, 210, 0); }
}
.dot-offline {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--txt-faint); display: inline-block; margin-right: 7px;
  opacity: .5;
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast-host {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--card-elev);
  border: 1px solid var(--border);
  color: var(--txt);
  padding: 14px 18px; border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .55), var(--glow-sm);
  animation: toast-in .3s cubic-bezier(.4, 1.5, .55, 1);
  pointer-events: auto;
  max-width: 340px;
}
.toast.error {
  border-color: var(--red);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .55), 0 0 20px rgba(226, 75, 74, .25);
}
.toast.success {
  border-color: var(--accent);
}
@keyframes toast-in {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { height: auto; padding: 12px 0; }
  .topbar-inner { flex-direction: column; gap: 12px; padding: 0 16px; align-items: flex-start; }
  .topnav { width: 100%; justify-content: flex-start; gap: 4px; }
  .topnav a { padding: 8px 10px; font-size: 13px; }
  .wrap { padding: 24px 16px 64px; }
  .hero h1 { font-size: 26px; }
  .row { grid-template-columns: 1fr; gap: 12px; }
  .stat-value { font-size: 28px; }
  .toast-host { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: 100%; }
}
