/* =========================================
   SCHEDY — Design System
   Social planning platform
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800;900&display=swap');

/* ---- Variables ---- */
:root {
  /* Backgrounds — deep charcoal with cool violet undertone */
  --bg:        #0d0d12;
  --bg-2:      #121219;
  --bg-card:   #18181f;
  --bg-card-2: #20202b;
  --bg-input:  #18181f;
  --bg-header: #0d0d12;

  /* Brand — Schedy violet */
  --accent:       #7c6ff7;
  --accent-dim:   rgba(124,111,247,0.12);
  --accent-mid:   rgba(124,111,247,0.28);
  --accent-hover: #6a5de8;
  /* Aliases */
  --purple:       #7c6ff7;
  --purple-dim:   rgba(124,111,247,0.12);
  --purple-mid:   rgba(124,111,247,0.28);
  --purple-hover: #6a5de8;

  /* Semantic */
  --green:     #34d399;
  --green-dim: rgba(52,211,153,0.12);
  --amber:     #fbbf24;
  --amber-dim: rgba(251,191,36,0.12);
  --red:       #f87171;
  --red-dim:   rgba(248,113,113,0.12);
  --blue:      #60a5fa;
  --blue-dim:  rgba(96,165,250,0.12);
  --pink:      #f472b6;
  --pink-dim:  rgba(244,114,182,0.12);

  /* Text */
  --text:     #f2f2f7;
  --text-2:   #888898;
  --text-3:   #46465a;
  --text-nav: #46465a;

  /* Borders */
  --border:   #1e1e2c;
  --border-2: #16161e;

  /* Typography */
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 26px;
  --r-full: 9999px;

  /* Sizes */
  --nav-h: 68px;
  --header-h: 54px;

  /* Transitions */
  --t: 0.16s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: #0b0e14;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
}

/* ---- App Shell ---- */
.shell {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 500px) {
  body { background: #080b10; align-items: center; padding: 20px 0; }
  .shell {
    min-height: calc(100vh - 40px);
    max-height: 920px;
    border-radius: 44px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 40px 100px rgba(0,0,0,0.85), 0 0 80px rgba(124,111,247,0.08);
    overflow: hidden;
  }
}

/* ====================================================
   SPLASH
   ==================================================== */
.splash {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  max-width: 430px;
  left: 50%;
  transform: translateX(-50%);
  gap: 16px;
}

.splash-logo-mark {
  width: 72px;
  height: 72px;
  background: var(--purple-dim);
  border: 1.5px solid var(--purple-mid);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  animation: splashPop 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
}

.splash-wordmark {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  animation: splashFadeUp 0.6s ease 0.2s both;
}

.splash-wordmark span { color: var(--purple); }

.splash-tagline {
  font-size: 14px;
  color: var(--text-3);
  font-weight: 500;
  animation: splashFadeUp 0.6s ease 0.35s both;
}

@keyframes splashPop { from { opacity:0; transform:scale(0.7); } to { opacity:1; transform:scale(1); } }
@keyframes splashFadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeOut { to { opacity:0; pointer-events:none; } }
.splash.hiding { animation: fadeOut 0.35s ease forwards; }

/* ====================================================
   ONBOARDING
   ==================================================== */
.ob-screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  background: var(--bg);
  animation: screenIn 0.3s ease both;
}

.ob-screen.active { display: flex; }

@keyframes screenIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

/* Progress */
.ob-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 8px;
}

.ob-back {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: none; cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--t);
}
.ob-back:hover { background: var(--bg-card-2); color: var(--text); }

.ob-progress-track {
  flex: 1; height: 3px;
  background: var(--border);
  border-radius: var(--r-full); overflow: hidden;
}

.ob-progress-fill {
  height: 100%;
  background: var(--purple);
  border-radius: var(--r-full);
  transition: width 0.4s ease;
}

/* Body */
.ob-body {
  flex: 1;
  padding: 24px 24px 32px;
  display: flex;
  flex-direction: column;
}

.ob-eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.ob-title {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 8px;
}

.ob-title span { color: var(--purple); }

.ob-sub {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 32px;
}

/* Phone input */
.phone-input-wrap {
  display: flex;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: var(--t);
  margin-bottom: 12px;
}

.phone-input-wrap:focus-within { border-color: var(--purple); }

.phone-flag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-right: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.phone-input {
  flex: 1;
  height: 56px;
  background: none;
  border: none;
  outline: none;
  padding: 0 16px;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 1px;
}

.phone-input::placeholder { color: var(--text-3); font-size: 16px; letter-spacing: 0; font-weight: 500; }

/* OTP input */
.otp-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}

.otp-box {
  width: 60px; height: 68px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  transition: var(--t);
  caret-color: var(--purple);
}

.otp-box:focus { border-color: var(--purple); background: var(--bg-card-2); }
.otp-box.filled { border-color: var(--purple); }

/* Username input */
.username-wrap {
  position: relative;
  margin-bottom: 12px;
}

.username-at {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 700;
  color: var(--purple);
  pointer-events: none;
}

.username-input {
  width: 100%;
  height: 56px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0 16px 0 36px;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  transition: var(--t);
}

.username-input:focus { border-color: var(--purple); }

/* Name input */
.text-input {
  width: 100%;
  height: 56px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0 16px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: var(--t);
  margin-bottom: 12px;
}

.text-input:focus { border-color: var(--purple); }
.text-input::placeholder { color: var(--text-3); }

/* Avatar picker */
.avatar-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 8px 0 24px;
}

.avatar-circle-big {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--purple-dim);
  border: 2px dashed var(--purple-mid);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 36px;
  transition: var(--t); position: relative;
}

.avatar-circle-big:hover { border-style: solid; background: var(--purple-dim); }

.avatar-add-badge {
  position: absolute; bottom: 0; right: 0;
  width: 24px; height: 24px;
  background: var(--purple);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  border: 2px solid var(--bg);
}

.avatar-pick-label { font-size: 13px; color: var(--text-2); font-weight: 500; }

/* ---- Primary CTA button ---- */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 54px;
  background: var(--accent);
  border: none; border-radius: var(--r-full);
  font-family: var(--font); font-size: 15px; font-weight: 800;
  color: #ffffff; cursor: pointer; transition: var(--t);
  letter-spacing: 0.1px;
  box-shadow: 0 4px 20px rgba(124,111,247,0.35);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 28px rgba(124,111,247,0.45); }
.btn-primary:active { transform: scale(0.98); box-shadow: none; }
.btn-primary:disabled { opacity: 0.32; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 48px;
  background: none; border: none;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  color: var(--text-2); cursor: pointer; transition: var(--t);
}
.btn-ghost:hover { color: var(--text); }

.ob-next-wrap { margin-top: auto; padding-top: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ====================================================
   MAIN APP
   ==================================================== */

/* Header */
.app-header {
  flex-shrink: 0;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.header-row {
  height: var(--header-h);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
}

.header-title {
  font-size: 18px; font-weight: 900;
  letter-spacing: -0.3px;
}

.header-title .dot { color: var(--purple); }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--t); flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-card-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.header-actions { display: flex; gap: 8px; }

/* Avatar small */
.avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  flex-shrink: 0; cursor: pointer;
}

/* Tab panels */
.tab-panel { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.tab-panel.active { display: flex; flex: 1; overflow: hidden; }

.tab-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + 16px);
  -webkit-overflow-scrolling: touch;
}
.tab-scroll::-webkit-scrollbar { display: none; }

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  height: var(--nav-h);
  background: rgba(13,13,18,0.96);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 1; padding: 10px 2px 6px;
  background: none; border: none; cursor: pointer;
  color: var(--text-nav); transition: color 0.15s ease;
  font-family: var(--font);
  position: relative;
}

.nav-btn svg { width: 22px; height: 22px; transition: transform 0.15s ease; }
.nav-btn:active svg { transform: scale(0.9); }

/* Active: accent violet icon + label, with pill indicator above icon */
.nav-btn.active { color: var(--accent); }
.nav-btn.active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--accent);
  border-radius: var(--r-full);
  animation: navPop 0.2s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes navPop {
  from { transform: translateX(-50%) scaleX(0.3); opacity: 0; }
  to   { transform: translateX(-50%) scaleX(1);   opacity: 1; }
}

.nav-lbl { font-size: 11px; font-weight: 700; letter-spacing: 0px; }

.nav-badge {
  position: absolute; top: 8px; right: calc(50% - 20px);
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

/* ====================================================
   HOME TAB
   ==================================================== */
.home-top {
  padding: 20px 16px 0;
  display: flex; justify-content: space-between; align-items: flex-start;
}

.home-greeting { font-size: 13px; color: var(--text-2); font-weight: 500; margin-bottom: 3px; }
.home-title { font-size: 26px; font-weight: 900; letter-spacing: -0.5px; }
.home-date { font-size: 13px; color: var(--text-2); margin-top: 2px; font-weight: 500; }

/* Quick action row */
.quick-actions {
  display: flex; gap: 8px;
  padding: 16px 16px 4px;
}

.quick-btn {
  flex: 1; height: 48px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-family: var(--font);
  font-size: 13px; font-weight: 700;
  color: var(--text-2);
  cursor: pointer; transition: var(--t);
  display: flex; align-items: center; justify-content: center; gap: 7px;
}

.quick-btn:hover { background: var(--bg-card-2); border-color: #3a3a50; color: var(--text); }

.quick-btn.primary {
  background: var(--purple-dim);
  border-color: var(--purple-mid);
  color: var(--purple);
}

.quick-btn.primary:hover { background: rgba(124,111,247,0.2); }

/* Friend availability strip */
.avail-strip {
  margin: 12px 16px;
  padding: 12px 14px;
  background: var(--green-dim);
  border: 1px solid rgba(52,211,153,0.2);
  border-radius: var(--r-lg);
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: var(--t);
}

.avail-strip:hover { background: rgba(52,211,153,0.12); }

.avail-avatars { display: flex; }
.avail-av {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  border: 2px solid var(--bg);
  margin-right: -8px;
}

.avail-text { flex: 1; font-size: 13px; font-weight: 600; color: var(--green); }
.avail-arrow { color: var(--green); font-size: 16px; }

/* Section header */
.sec-hd {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 16px 10px;
}

.sec-title { font-size: 16px; font-weight: 800; }
.sec-link { font-size: 13px; font-weight: 600; color: var(--purple); cursor: pointer; }
.sec-link:hover { opacity: 0.8; }

/* Today events */
.today-empty {
  margin: 0 16px;
  padding: 28px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  text-align: center;
}

.today-empty-icon { font-size: 36px; margin-bottom: 10px; }
.today-empty-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.today-empty-sub { font-size: 13px; color: var(--text-2); line-height: 1.5; }

/* Event card (home) */
.event-card-home {
  margin: 0 16px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  cursor: pointer;
  transition: var(--t);
}

.event-card-home:hover { background: var(--bg-card-2); }

.event-accent {
  width: 4px; flex-shrink: 0;
}

.event-card-body {
  padding: 12px 14px;
  flex: 1;
}

.event-time { font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.event-name { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.event-meta { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }

.vis-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
}

.vis-private { background: var(--red-dim); color: var(--red); }
.vis-friends { background: var(--purple-dim); color: var(--purple); }
.vis-public  { background: var(--green-dim); color: var(--green); }
.vis-busy    { background: var(--bg-card-2); color: var(--text-2); }

/* Upcoming plan card */
.plan-card-home {
  margin: 0 16px 8px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer; transition: var(--t);
}

.plan-card-home:hover { background: var(--bg-card-2); }

.plan-card-row { display: flex; align-items: center; gap: 12px; }
.plan-card-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

.plan-card-info { flex: 1; }
.plan-card-name { font-size: 15px; font-weight: 700; }
.plan-card-with { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.plan-card-time { font-size: 12px; font-weight: 700; margin-top: 4px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}

.status-pending  { background: var(--amber-dim); color: var(--amber); }
.status-accepted { background: var(--green-dim); color: var(--green); }
.status-declined { background: var(--red-dim); color: var(--red); }

/* ====================================================
   CALENDAR TAB
   ==================================================== */

/* Month nav */
.cal-month-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
}

.cal-month-title { font-size: 20px; font-weight: 900; }

.cal-nav-btns { display: flex; gap: 6px; }
.cal-nav-btn {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--t); font-size: 14px;
}
.cal-nav-btn:hover { background: var(--bg-card-2); color: var(--text); }

/* Day name row */
.cal-daynames {
  display: grid; grid-template-columns: repeat(7, 1fr);
  padding: 0 16px 8px;
}

.cal-dayname {
  text-align: center;
  font-size: 11px; font-weight: 700;
  color: var(--text-3); letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Calendar grid */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 16px 20px;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px;
  cursor: pointer;
  border-radius: var(--r-md);
  transition: var(--t);
  position: relative;
}

.cal-cell:hover { background: var(--bg-card); }

.cal-cell.empty { pointer-events: none; }
.cal-cell.other-month .cal-num { color: var(--text-3); }

.cal-num {
  font-size: 14px; font-weight: 600;
  color: var(--text-2);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}

/* Runna: today = white filled circle with dark text */
.cal-cell.today .cal-num {
  background: #ffffff;
  color: #111318;
  font-weight: 900;
}

/* Runna: selected = teal outlined circle */
.cal-cell.selected:not(.today) .cal-num {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 800;
  border: 1.5px solid var(--accent-mid);
}

/* Runna: event dots as small rounded squares */
.cal-dots { display: flex; gap: 2px; justify-content: center; }
.cal-dot { width: 5px; height: 5px; border-radius: 2px; }

/* Day detail panel */
.day-detail {
  padding: 0 16px 16px;
}

.day-detail-title {
  font-size: 16px; font-weight: 800;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.day-event-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
}

.day-event-row:last-child { border-bottom: none; }

.day-event-color {
  width: 3px; height: 36px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.day-event-info { flex: 1; }
.day-event-name { font-size: 14px; font-weight: 700; }
.day-event-time { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* Add event FAB */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  right: 20px;
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  color: #ffffff;
  font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(124,111,247,0.4);
  transition: var(--t);
  z-index: 90;
}

.fab:hover { background: var(--accent-hover); transform: scale(1.05); box-shadow: 0 6px 24px rgba(124,111,247,0.5); }
.fab:active { transform: scale(0.93); }

@media (min-width: 500px) { .fab { right: calc(50% - 215px + 16px); } }

/* ====================================================
   FRIENDS TAB
   ==================================================== */
.search-bar {
  margin: 14px 16px;
  height: 46px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  transition: var(--t);
}

.search-bar:focus-within { border-color: var(--purple); }

.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font); font-size: 14px; color: var(--text);
}

.search-bar input::placeholder { color: var(--text-3); }

/* Friend request card */
.friend-req {
  margin: 0 16px 8px;
  padding: 14px 16px;
  background: var(--purple-dim);
  border: 1px solid var(--purple-mid);
  border-radius: var(--r-lg);
  display: flex; align-items: center; gap: 12px;
}

.friend-req-info { flex: 1; }
.friend-req-name { font-size: 14px; font-weight: 700; }
.friend-req-handle { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.friend-req-actions { display: flex; gap: 6px; }

.btn-accept {
  height: 34px; padding: 0 14px;
  background: var(--purple);
  border: none; border-radius: var(--r-full);
  font-family: var(--font); font-size: 13px; font-weight: 700;
  color: white; cursor: pointer; transition: var(--t);
}
.btn-accept:hover { background: var(--purple-hover); }

.btn-decline {
  height: 34px; padding: 0 14px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-family: var(--font); font-size: 13px; font-weight: 700;
  color: var(--text-2); cursor: pointer; transition: var(--t);
}
.btn-decline:hover { color: var(--text); }

/* Friend row */
.friend-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer; transition: var(--t);
}

.friend-row:hover { background: rgba(255,255,255,0.02); }

.friend-info { flex: 1; }
.friend-name { font-size: 14px; font-weight: 700; }
.friend-handle { font-size: 12px; color: var(--text-2); margin-top: 1px; }

.avail-badge {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 700;
}

.avail-free    { background: var(--green-dim); color: var(--green); }
.avail-busy    { background: var(--red-dim); color: var(--red); }
.avail-soon    { background: var(--amber-dim); color: var(--amber); }
.avail-unknown { background: var(--bg-card-2); color: var(--text-2); }

.avail-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.btn-plan-quick {
  height: 32px; padding: 0 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-family: var(--font); font-size: 12px; font-weight: 700;
  color: var(--text-2); cursor: pointer; transition: var(--t);
}
.btn-plan-quick:hover { border-color: var(--purple); color: var(--purple); background: var(--purple-dim); }

/* Suggested users */
.suggest-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-2);
  transition: var(--t);
}

.btn-follow {
  height: 32px; padding: 0 14px;
  background: var(--purple-dim);
  border: 1px solid var(--purple-mid);
  border-radius: var(--r-full);
  font-family: var(--font); font-size: 12px; font-weight: 700;
  color: var(--purple); cursor: pointer; transition: var(--t);
}
.btn-follow:hover { background: var(--purple); color: white; }
.btn-follow.following { background: var(--bg-card-2); border-color: var(--border); color: var(--text-2); }

/* ====================================================
   PLANS TAB  (redesigned)
   ==================================================== */

/* ── Segmented control ─────────────────────────── */
.plans-tabs {
  display: flex;
  gap: 6px;
  padding: 14px 16px 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.plan-tab-btn {
  flex: 1;
  padding: 8px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
  color: var(--text-2);
  letter-spacing: 0.1px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.plan-tab-btn.active {
  background: rgba(124,111,247,0.15);
  border-color: rgba(124,111,247,0.5);
  color: #b4adff;
  box-shadow: 0 0 0 1px rgba(124,111,247,0.2) inset;
}

/* ── Section header used in Plans content ─── */
.plans-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 10px;
  margin-top: 4px;
}
.plans-section-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ── Plan request card (Incoming) ────────────── */
.plan-req-card {
  margin: 0 16px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.plan-req-card:active { transform: scale(0.985); }

.plan-req-header {
  padding: 16px 16px 12px;
  display: flex; align-items: flex-start; gap: 14px;
}

.plan-req-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.plan-req-info { flex: 1; min-width: 0; }
.plan-req-activity {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.plan-req-with {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
}

/* Divider row before details */
.plan-req-details {
  padding: 0 16px 14px;
  display: flex; gap: 20px;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 12px;
  margin: 0 16px;
}

.plan-req-detail {
  display: flex; flex-direction: column; gap: 3px;
}

.plan-req-detail-lbl {
  font-size: 9px; font-weight: 800;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px;
}

.plan-req-detail-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.plan-req-actions {
  padding: 12px 16px 14px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex; gap: 8px;
  margin-top: 2px;
}

.btn-accept-full {
  flex: 1; height: 44px;
  background: rgba(52,211,153,0.12);
  border: 1.5px solid rgba(52,211,153,0.3);
  border-radius: 12px;
  font-family: var(--font); font-size: 14px; font-weight: 800;
  color: var(--green); cursor: pointer; transition: var(--t);
  letter-spacing: 0.1px;
}
.btn-accept-full:hover { background: rgba(52,211,153,0.2); }

.btn-decline-full {
  width: 44px; height: 44px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: var(--font); font-size: 16px; font-weight: 700;
  color: var(--text-3); cursor: pointer; transition: var(--t);
  flex-shrink: 0;
}
.btn-decline-full:hover { color: var(--red); border-color: rgba(248,113,113,0.3); background: var(--red-dim); }

.btn-counter {
  height: 44px; padding: 0 16px;
  background: rgba(251,191,36,0.1);
  border: 1.5px solid rgba(251,191,36,0.25);
  border-radius: 12px;
  font-family: var(--font); font-size: 13px; font-weight: 800;
  color: var(--amber); cursor: pointer; transition: var(--t);
  white-space: nowrap;
}
.btn-counter:hover { background: rgba(251,191,36,0.18); }

/* ── Outgoing plan card ───────────────────────── */
.plan-out-card {
  margin: 0 16px 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  transition: transform 0.15s;
}
.plan-out-card:active { transform: scale(0.985); }

.plan-out-row { display: flex; align-items: center; gap: 12px; }

/* ====================================================
   PROFILE TAB
   ==================================================== */
.profile-hero {
  padding: 24px 16px 16px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}

.profile-av-big {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800;
  border: 3px solid var(--bg);
  margin-bottom: 14px;
}

.profile-name { font-size: 22px; font-weight: 900; margin-bottom: 4px; }
.profile-handle { font-size: 14px; color: var(--text-2); font-weight: 500; }

.profile-stats {
  display: flex;
  margin: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.profile-stat {
  flex: 1; padding: 16px 8px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.profile-stat:last-child { border-right: none; }

.profile-stat-val { font-size: 20px; font-weight: 900; }
.profile-stat-lbl { font-size: 10px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 3px; }

/* Settings list */
.settings-group {
  margin: 0 16px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.s-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer; transition: var(--t);
}

.s-row:last-child { border-bottom: none; }
.s-row:hover { background: rgba(255,255,255,0.02); }

.s-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}

.s-info { flex: 1; }
.s-title { font-size: 14px; font-weight: 600; }
.s-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.s-right { color: var(--text-3); font-size: 13px; display: flex; align-items: center; gap: 4px; }

/* ====================================================
   MODALS
   ==================================================== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  justify-content: flex-end;
  align-items: flex-end;
  max-width: 430px;
  left: 50%; transform: translateX(-50%);
}

.modal-overlay.open { display: flex; }

.modal {
  width: 100%;
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid rgba(255,255,255,0.07);
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.28s cubic-bezier(0.32,0.72,0,1) forwards;
}

@keyframes slideUp { from { transform: translateY(100%); opacity:0.6; } to { transform: translateY(0); opacity:1; } }

.modal-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: var(--r-full);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.modal-head {
  padding: 14px 20px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 { font-size: 16px; font-weight: 800; }

.modal-close {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: var(--bg-card-2); border: none;
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: var(--t);
}
.modal-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }

.modal-body { padding: 18px 20px 28px; }

/* Form inside modal */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-3); margin-bottom: 6px;
  letter-spacing: 0.6px; text-transform: uppercase;
}
.form-input {
  width: 100%; height: 50px;
  background: var(--bg-card-2); border: 1.5px solid var(--border);
  border-radius: var(--r-md); padding: 0 14px;
  font-family: var(--font); font-size: 15px; font-weight: 500; color: var(--text);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-3); }

/* Visibility selector */
.vis-select {
  display: flex; gap: 8px; flex-wrap: wrap;
}

.vis-opt {
  flex: 1; min-width: 80px;
  padding: 10px 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font); font-size: 12px; font-weight: 700;
  color: var(--text-2); cursor: pointer; transition: var(--t);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}

.vis-opt .vis-icon { font-size: 18px; }
.vis-opt:hover { border-color: #3a3a52; color: var(--text); }
.vis-opt.selected { border-color: var(--purple); background: var(--purple-dim); color: var(--purple); }

/* ====================================================
   TOAST
   ==================================================== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 80px);
  left: 50%; transform: translateX(-50%) translateY(12px);
  background: rgba(32,32,43,0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r-full);
  padding: 11px 22px;
  font-size: 14px; font-weight: 600;
  color: var(--text);
  opacity: 0; transition: all 0.24s cubic-bezier(0.32,0.72,0,1);
  z-index: 400; pointer-events: none;
  white-space: nowrap; max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

/* ====================================================
   UTILITIES
   ==================================================== */
.section-lbl {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 0 16px 10px;
}

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px; text-align: center; gap: 10px;
}

.empty-icon { font-size: 44px; opacity: 0.4; }
.empty-title { font-size: 18px; font-weight: 800; }
.empty-sub { font-size: 14px; color: var(--text-2); line-height: 1.55; }

/* ====================================================
   RECURRING EVENTS
   ==================================================== */

/* ↻ badge on recurring event rows */
.rec-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: var(--accent);
  background: var(--accent-dim);
  border-radius: 4px; padding: 1px 5px; margin-left: 5px;
  vertical-align: middle; letter-spacing: 0;
}

/* Repeat toggle row inside event form */
.repeat-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
}

.repeat-toggle-btn {
  height: 30px; padding: 0 16px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  font-family: var(--font); font-size: 12px; font-weight: 700;
  color: var(--text-2); cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.repeat-toggle-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* Day-of-week pill selector */
.repeat-day-picker {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.day-pill {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-card); border: 1.5px solid var(--border);
  font-family: var(--font); font-size: 12px; font-weight: 700;
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.day-pill.selected {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.day-pill:hover:not(.selected) {
  border-color: var(--accent); color: var(--accent);
}

/* Scope selection buttons (edit/delete recurring modals) */
.scope-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px 16px; margin-bottom: 8px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--r-md); cursor: pointer; text-align: left;
  font-family: var(--font); transition: border-color 0.15s, background 0.15s;
}
.scope-btn:hover { border-color: var(--accent); background: var(--accent-dim); }
.scope-btn.danger:hover { border-color: var(--red); background: var(--red-dim); }
.scope-btn-icon { font-size: 18px; flex-shrink: 0; }
.scope-btn-label { font-size: 14px; font-weight: 700; color: var(--text-1); }
.scope-btn-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.scope-btn.danger .scope-btn-label { color: var(--red); }
