/* =====================================================================
   style.css  -  How the website looks
   Tip: the colours are all listed in :root below. Change them there
   and the whole website changes.
   ===================================================================== */

:root {
  --ink: #10253a;          /* main text, dark navy */
  --ink-soft: #5b6b7c;     /* lighter text */
  --line: #e3e8ee;         /* thin borders */
  --bg: #f3f6f9;           /* page background */
  --card: #ffffff;
  --brand: #0d7a78;        /* teal */
  --brand-dark: #095c5a;
  --paid: #1c9a57;         /* green */
  --paid-bg: #e4f6ec;
  --unpaid: #e0482a;       /* red-orange */
  --unpaid-bg: #fdeae5;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(16, 37, 58, 0.14);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }
button, input { font-family: inherit; font-size: inherit; }
.muted { color: var(--ink-soft); }


/* ---------------------------------------------------------------------
   BUTTONS
   --------------------------------------------------------------------- */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(13, 122, 120, 0.3); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink-soft); background: #fff; }

.btn-block { width: 100%; }
.btn-small { padding: 7px 14px; background: rgba(255, 255, 255, 0.2); color: #fff; flex: none; }


/* ---------------------------------------------------------------------
   LANGUAGE SWITCHER (EN / BM)
   --------------------------------------------------------------------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.lang-btn {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.lang-btn:hover {
  color: var(--ink);
}

.lang-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(16, 37, 58, 0.12);
}

/* Switcher inside dark topbar on map.html */
.topbar .lang-switch {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.topbar .lang-btn {
  color: rgba(255, 255, 255, 0.78);
}

.topbar .lang-btn:hover {
  color: #fff;
}

.topbar .lang-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

/* Positioning on login card */
.login-card { position: relative; }
.login-card .lang-switch {
  position: absolute;
  top: 24px;
  right: 24px;
}


/* ---------------------------------------------------------------------
   BRAND (logo + name)
   --------------------------------------------------------------------- */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand strong { display: block; font-size: 17px; line-height: 1.2; }
.brand small { display: block; font-size: 12px; opacity: 0.75; }
.brand-mark {
  flex: none;
  display: block;
  width: 48px; height: 48px;
  object-fit: contain;
  border-radius: 12px;
  padding: 2px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(16, 37, 58, 0.16);
}
.brand-dark small { color: var(--ink-soft); opacity: 1; }


/* =====================================================================
   LOGIN PAGE
   ===================================================================== */
.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}

/* ---- Left decorative panel ---- */
.login-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 56px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 15%, rgba(20, 179, 168, 0.55), transparent 55%),
    linear-gradient(160deg, #0b3b4a 0%, #10253a 100%);
}

/* A grid of faint lines, like a street map */
.hero-map {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
}

.hero-pin {
  position: absolute;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 3px solid #fff;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: float 5s ease-in-out infinite;
}
.hero-pin.paid { background: var(--paid); }
.hero-pin.unpaid { background: var(--unpaid); }
.hp1 { top: 12%; left: 62%; }
.hp2 { top: 24%; left: 24%; animation-delay: -1s; }
.hp3 { top: 38%; left: 74%; animation-delay: -2s; }
.hp4 { top: 50%; left: 40%; animation-delay: -3s; }
.hp5 { top: 18%; left: 44%; animation-delay: -1.5s; }
.hp6 { top: 58%; left: 14%; animation-delay: -2.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.hero-text { position: relative; max-width: 460px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 700;
  color: #7fe0d8;
  margin-bottom: 12px;
}
.login-hero h1 { font-size: 46px; line-height: 1.05; font-weight: 800; margin-bottom: 16px; }
.hero-sub { font-size: 17px; line-height: 1.6; opacity: 0.85; margin-bottom: 24px; }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-weight: 600; }
.hero-points li { display: flex; align-items: center; gap: 10px; }

.dot {
  flex: none;
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
}
.dot.paid { background: var(--paid); }
.dot.unpaid { background: var(--unpaid); }

/* ---- Right side: the form ---- */
.login-panel {
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.login-card .brand { margin-bottom: 24px; padding-right: 84px; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  background: var(--bg);
  border-radius: 12px;
}
.tab {
  border: 0;
  background: transparent;
  padding: 10px;
  border-radius: 9px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(16, 37, 58, 0.12); }

.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.hint { font-weight: 500; color: var(--ink-soft); }
.form input, .pay-form input, .search-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 500;
}
.form input:focus, .pay-form input:focus, .search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 122, 120, 0.15);
}
.fine-print { font-size: 12px; color: var(--ink-soft); line-height: 1.5; text-align: center; }

.message {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 600;
}
.message-error { background: var(--unpaid-bg); color: #a42c14; }
.message-success { background: var(--paid-bg); color: #13663a; }
.message-info { background: #e6f1fb; color: #1b5a93; }


/* =====================================================================
   MAP PAGE: LAYOUT
   ===================================================================== */
.app-body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  min-height: 62px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  color: #fff;
  background: linear-gradient(90deg, #0b3b4a, #10253a);
}
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.user-name { font-size: 14px; font-weight: 600; opacity: 0.9; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.35); padding: 8px 14px; white-space: nowrap; }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; }

.app-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 390px 1fr;
}


/* =====================================================================
   SIDEBAR
   ===================================================================== */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
}

/* ---- Summary cards ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 16px 12px;
}
.stat {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
}
.stat-label { display: block; font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.stat strong { display: block; margin-top: 2px; font-size: 22px; font-weight: 800; }
.stat-paid { background: var(--paid-bg); }
.stat-paid strong { color: var(--paid); }
.stat-unpaid { background: var(--unpaid-bg); }
.stat-unpaid strong { color: var(--unpaid); }
.stat-wide { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.stat-wide strong { font-size: 20px; white-space: nowrap; }

.progress {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 99px;
  background: var(--unpaid-bg);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--paid);
  transition: width 0.5s ease;
}
.progress-text { grid-column: 1 / -1; font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-top: -4px; }

/* ---- Search ---- */
.search-area { padding: 4px 16px 10px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--line);
  border-radius: 99px;
  background: #fff;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.chip-btn:hover { border-color: var(--ink-soft); }
.chip-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.result-count { margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }

/* ---- List ---- */
.result-list { flex: 1; overflow-y: auto; padding: 8px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-soft); font-size: 14px; }

.list-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.list-item:hover { background: var(--bg); }
.list-item.active { background: #e3f4f3; box-shadow: inset 3px 0 0 var(--brand); }
.list-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.list-dot.paid { background: var(--paid); }
.list-dot.unpaid { background: var(--unpaid); }
.list-main { flex: 1; min-width: 0; }
.list-main strong { display: block; font-size: 15px; }
.list-main small { display: block; color: var(--ink-soft); font-size: 12px; }
.list-amount { font-weight: 800; font-size: 13px; white-space: nowrap; }
.list-amount.paid { color: var(--paid); }
.list-amount.unpaid { color: var(--unpaid); }


/* =====================================================================
   MAP + THINGS ON TOP OF IT
   ===================================================================== */
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; z-index: 1; }
#map.placing { cursor: crosshair; }
.leaflet-container { font-family: var(--font); }

/* Pins */
.pin-wrap { background: transparent; border: 0; }
.pin {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 3px solid #fff;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s;
}
.pin:hover { transform: scale(1.15); }
.pin-paid { background: var(--paid); }
.pin-unpaid { background: var(--unpaid); }
.pin-selected {
  transform: scale(1.35);
  box-shadow: 0 0 0 7px rgba(13, 122, 120, 0.4), 0 3px 10px rgba(0, 0, 0, 0.4);
}

.legend {
  position: absolute;
  left: 14px; bottom: 24px;
  z-index: 800;
  display: flex; gap: 14px;
  padding: 8px 14px;
  border-radius: 99px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
}
.legend span { display: flex; align-items: center; gap: 6px; }

.place-banner {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px 10px 18px;
  border-radius: 99px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
}
.place-banner span { min-width: 0; }


/* =====================================================================
   DETAILS PANEL
   ===================================================================== */
.detail {
  position: absolute;
  top: 16px; right: 16px;
  z-index: 850;
  width: 340px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  animation: slide-in 0.2s ease-out;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.detail-head h2 { font-size: 26px; font-weight: 800; margin-top: 8px; }
.icon-btn {
  width: 34px; height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--bg);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
}
.icon-btn:hover { background: var(--line); }

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.badge-paid { background: var(--paid-bg); color: var(--paid); }
.badge-unpaid { background: var(--unpaid-bg); color: var(--unpaid); }

.balance {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 14px;
  display: grid;
  gap: 2px;
}
.balance span { font-size: 12px; font-weight: 700; }
.balance strong { font-size: 28px; font-weight: 800; }
.balance.paid { background: var(--paid-bg); color: var(--paid); }
.balance.unpaid { background: var(--unpaid-bg); color: var(--unpaid); }

.info { margin: 0 0 14px; display: grid; gap: 10px; }
.info dt { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.info dd { margin: 2px 0 0; font-weight: 600; }

.amounts { width: 100%; border-collapse: collapse; font-size: 14px; }
.amounts td { padding: 9px 0; border-top: 1px solid var(--line); }
.amounts td:last-child { text-align: right; font-weight: 700; }

.detail-actions { display: grid; gap: 10px; margin-top: 18px; }

.pay-form { display: grid; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 2px solid var(--line); }
.pay-form h3 { font-size: 16px; }
.pay-form label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; }
.pay-form .row { display: flex; gap: 10px; }


/* =====================================================================
   FULL-SCREEN MESSAGE + TOAST
   ===================================================================== */
.gate {
  position: fixed; inset: 0;
  z-index: 3000;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(16, 37, 58, 0.78);
  backdrop-filter: blur(4px);
}
.gate-card {
  width: 100%; max-width: 420px;
  padding: 32px;
  border-radius: 20px;
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow);
}
.gate-icon { font-size: 44px; margin-bottom: 8px; }
.gate-card h2 { font-size: 22px; margin-bottom: 10px; }
.gate-card p { color: var(--ink-soft); line-height: 1.6; margin-bottom: 22px; }
.gate-actions { display: flex; gap: 10px; justify-content: center; }

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  z-index: 4000;
  max-width: 90vw;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
}


/* =====================================================================
   PHONES AND SMALL SCREENS
   ===================================================================== */
@media (max-width: 860px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-hero { display: none; }

  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 46vh 1fr;
  }
  .map-wrap { order: -1; }
  .sidebar { border-right: 0; border-top: 1px solid var(--line); }
  .user-name { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); padding: 12px; }
  .stat strong { font-size: 18px; }

  .detail {
    top: auto; right: 8px; left: 8px; bottom: 8px;
    width: auto;
    max-height: 85%;
  }
  .legend { display: none; }
}