/* FlushTime PWA styles. Mobile-first, dark theme, amber "light" accent. */

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #243244;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #f59e0b;
  --accent-strong: #fbbf24;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }

.screen { display: block; }

/* --- top bar --- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.topbar h1 { font-size: 22px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagline { color: var(--muted); margin: 4px 0 16px; }

/* --- headings / text --- */
h2 { font-size: 17px; margin: 18px 0 10px; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 10px 0; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; }
.meta-line { font-size: 15px; margin: 8px 0 14px; line-height: 1.5; }

/* --- buttons --- */
.btn {
  display: inline-block;
  border: 1px solid var(--surface-2);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a1206; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, .12); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }

.big { padding: 14px 18px; font-size: 16px; width: 100%; margin-top: 12px; }
.small { padding: 6px 10px; font-size: 13px; }
.open { padding: 8px 14px; white-space: nowrap; }

/* --- cards (nearby list) --- */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: var(--radius); padding: 14px;
}
.card-main { flex: 1; min-width: 0; }
.card-name { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* --- timer box --- */
.timer-box {
  background: var(--surface); border-radius: var(--radius);
  padding: 18px; text-align: center; margin: 14px 0;
}
.clock { font-size: 56px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; line-height: 1.1; }
.measured { color: var(--accent-strong); font-weight: 600; margin: 8px 0; min-height: 1.2em; }

/* progress bar */
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 14px 0; }
.progress-fill { height: 100%; width: 100%; background: var(--accent); border-radius: 999px; transition: width .25s linear; }

/* usage buttons */
.usage-row { display: flex; gap: 12px; margin-top: 8px; }
.usage-row .usage { flex: 1; }

/* --- forms / stack --- */
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
label { display: block; font-size: 14px; color: var(--muted); }
input[type="text"], input[type="number"] {
  width: 100%; margin-top: 6px; padding: 12px;
  background: var(--bg); border: 1px solid var(--surface-2); border-radius: 10px;
  color: var(--text); font-size: 16px;
}
input:focus { outline: none; border-color: var(--accent); }

.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; }

.photo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.photo-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--surface-2); }
.photo-full { width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius); margin-bottom: 12px; }

/* --- owner section --- */
.owner { margin-top: 26px; padding-top: 8px; border-top: 1px solid var(--surface-2); }

/* --- banner / toast / badge --- */
.banner { background: rgba(245, 158, 11, .14); border: 1px solid var(--accent); color: var(--accent-strong); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--accent);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: 90vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.badge { font-size: 12px; color: var(--muted); border: 1px solid var(--surface-2); border-radius: 999px; padding: 3px 8px; }
.badge.show { color: var(--danger); border-color: var(--danger); }
