/* PlayPal MVP - mobile-styled UI */
:root {
  --blue: #3e9bc4;
  --blue-dark: #2f7fa3;
  --blue-soft: #e8f4fa;
  --yellow: #f7b500;
  --yellow-soft: #fff4d6;
  --ink: #3a3f44;
  --muted: #8a929a;
  --line: #ececf0;
  --bg: #f4f6f8;
  --green: #34b27b;
  --red: #e0584b;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(40, 60, 80, 0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #eef3f6, #e7eef2);
}
body { display: flex; align-items: center; justify-content: center; padding: 16px; }

/* phone frame */
.phone {
  width: 100%; max-width: 412px; height: min(860px, 95vh);
  background: var(--bg); border-radius: 34px; overflow: hidden;
  box-shadow: var(--shadow); position: relative; display: flex; flex-direction: column;
  border: 8px solid #1c2530;
}
.screen { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen::-webkit-scrollbar { width: 0; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--blue-dark); font-size: 19px; }
.topbar .logo { width: 26px; height: 26px; }
.topbar .right { display: flex; gap: 14px; align-items: center; }
.icon-btn { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }

/* generic */
.pad { padding: 16px 18px 90px; }
h2.section { font-size: 15px; margin: 18px 2px 10px; color: var(--ink); }
.muted { color: var(--muted); }
.card {
  background: #fff; border-radius: var(--radius); padding: 14px;
  box-shadow: 0 2px 10px rgba(40,60,80,.05); margin-bottom: 12px;
}
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-size: 24px; background: var(--blue-soft); flex: none;
}
.avatar.lg { width: 64px; height: 64px; font-size: 34px; }
.avatar.sm { width: 34px; height: 34px; font-size: 18px; }
.name { font-weight: 700; }
.sub { font-size: 12.5px; color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; background: var(--blue-soft); color: var(--blue-dark);
}
.pill.green { background: #e3f6ee; color: var(--green); }
.pill.yellow { background: var(--yellow-soft); color: #9a7400; }
.pill.gray { background: #eef0f2; color: var(--muted); }
.tag {
  display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 20px;
  background: #f0f3f5; color: var(--muted); margin: 2px 3px 2px 0;
}
.verified { color: var(--blue); }

/* buttons */
.btn {
  border: none; border-radius: 12px; padding: 11px 14px; font-size: 14px; font-weight: 700;
  cursor: pointer; background: var(--blue); color: #fff; width: 100%;
  transition: transform .05s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:hover { filter: brightness(1.04); }
.btn.yellow { background: var(--yellow); color: #4a3a00; }
.btn.ghost { background: #fff; color: var(--blue-dark); border: 1.5px solid var(--blue); }
.btn.soft { background: var(--blue-soft); color: var(--blue-dark); }
.btn.sm { width: auto; padding: 7px 14px; font-size: 12.5px; border-radius: 20px; }
.btn.danger { background: #fdecea; color: var(--red); }
.btn-row { display: flex; gap: 8px; }

/* inputs */
label.fld { display: block; font-size: 12.5px; font-weight: 700; margin: 12px 2px 6px; color: var(--ink); }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
textarea { resize: vertical; min-height: 64px; }

/* chips selectable */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.chip {
  font-size: 12.5px; padding: 7px 12px; border-radius: 20px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; user-select: none; color: var(--ink);
}
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip.avatar-chip { font-size: 22px; padding: 5px 9px; }

/* tabs */
.tabs { display: flex; background: #eef0f2; border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.tabs button {
  flex: 1; border: none; background: none; padding: 9px; font-weight: 700; font-size: 13px;
  border-radius: 9px; cursor: pointer; color: var(--muted);
}
.tabs button.on { background: #fff; color: var(--blue-dark); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* bottom nav */
.nav {
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); gap: 2px;
}
.nav button {
  flex: 1; border: none; background: none; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; padding: 4px;
}
.nav button .ic { font-size: 19px; }
.nav button.on { color: var(--blue); }
.nav .fab {
  background: var(--blue); color: #fff; width: 46px; height: 46px; border-radius: 50%;
  margin-top: -18px; box-shadow: 0 6px 14px rgba(62,155,196,.45); font-size: 24px;
  display: grid; place-items: center;
}

/* map */
.map {
  position: relative; height: 240px; border-radius: var(--radius); overflow: hidden;
  background:
    linear-gradient(0deg, rgba(0,0,0,.02), rgba(0,0,0,.02)),
    repeating-linear-gradient(0deg, #dfeee6 0 24px, #d7e9df 24px 48px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.5) 0 1px, transparent 1px 48px);
  border: 1px solid var(--line); margin-bottom: 12px;
}
.map .pin {
  position: absolute; transform: translate(-50%, -50%); text-align: center;
  font-size: 11px; color: var(--ink); width: 70px;
}
.map .pin .dot {
  width: 38px; height: 38px; border-radius: 50%; background: #fff; margin: 0 auto 2px;
  display: grid; place-items: center; font-size: 20px; box-shadow: 0 3px 8px rgba(0,0,0,.18);
  border: 2px solid var(--blue);
}
.map .pin.me .dot { border-color: var(--yellow); }
.map .pin.venue .dot { border-color: var(--green); }
.map .pin .lbl { background: rgba(255,255,255,.85); border-radius: 6px; padding: 0 4px; font-weight: 600; }

/* chat */
.chat-wrap { display: flex; flex-direction: column; height: 100%; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.chat-body { flex: 1; overflow-y: auto; padding: 14px 16px; background: var(--blue-soft); }
.bubble { max-width: 76%; padding: 9px 13px; border-radius: 16px; margin-bottom: 9px; font-size: 14px; line-height: 1.35; }
.bubble.them { background: #fff; border-bottom-left-radius: 4px; }
.bubble.me { background: var(--blue); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.bubble .t { font-size: 10px; opacity: .6; margin-top: 3px; }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.chat-input input { border-radius: 22px; }
.chat-input button { width: auto; padding: 0 16px; border-radius: 22px; }
.safety-note { font-size: 11px; color: var(--muted); text-align: center; padding: 6px; background: var(--yellow-soft); }

/* login */
.auth { padding: 30px 24px; display: flex; flex-direction: column; height: 100%; justify-content: center; }
.auth .logo-big { width: 92px; height: 92px; margin: 0 auto 8px; display: block; }
.auth h1 { text-align: center; color: var(--blue-dark); margin: 0 0 2px; }
.auth .tagline { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth .switch { text-align: center; font-size: 13px; margin-top: 14px; }
.auth .switch a { color: var(--blue); font-weight: 700; cursor: pointer; }
.err { background: #fdecea; color: var(--red); padding: 10px; border-radius: 10px; font-size: 13px; margin-top: 10px; }
.demo-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; background: var(--blue-soft); padding: 8px; border-radius: 10px; }

/* score ring */
.score { font-weight: 800; color: var(--blue-dark); font-size: 13px; }
.score .bar { height: 6px; border-radius: 6px; background: #eef0f2; margin-top: 4px; overflow: hidden; }
.score .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); }

/* toast */
.toast {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 24px; font-size: 13px;
  opacity: 0; transition: opacity .25s ease, transform .25s ease; pointer-events: none; z-index: 20; max-width: 86%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* modal */
.modal-bg {
  position: absolute; inset: 0; background: rgba(20,30,40,.45); display: none;
  align-items: flex-end; z-index: 30;
}
.modal-bg.show { display: flex; }
.modal { background: #fff; width: 100%; border-radius: 22px 22px 0 0; padding: 18px; max-height: 86%; overflow-y: auto; }
.modal h3 { margin: 2px 0 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.hidden { display: none !important; }
.center { text-align: center; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.badge-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); display: inline-block; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.cal .dow { text-align: center; font-size: 10.5px; color: var(--muted); font-weight: 700; padding: 2px 0; }
.cal .cell {
  aspect-ratio: 1; border-radius: 10px; background: #fff; border: 1px solid var(--line);
  padding: 3px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.cal .cell.empty { background: transparent; border: none; cursor: default; }
.cal .cell.today .num { color: var(--blue-dark); font-weight: 800; }
.cal .cell.today { border-color: var(--blue); }
.cal .cell.sel { background: var(--blue-soft); border-color: var(--blue); }
.cal .num { font-size: 12.5px; font-weight: 600; }
.cal .dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.cal .dot2 { width: 5px; height: 5px; border-radius: 50%; background: var(--blue); }
.cal .dot2.personal { background: var(--yellow); }
.cal .dot2.mine { background: var(--green); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-head button { background: none; border: none; font-size: 20px; color: var(--blue-dark); cursor: pointer; padding: 4px 10px; }
.cal-head .mlabel { font-weight: 800; }

.ev-when { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.attendee { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.seg { display: flex; gap: 6px; margin: 6px 0; }
.seg .opt { flex: 1; text-align: center; padding: 9px; border-radius: 10px; border: 1.5px solid var(--line); font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg .opt.on { border-color: var(--blue); color: var(--blue-dark); background: var(--blue-soft); }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--blue-soft); margin-bottom: 8px; cursor: pointer; font-weight: 700; color: var(--blue-dark); }
.menu-item .mi-ic { font-size: 22px; }

/* notification badges */
.nbadge {
  position: absolute; top: -4px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff;
}
.nav button .nbadge { top: 0; right: 24px; }
.notif { display: flex; gap: 11px; padding: 12px; border-radius: 12px; background: #fff; margin-bottom: 8px; cursor: pointer; align-items: flex-start; box-shadow: 0 2px 10px rgba(40,60,80,.05); }
.notif.unread { background: var(--blue-soft); }
.notif .nic { width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 20px; flex: none; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.notif .ntitle { font-weight: 700; font-size: 13.5px; }
.notif .nbody { font-size: 12.5px; color: var(--muted); }
.notif .ndot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: none; margin-top: 6px; }

/* ---- accessibility & inclusion ---- */
/* Calm / sensory-friendly mode: no motion, gentler colour. */
:root[data-calm="on"] * { animation: none !important; transition: none !important; }
:root[data-calm="on"] .screen { filter: saturate(0.72); }
/* Larger text — zoom the scrollable content. */
:root[data-text="large"] .screen { zoom: 1.14; }
/* High contrast — firmer lines and darker ink. */
:root[data-contrast="high"] {
  --ink: #10151a; --muted: #414b54; --line: #b9c2ca;
}
:root[data-contrast="high"] .card,
:root[data-contrast="high"] input,
:root[data-contrast="high"] select,
:root[data-contrast="high"] textarea { border: 1.5px solid #6b7883; }
:root[data-contrast="high"] .sub { color: #414b54; }

/* Right-to-left (Arabic) */
[dir="rtl"] body { direction: rtl; }
[dir="rtl"] .topbar .right { flex-direction: row-reverse; }
[dir="rtl"] .cal-head button { transform: scaleX(-1); }

.a11y-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.a11y-row .lbl b { display: block; font-size: 14px; }
.a11y-row .lbl span { font-size: 12px; color: var(--muted); }
/* iOS-style switch */
.sw { position: relative; width: 44px; height: 26px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw i { position: absolute; inset: 0; background: var(--line); border-radius: 20px; transition: background .15s; cursor: pointer; }
.sw i::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.sw input:checked + i { background: var(--green); }
.sw input:checked + i::after { transform: translateX(18px); }
.faq { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.faq b { display: block; margin-bottom: 4px; }
.faq p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
