/* ── CSS Variables ─────────────────────────────── */
:root {
  --bg:       #09090f;
  --surface:  rgba(255,255,255,0.04);
  --border:   rgba(255,255,255,0.08);
  --text:     rgba(255,255,255,0.92);
  --text-2:   rgba(255,255,255,0.50);
  --text-3:   rgba(255,255,255,0.28);
  --accent:   #10b981;
  --accent-2: rgba(16,185,129,0.15);
  --accent-3: rgba(16,185,129,0.30);
  --danger:   #ef4444;
  --radius:   16px;
  --nav-h:    64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Inter', BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ──────────────────────────────────── */
.app-shell { background: var(--bg); }

.screen { min-height: calc(100vh - var(--nav-h)); }

/* ── Welcome Screen ─────────────────────────────── */
.welcome-screen {
  background: var(--bg);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.welcome-exit { opacity: 0; transform: scale(0.97); pointer-events: none; }

/* Ambient glow orbs */
.welcome-orb {
  position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none;
}
.welcome-orb-1 {
  width: 340px; height: 340px; top: -80px; left: 50%; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(16,185,129,0.18) 0%, transparent 70%);
  animation: orbFloat1 8s ease-in-out infinite;
}
.welcome-orb-2 {
  width: 260px; height: 260px; bottom: 60px; right: -60px;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  animation: orbFloat2 10s ease-in-out infinite;
}
@keyframes orbFloat1 {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(20px); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-24px); }
}

/* Content wrapper — shifts up when button reveals */
.welcome-content {
  transition: transform 0.6s cubic-bezier(.34,1.1,.64,1);
}
.welcome-content.btn-shown {
  transform: translateY(-28px);
}

/* Staggered entry animations */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wu-icon     { animation: welcomeBounce 0.7s 0.05s cubic-bezier(.34,1.56,.64,1) both; }
.wu-title    { animation: fadeSlideUp 0.55s 0.25s ease both; }
.wu-sub      { animation: fadeSlideUp 0.55s 0.4s  ease both; }
.wu-features { animation: fadeSlideUp 0.55s 0.55s ease both; }
.wu-legal    { animation: fadeSlideUp 0.4s  0.1s  ease both; }

/* Icon */
.welcome-icon-wrap {
  position: relative; width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 28px;
}
.welcome-icon-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(16,185,129,0.35);
  box-shadow: 0 0 40px rgba(16,185,129,0.2), inset 0 0 30px rgba(16,185,129,0.05);
  animation: ringPulse 3s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 40px rgba(16,185,129,0.2), inset 0 0 30px rgba(16,185,129,0.05); }
  50%       { box-shadow: 0 0 56px rgba(16,185,129,0.35), inset 0 0 40px rgba(16,185,129,0.10); }
}
.welcome-icon-emoji { font-size: 48px; line-height: 1; position: relative; z-index: 1; }

/* Typography */
.welcome-title {
  font-size: 48px; font-weight: 800; color: #fff;
  letter-spacing: -1.5px; line-height: 1; margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 40%, rgba(255,255,255,0.6));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.welcome-sub {
  font-size: 15px; line-height: 1.6; color: rgba(255,255,255,0.35);
  margin-bottom: 32px; font-weight: 400;
}

/* Features strip */
.welcome-features {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  font-size: 12px; color: rgba(255,255,255,0.3); margin-bottom: 40px; font-weight: 500;
}
.welcome-dot { opacity: 0.4; }

/* Legal */
.welcome-legal {
  margin-top: 20px; font-size: 11px; color: rgba(255,255,255,0.18); line-height: 1.5;
}

@keyframes welcomeBounce {
  0%   { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  60%  { transform: scale(1.1) rotate(3deg);  opacity: 1; }
  80%  { transform: scale(0.96) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}

/* ── Sign-in Button ─────────────────────────────── */
.signin-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #111;
  padding: 15px 32px; border-radius: 100px; width: 100%; max-width: 280px;
  font-size: 15px; font-weight: 600; border: none; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 8px 32px rgba(0,0,0,0.4), 0 0 48px rgba(16,185,129,0.2);
  /* starts invisible — JS adds signin-visible to animate in */
  opacity: 0; transform: translateY(32px); pointer-events: none;
  transition: opacity 0.55s cubic-bezier(.34,1.1,.64,1),
              transform 0.6s cubic-bezier(.34,1.4,.64,1),
              box-shadow 0.15s;
}
.signin-btn.signin-visible {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
.signin-btn:hover  { box-shadow: 0 0 0 1px rgba(255,255,255,0.15), 0 12px 40px rgba(0,0,0,0.5), 0 0 60px rgba(16,185,129,0.3); }
.signin-btn:active { transform: scale(0.97); }

/* ── Glass Card ─────────────────────────────────── */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}

/* ── Vault Card Grid ────────────────────────────── */
.vault-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 16px;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; cursor: pointer; position: relative;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  min-height: 130px; justify-content: center;
}
.vault-card:active { transform: scale(0.97); }
.vault-card:hover  { border-color: var(--accent-3); box-shadow: 0 0 24px rgba(16,185,129,0.12); }
.vault-card .vc-emoji  { font-size: 36px; line-height: 1; }
.vault-card .vc-name   { font-size: 13px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.3; }
.vault-card .vc-count  { font-size: 11px; color: var(--text-3); }
.vault-card .vc-lock   { position: absolute; top: 10px; right: 10px; font-size: 13px; opacity: 0.5; }
.vault-card .vc-delete { position: absolute; top: 8px; left: 8px; font-size: 11px; color: var(--text-3);
  background: rgba(239,68,68,0.12); border: none; border-radius: 8px; padding: 3px 7px; cursor: pointer; display: none; }
.vault-card:hover .vc-delete { display: block; }

/* ── Workspace Switcher ─────────────────────────── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.ws-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 100px; cursor: pointer; white-space: nowrap;
  font-size: 13px; font-weight: 600; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); transition: all 0.2s; flex-shrink: 0;
}
.ws-pill.active { background: var(--accent-2); border-color: var(--accent-3); color: var(--accent); }
.ws-pill-add {
  width: 34px; height: 34px; border-radius: 100px; display: flex; align-items: center;
  justify-content: center; font-size: 18px; cursor: pointer; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border); color: var(--accent);
  transition: background 0.2s;
}
.ws-pill-add:hover { background: var(--accent-2); }

/* ── Vault Tab Bar ──────────────────────────────── */
.vault-tab { color: var(--text-3); transition: color 0.2s; border-bottom: 2px solid transparent; }
.vault-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Item List ──────────────────────────────────── */
.item-row {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  transition: border-color 0.15s;
}
.item-row:hover { border-color: var(--accent-3); }
.item-row .ir-icon { font-size: 22px; flex-shrink: 0; }
.item-row .ir-body { flex: 1; min-width: 0; }
.item-row .ir-title { font-size: 14px; font-weight: 600; color: var(--text); truncate: true; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .ir-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .ir-del   { font-size: 16px; color: var(--text-3); flex-shrink: 0; background: none; border: none; cursor: pointer; padding: 4px; }

/* ── Chat Bubbles ───────────────────────────────── */
.chat-input-bar {
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.chat-textarea {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 20px; padding: 10px 14px; color: var(--text);
  font-size: 14px; resize: none; outline: none; max-height: 120px;
  overflow-y: auto; line-height: 1.5;
}
.chat-textarea:focus { border-color: var(--accent-3); }
.chat-textarea::placeholder { color: var(--text-3); }
.chat-send-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 16px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
}
.chat-send-btn:active { transform: scale(0.92); }
.chat-attach-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.msg-row { display: flex; gap: 8px; align-items: flex-end; }
.msg-row.mine { flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--border); display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.msg-bubble {
  max-width: 72%; padding: 9px 13px; border-radius: 18px;
  font-size: 14px; line-height: 1.5; word-break: break-word;
}
.msg-bubble.theirs {
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  border-bottom-left-radius: 4px; color: var(--text);
}
.msg-bubble.mine {
  background: var(--accent); color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-time { font-size: 10px; color: var(--text-3); margin-top: 4px; text-align: right; }
.msg-sender { font-size: 11px; color: var(--text-3); margin-bottom: 3px; font-weight: 600; }
.msg-image { max-width: 100%; border-radius: 12px; max-height: 200px; object-fit: cover; cursor: pointer; }
.msg-file-pill {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.08); border-radius: 10px; padding: 8px 12px;
  font-size: 13px; color: var(--text); text-decoration: none;
}

/* ── DM List ────────────────────────────────────── */
.dm-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
  transition: opacity 0.15s;
}
.dm-row:active { opacity: 0.7; }
.dm-avatar-small {
  width: 44px; height: 44px; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--border); display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.dm-avatar-small img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dm-row .dr-name    { font-size: 14px; font-weight: 600; color: var(--text); }
.dm-row .dr-preview { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* ── Workspace Screen ───────────────────────────── */
.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px;
}
.member-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent-2);
  border: 1px solid var(--accent-3); display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.member-name  { font-size: 14px; font-weight: 600; color: var(--text); }
.member-role  { font-size: 11px; color: var(--text-3); }
.invite-code-box {
  background: var(--accent-2); border: 1px solid var(--accent-3);
  border-radius: 14px; padding: 16px;
}
.invite-code  { font-size: 22px; font-weight: 800; letter-spacing: 6px; color: var(--accent); text-align: center; }

/* ── Bottom Nav ─────────────────────────────────── */
.bottom-nav {
  background: rgba(9,9,15,0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  height: var(--nav-h);
}
.nav-btn { background: none; border: none; cursor: pointer; color: var(--text-3); transition: color 0.2s; position: relative; }
.nav-btn.active, .nav-btn[data-tab="home"].active { color: var(--accent); }
.nav-label { line-height: 1; margin-top: 2px; }
.dm-badge {
  position: absolute; top: 6px; right: 10px;
  background: var(--danger); color: #fff; border-radius: 50%;
  width: 16px; height: 16px; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── FAB ────────────────────────────────────────── */
.fab {
  position: fixed; bottom: calc(var(--nav-h) + 16px); right: 50%;
  transform: translateX(calc(50% - 160px + 16px));
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(16,185,129,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 40;
}
.fab:active { transform: translateX(calc(50% - 160px + 16px)) scale(0.93); }

/* ── Bottom Sheets ──────────────────────────────── */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-panel {
  background: #111118; border-top: 1px solid var(--border);
  border-radius: 28px 28px 0 0;
  padding: 20px 20px 36px; width: 100%; max-width: 448px;
}
.sheet-handle {
  width: 40px; height: 4px; background: rgba(255,255,255,0.12);
  border-radius: 4px; margin: 0 auto 20px;
}
.sheet-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 20px; }

/* ── Forms ──────────────────────────────────────── */
.grove-input {
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 14px; padding: 13px 16px; color: var(--text); font-size: 14px;
  outline: none; transition: border-color 0.2s;
}
.grove-input:focus { border-color: var(--accent-3); }
.grove-input::placeholder { color: var(--text-3); }
.label-sm { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.submit-btn { background: var(--accent); border: none; cursor: pointer; transition: opacity 0.2s, transform 0.15s; }
.submit-btn:active { transform: scale(0.98); }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Toggle Switch ──────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 24px;
  background: rgba(255,255,255,0.1); cursor: pointer; transition: background 0.2s;
}
.toggle-slider:before {
  content: ''; position: absolute; height: 18px; width: 18px; border-radius: 50%;
  left: 3px; bottom: 3px; background: #fff; transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ── Type Chips ─────────────────────────────────── */
.type-chip {
  padding: 7px 14px; border-radius: 100px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all 0.2s;
}
.type-chip.active { background: var(--accent-2); border-color: var(--accent-3); color: var(--accent); }

/* ── Modal Sheet ────────────────────────────────── */
.modal-sheet { background: #111118; border-top: 1px solid var(--border); }
.modal-cancel {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; transition: background 0.2s;
}
.modal-cancel:hover { background: rgba(255,255,255,0.1); }

/* ── Profile Avatar ─────────────────────────────── */
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--accent-3); display: flex; align-items: center;
  justify-content: center; cursor: pointer; overflow: hidden; flex-shrink: 0;
}
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent-2);
  border: 2px solid var(--accent-3); display: flex; align-items: center;
  justify-content: center; overflow: hidden; flex-shrink: 0;
}

/* ── Toast ──────────────────────────────────────── */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(16,185,129,0.9); backdrop-filter: blur(12px);
  color: #fff; font-size: 13px; font-weight: 600; padding: 10px 20px;
  border-radius: 100px; opacity: 0; pointer-events: none;
  transition: opacity 0.3s; z-index: 300; white-space: nowrap;
}
.toast.error { background: rgba(239,68,68,0.9); }
.toast.show  { opacity: 1; }
