/* style.css — Light glassmorphism UI (MrQR-style) */
:root {
  --accent: #5D5FEF;
  --accent-2: #8E8FF5;
  --accent-soft: #e9e8ff;
  --ink: #2A2745;
  --muted: #8B88A8;
  --ok: #2ecc71;
  --err: #ff5c7a;

  --card: rgba(255, 255, 255, 0.62);
  --card-strong: rgba(255, 255, 255, 0.82);
  --card-border: rgba(255, 255, 255, 0.75);
  --radius: 24px;
  --shadow: 0 12px 34px rgba(93, 95, 239, 0.14);
  --shadow-sm: 0 6px 18px rgba(93, 95, 239, 0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 90% -5%, rgba(142, 143, 245, 0.30), transparent 55%),
    radial-gradient(800px 460px at -10% 8%, rgba(214, 196, 240, 0.40), transparent 55%),
    linear-gradient(165deg, #ece7f7 0%, #e3e4f5 45%, #e9ecf8 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 20px 130px;
  position: relative;
}

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2px;
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: 0.2px; color: var(--ink); }
.logo b { color: var(--accent); font-weight: 800; }
.icon-btn {
  width: 44px; height: 44px; border: 0; cursor: pointer;
  border-radius: 14px;
  background: var(--card-strong);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---- Headings ---- */
.headline { margin: 4px 0 2px; font-size: 34px; line-height: 1.08; font-weight: 800; letter-spacing: -0.5px; }
.headline .em { color: var(--accent); display: block; }
.subhead { margin: 0; color: var(--muted); font-size: 15px; }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 22px;
}

/* ---- Counter ---- */
.counter { text-align: center; }
.counter .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1.6px; font-weight: 700; }
.counter .value {
  font-size: 68px; font-weight: 800; line-height: 1; margin: 8px 0 0;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.counter .value.bump { animation: bump 0.4s ease; }
@keyframes bump { 0%{transform:scale(1)} 40%{transform:scale(1.16)} 100%{transform:scale(1)} }

/* ---- QR card (home) ---- */
.qr-card { text-align: center; }
.qr-tile {
  display: inline-block; margin: 4px auto 0;
  background: #fff; padding: 18px; border-radius: 26px;
  box-shadow: 0 16px 40px rgba(93,95,239,0.22);
}
.qr-tile img, .qr-tile canvas { display: block; width: 220px; height: 220px; }
.qr-card h2 { margin: 18px 0 4px; font-size: 22px; font-weight: 800; }
.qr-card .em { color: var(--accent); }
.qr-card p { margin: 0 auto; color: var(--muted); font-size: 14px; max-width: 280px; }

.actions { display: flex; gap: 14px; justify-content: center; margin-top: 18px; }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; cursor: pointer; color: var(--ink); font-weight: 700; font-size: 13px;
}
.action .bubble {
  width: 54px; height: 54px; border-radius: 18px;
  background: var(--card-strong); border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.action:active .bubble { transform: scale(0.95); }
.action svg { width: 24px; height: 24px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 0; cursor: pointer;
  padding: 16px 18px; border-radius: 16px;
  font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px rgba(93,95,239,0.36);
  transition: transform 0.08s ease;
}
.btn:active { transform: scale(0.97); }
.btn.secondary {
  background: var(--card-strong); color: var(--accent);
  border: 1px solid var(--card-border); box-shadow: var(--shadow-sm);
}
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; border: 1px solid transparent; }

/* ---- Scanner ---- */
.scanner {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  border-radius: 22px; overflow: hidden; background: rgba(42,39,69,0.06);
}
#reader { width: 100%; height: 100%; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
/* γωνιακά πλαίσια */
.frame { position: absolute; inset: 0; pointer-events: none; }
.frame span {
  position: absolute; width: 36px; height: 36px;
  border: 4px solid var(--accent); border-radius: 6px;
}
.frame .tl { top: 16px; left: 16px; border-right: 0; border-bottom: 0; }
.frame .tr { top: 16px; right: 16px; border-left: 0; border-bottom: 0; }
.frame .bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; }
.frame .br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; }
.scanline {
  position: absolute; left: 16px; right: 16px; height: 3px; top: 20px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 14px var(--accent);
  animation: sweep 2.4s ease-in-out infinite; display: none;
}
.scanner.live .scanline { display: block; }
@keyframes sweep { 0%{top:20px} 50%{top:calc(100% - 24px)} 100%{top:20px} }

.scan-status { text-align: center; margin-top: 14px; }
.scan-status .pill {
  display: inline-block; padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: var(--card-strong); border: 1px solid var(--card-border); color: var(--muted);
}
.scan-status .pill.ok { background: rgba(46,204,113,0.16); color: #1f9d5b; border-color: transparent; }
.scan-status .pill.err { background: rgba(255,92,122,0.16); color: #d63a5a; border-color: transparent; }

/* μικρό chip συνόλου */
.chip {
  display: inline-flex; align-items: center; gap: 8px; align-self: center;
  padding: 8px 16px; border-radius: 999px; font-weight: 700; color: var(--accent);
  background: var(--card-strong); border: 1px solid var(--card-border); box-shadow: var(--shadow-sm);
}
.chip b { font-size: 17px; }

/* ---- Επιτυχημένο flash ---- */
.flash {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: center; justify-content: center; flex-direction: column;
  background: rgba(236,231,247,0.78); backdrop-filter: blur(8px);
}
.flash.show { display: flex; animation: fade 0.2s ease; }
.flash .check {
  width: 130px; height: 130px; border-radius: 50%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 70px; color: #fff; box-shadow: 0 18px 50px rgba(93,95,239,0.5);
  animation: pop 0.35s ease;
}
.flash .big { margin-top: 18px; font-size: 40px; font-weight: 800; color: var(--ink); }
.flash .sub { color: var(--muted); margin-top: 2px; }
@keyframes pop { 0%{transform:scale(0.5);opacity:0} 100%{transform:scale(1);opacity:1} }
@keyframes fade { from{opacity:0} to{opacity:1} }

/* ---- Λίστα (history) ---- */
.list { display: flex; flex-direction: column; gap: 12px; }
.row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.row .tile {
  width: 46px; height: 46px; flex: none; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), #f3f1ff);
}
.row .tile svg { width: 24px; height: 24px; }
.row .info { flex: 1; min-width: 0; }
.row .info .name { font-weight: 700; font-size: 16px; }
.row .info .meta { color: var(--muted); font-size: 13px; }
.row .time { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

.empty {
  text-align: center; color: var(--muted); padding: 40px 10px;
}
.empty svg { width: 54px; height: 54px; color: var(--accent-2); opacity: 0.6; margin-bottom: 10px; }

/* ---- Bottom tab bar ---- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 440px; z-index: 40;
  display: flex; justify-content: space-around; align-items: center;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.72);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border-top: 1px solid var(--card-border);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -10px 34px rgba(93,95,239,0.12);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700;
}
.tab svg { width: 25px; height: 25px; }
.tab.active { color: var(--accent); }
.tab.active svg { filter: drop-shadow(0 4px 8px rgba(93,95,239,0.4)); }

.foot { text-align: center; color: var(--muted); font-size: 12px; opacity: 0.7; }

/* ---- Input (login) ---- */
.field {
  width: 100%; padding: 16px 18px; border-radius: 16px;
  border: 1px solid var(--card-border); background: var(--card-strong); color: var(--ink);
  font-size: 22px; text-align: center; letter-spacing: 8px; font-weight: 800;
  outline: none; transition: box-shadow .15s ease, border-color .15s ease;
}
.field::placeholder { letter-spacing: 8px; color: #c3c0d8; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(93,95,239,0.18); }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 14px;
  font-weight: 600; font-size: 14px; max-width: 320px; text-align: center;
  box-shadow: 0 14px 34px rgba(42,39,69,0.35);
  opacity: 0; transition: .25s ease; z-index: 80; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
