/* =========================================================
   QR-ID Attendance (Login/Signup shared stylesheet)
   - Top purple band
   - Grey panel with overlapping logo
   - Peach band with actions
   - Includes signup feedback cards: wait/error/ok
   ========================================================= */

/* ===== Theme ===== */
:root{
  --purple: #8f61a5;
  --purple-dark:#7a4e91;
  --panel:#aaaaaa;
  --peach:#efc0a8;
  --ink:#111;
  --ink-invert:#fff;

  --top-h: 200px;
  --bottom-h: 135px;

  --btn-h: clamp(44px, 6vh, 60px);
  --peach-h: calc(var(--btn-h) + 10px);

  --logo-d: clamp(110px, 18vw, 160px);
  --card-w: clamp(300px, 88vw, 420px);

  --radius-xl: 32px;
  --radius-pill: 999px;

  --shadow: 0 10px 30px rgba(0,0,0,.10);
}

*{ box-sizing:border-box; }

html, body{
  height:100%;
  overscroll-behavior:none;
  background: var(--purple);
}

body{
  margin:0;
  background: var(--purple);
  color: var(--ink);
  font:16px/1.4 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  min-height:100svh;
}

/* ===== Layout shell (allow page to grow) ===== */
.shell{
  min-height:100svh;  
  height:auto;        
  display:grid;
  grid-template-rows:
    minmax(140px, var(--top-h))                 
    auto                                        
    minmax(var(--peach-h), max-content)         
    minmax(80px, var(--bottom-h));             
  overflow:visible;                              
}

.band{
  display:grid;
  place-items:center;
  color: var(--ink-invert);
}

/* ===== Top band ===== */
.band--top{
  background: var(--purple);
  position:relative;
  display:block;
  height: var(--top-h);
  padding-top: env(safe-area-inset-top);
}

/* Center title between viewport top and top of logo circle */
.band--top .appTitle{
  position:absolute;
  left:0; right:0;
  top: calc((var(--top-h) - (var(--logo-d) / 2)) / 2);
  transform: translateY(-50%);
  margin:0;
  text-align:center;
  line-height:1;
}

.appTitle{
  padding:0 16px;
  font-size: clamp(24px, 4.6vw, 40px);
  letter-spacing:.5px;
  font-weight:800;
  text-align:center;
}

/* ===== Peach band ===== */
.band--peach{
  background: var(--peach);
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: calc(var(--btn-h) * 3 + 40px);
  padding:12px 0;
  padding-bottom: max(env(safe-area-inset-bottom), 12px);

 
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

/* ===== Bottom band ===== */
.band--bottom{
  background: var(--purple);
  padding-bottom: max(env(safe-area-inset-bottom), 0px);
}

/* ===== Grey panel ===== */
.panel{
  background: var(--panel);
  position:relative;
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: var(--shadow) inset;
  display:grid;
  place-items:start center; 
  padding-top: calc(var(--logo-d) / 2 + 20px); 
  padding-bottom: 24px; 
}

.logoBadge{
  position:absolute;
  top: calc(-1 * var(--logo-d) / 2);
  left:0; right:0;
  display:grid;
  place-items:center;
  pointer-events:none;
}

.logoCircle{
  width: var(--logo-d);
  height: var(--logo-d);
  background:#fff;
  border-radius:50%;
  display:grid;
  place-items:center;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}

.logoCircle img{
  width: calc(var(--logo-d) - 36px);
  height: calc(var(--logo-d) - 36px);
  object-fit:contain;
}

/* ===== Card ===== */
.card{
  width: var(--card-w);
  margin: 0 auto;
  padding: 8px 8px 0;
}

.cardTitle{
  margin: 0 0 14px;
  color:#fff;
  font-size: clamp(24px, 4.5vw, 34px);
  font-weight:800;
}

/* Labels */
.label{
  display:block;
  font-size:14px;
  font-weight: 500;
  color:#f5f5f5;
  margin: 18px 2px 4px;
}

/* Input wraps */
.inputWrap{
  position:relative;
  margin-bottom:9px;
}

input{
  width:100%;
  height:50px;
  border-radius: var(--radius-pill);
  border:none;
  padding: 0 18px;
  font-size:16px;
  background:#fff;
  color: var(--ink);
  outline: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}

input::placeholder{ color:#777; }
input:focus{ outline-color:#ddd; }

/* Optional: extra bottom padding for password field */
#password{ padding-bottom: 8px; }

/* Peek button (hold to peek) */
.peek{
  position:absolute;
  right:12px;
  top:50%;
  transform: translateY(-50%);
  height:36px;
  min-width:36px;
  border-radius:18px;
  border:none;
  background:transparent;
  cursor:pointer;
  font-size:16px;
  opacity:.6;
  transition: opacity .2s ease;
}

.peek:hover{ opacity:1; }

/* Inline message (login page) */
#loginMsg{
  min-height:18px;
  color:#fff;
  margin: 6px 2px 0;
  padding-bottom: 8px;
}

/* ===== Small helper text ===== */
.hint{
  font-size:11px;
  font-style: italic;          
  color: rgba(255,255,255,.85);
  margin: 2px 2px 6px;       
}


/* ===== Buttons in peach band ===== */
.peachActions{
  display:flex;
  flex-direction:column; /* stacked on mobile */
  align-items:center;
  gap:10px;
}

/* Main button (login) */
.loginBtn{
  height: var(--btn-h);
  width: 200px;
  line-height:1;
  padding: 0 28px;
  border-radius: var(--radius-pill);
  border:2px solid #fff;
  background:transparent;
  color:#fff;
  font-weight:700;
  font-size: clamp(16px, 2.4vw, 18px);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  text-decoration:none;
  cursor:pointer;
}

/* Links styled as buttons */
.peachActions a{
  height: var(--btn-h);
  width: 200px;
  line-height:1;
  padding: 0 28px;
  border-radius: var(--radius-pill);
  border:2px solid #fff;
  background:transparent;
  color:#fff;
  font-weight:700;
  font-size: clamp(16px, 2.4vw, 18px);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  text-decoration:none;
  pointer-events:auto;
  cursor:pointer;
}

/* Hover/focus states */
.loginBtn:hover,
.peachActions a:hover{
  background:#fff;
  color: var(--purple);
}

.loginBtn:focus-visible,
.peachActions a:focus-visible{
  outline: 3px solid rgba(255,255,255,.85);
  outline-offset: 2px;
  border-color:#fff;
}

/* Disabled state (only used during network calls) */
.loginBtn:disabled{
  opacity:.65;
  cursor:not-allowed;
}

/* ===== Signup feedback cards (below button) ===== */
.wait, .error, .ok{
  width:100%;
  margin-top:10px;
  padding:12px 14px;
  border-radius:18px;
  text-align:left;
}

/* WAIT: off white*/
.wait{
  background: rgba(255,255,255,.22);
  border: 2px solid rgba(255,255,255,.55);
  color:#fff;
}
.wait-title{
  font-weight:900;
  margin-bottom:6px;
}

/* ERROR: red-ish */
.error{
  background: rgba(140,0,0,.12);
  border: 2px solid rgba(140,0,0,.35);
  color:#111;
}
.err-title{
  font-weight:900;
  margin-bottom:6px;
}
#errorCard ul{
  margin: 8px 0 0 18px;
  padding:0;
}

/* OK: green-ish */
.ok{
  background: rgba(0,120,0,.12);
  border: 2px solid rgba(0,120,0,.35);
  color:#111;
}
.ok-title{
  font-weight:900;
  margin-bottom:6px;
}

/* Footer note (signup page uses class "foot") */
.foot{
  color: rgba(255,255,255,.9);
}

/* ===== Side-by-side inputs on desktop (kept for compatibility) ===== */
.formRow{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.inputBlock{ flex:1; }

/* ===== Desktop adjustments ===== */
@media (min-width: 900px){
  :root{
    --top-h: 160px;
    --bottom-h: 110px;
  }

  .card{ padding: 12px 10px 0; }
  input{ height:54px; font-size:17px; }

  .formRow{
    flex-direction:row;
    gap:20px;
  }

  .peachActions{ 
  flex-direction:column; 
  align-items: center;
  }

  .band--peach{
    min-height: calc(var(--btn-h) + 24px);
    padding: 16px 0;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
  }
}

/* ===== Height-driven tweaks ===== */
@media (max-height: 860px){
  :root{
    --top-h: 180px;
    --bottom-h: 131px;
    --btn-h: clamp(42px, 6vh, 56px);
    --logo-d: clamp(100px, 15vh, 150px);
  }
  .panel{ padding-top: calc(var(--logo-d) / 2 + 16px); }
}

@media (max-height: 780px){
  :root{
    --top-h: 160px;
    --bottom-h: 125px;
    --btn-h: 48px;
    --logo-d: 120px;
    --card-w: clamp(300px, 70vw, 400px);
  }
  input{ height:48px; font-size:16px; }
}

@media (max-height: 700px){
  :root{
    --top-h: 140px;
    --bottom-h: 121px;
    --btn-h: 44px;
    --logo-d: 108px;
  }
  .cardTitle{ margin-bottom:10px; }
  .card{ padding: 6px 8px 0; }
  input{ height:44px; font-size:15px; }
}

/* ===== Optional: unused helper class /legacy ===== */
.actions{
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  align-items:center;
}
