/* ============================================
   IGAC HBC 2026 — style.css
   Mobile-first, clean, church-appropriate
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --primary:   #1a3a5c;
  --accent:    #e8a020;
  --green:     #2d6a4f;
  --red:       #c0392b;
  --light:     #f0f4f8;
  --white:     #ffffff;
  --border:    #d1dbe8;
  --text:      #1e2d3d;
  --muted:     #6b7f93;
  --radius:    12px;
  --shadow:    0 2px 12px rgba(0,0,0,.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--light);
  color: var(--text);
  font-size: 16px;
  min-height: 100vh;
}

/* ---- Header ---- */
.app-header {
  background: var(--primary);
  color: var(--white);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: .8rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.app-header h1 { font-size: 1.1rem; font-weight: 800; line-height: 1.2; }
.app-header .sub { font-size: .78rem; opacity: .8; }
.app-header a.back {
  color: var(--accent);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 700;
  margin-left: auto;
  white-space: nowrap;
}

/* ---- Page wrapper ---- */
.page { max-width: 640px; margin: 0 auto; padding: 1.2rem; }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  margin-bottom: 1rem;
}
.card h2 { font-size: 1.1rem; color: var(--primary); margin-bottom: 1rem; }
.card h3 { font-size: .95rem; color: var(--primary); margin-bottom: .6rem; }

/* ---- Dept buttons (home) ---- */
.dept-grid { display: grid; grid-template-columns: 1fr; gap: .9rem; }
.dept-btn {
  display: block;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
  border-left: 6px solid var(--accent);
  transition: transform .15s, box-shadow .15s;
}
.dept-btn:active { transform: scale(.97); }
.dept-btn .sub { font-size: .8rem; font-weight: 600; opacity: .75; margin-top: .3rem; }
.dept-btn.jt { border-color: #52b788; }
.dept-btn.st { border-color: #e07a5f; }

/* ---- Action buttons ---- */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .5rem; }
.action-btn {
  display: block;
  text-align: center;
  padding: 1rem .8rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  font-size: .95rem;
  transition: transform .15s;
}
.action-btn:active { transform: scale(.96); }
.action-btn.primary { background: var(--primary); color: var(--white); }
.action-btn.accent  { background: var(--accent);  color: var(--white); }
.action-btn.green   { background: var(--green);   color: var(--white); }
.action-btn.outline { background: var(--white); color: var(--primary); border: 2px solid var(--primary); }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.1rem; }
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .35rem; color: var(--primary); }
input[type=text], input[type=date], input[type=tel], input[type=password],
select, textarea {
  width: 100%;
  padding: .75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .2s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}
textarea { resize: vertical; min-height: 90px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

/* ---- Submit button ---- */
.btn-submit {
  width: 100%;
  padding: 1rem;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  margin-top: .5rem;
  transition: background .2s;
}
.btn-submit:active { background: #0f2440; }
.btn-submit.green { background: var(--green); }
.btn-submit.accent { background: var(--accent); }

/* ---- Attendance list ---- */
.att-list { list-style: none; }
.att-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .8rem .5rem;
  border-bottom: 1px solid var(--border);
}
.att-item:last-child { border-bottom: none; }
.att-name { flex: 1; font-weight: 600; font-size: .95rem; }
.att-class { font-size: .75rem; color: var(--muted); }
.att-toggle {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.att-toggle.present { background: var(--green); border-color: var(--green); color: var(--white); }
.att-toggle.absent  { background: var(--white); border-color: var(--border); color: var(--border); }

/* ---- Search box ---- */
.search-wrap { position: relative; margin-bottom: 1rem; }
.search-wrap input { padding-left: 2.5rem; }
.search-wrap::before {
  content: '🔍';
  position: absolute;
  left: .8rem; top: 50%;
  transform: translateY(-50%);
  font-size: .95rem;
}

/* ---- Session selector ---- */
.session-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .7rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.session-card:hover, .session-card.selected {
  border-color: var(--primary);
  background: #eef3f9;
}
.session-card .s-topic { font-weight: 700; font-size: .95rem; }
.session-card .s-meta  { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
}
.badge.present { background: #d8f3dc; color: var(--green); }
.badge.absent  { background: #fde8e8; color: var(--red); }
.badge.dept-c  { background: #dbe9f9; color: var(--primary); }
.badge.dept-jt { background: #d8f3e8; color: #1b7a50; }
.badge.dept-st { background: #fde8dc; color: #9b3a20; }

/* ---- Flash messages ---- */
.flash { padding: 1rem 1.2rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 600; }
.flash.success { background: #d8f3dc; color: var(--green); }
.flash.error   { background: #fde8e8; color: var(--red); }
.flash.info    { background: #dbe9f9; color: var(--primary); }

/* ---- Table ---- */
.report-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.report-table th {
  background: var(--primary); color: var(--white);
  padding: .6rem .8rem; text-align: left;
}
.report-table td { padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
.report-table tr:nth-child(even) td { background: #f8fafc; }

/* ---- Stats row ---- */
.stats-row { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat-box {
  flex: 1; min-width: 80px;
  background: var(--white);
  border-radius: var(--radius);
  padding: .9rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-box .num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-box .lbl { font-size: .75rem; color: var(--muted); font-weight: 600; }

/* ---- PIN pad ---- */
.pin-display {
  font-size: 2.5rem;
  letter-spacing: .5rem;
  text-align: center;
  padding: .8rem;
  background: var(--light);
  border-radius: 8px;
  margin-bottom: 1rem;
  min-height: 72px;
}
.pin-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: .6rem;
}
.pin-key {
  padding: 1.1rem;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.5rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  transition: background .15s;
}
.pin-key:active { background: var(--light); }
.pin-key.del { color: var(--red); }
.pin-key.ok  { background: var(--green); color: var(--white); border-color: var(--green); grid-column: span 3; }

/* ---- Checkbox classes ---- */
.check-list { list-style: none; }
.check-list li {
  padding: .7rem .5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .8rem;
}
.check-list li label { font-weight: 600; margin: 0; cursor: pointer; }
.check-list input[type=checkbox] { width: 22px; height: 22px; flex-shrink: 0; }

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: .85rem; }
.mt1 { margin-top: 1rem; }
.mb1 { margin-bottom: 1rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.full-width { width: 100%; }

/* ---- Responsive ---- */
@media(min-width:600px) {
  .dept-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Logout button ──────────────────────────────── */
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  padding: .3rem .7rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s;
}
.logout-btn:hover {
  background: rgba(192,57,43,.7);
  border-color: transparent;
}
