/* MABINI BOX — PUP Lopez CSC Online Voting */
:root {
  --maroon: #7a0f14;
  --maroon-700: #5e0a0e;
  --maroon-50: #fbf1f1;
  --gold: #f2b705;
  --gold-600: #d29d00;
  --ink: #1d1b1c;
  --muted: #6b6466;
  --line: #e8e2e2;
  --bg: #f7f4f2;
  --card: #ffffff;
  --ok: #157347;
  --ok-50: #e9f6ef;
  --err: #b42318;
  --err-50: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 28, .05), 0 8px 24px rgba(29, 27, 28, .06);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--maroon); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 700; font-size: .95rem;
  padding: .8rem 1.25rem; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: background .15s, transform .05s, box-shadow .15s;
  text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--maroon); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--maroon-700); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover:not(:disabled) { background: var(--gold-600); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: #fff; }
.btn-block { width: 100%; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .35rem; }
.field input {
  width: 100%; font: inherit; padding: .75rem .9rem; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--maroon); box-shadow: 0 0 0 4px rgba(122, 15, 20, .12); }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 4.2rem; }
.pw-toggle {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  border: 0; background: none; font: inherit; font-size: .8rem; font-weight: 700;
  color: var(--maroon); cursor: pointer; padding: .3rem .5rem;
}

.alert { padding: .75rem .9rem; border-radius: 10px; font-size: .9rem; margin-bottom: 1rem; }
.alert-err { background: var(--err-50); color: var(--err); }
.alert-ok { background: var(--ok-50); color: var(--ok); }
.alert-warn { background: #fff7e0; color: #7a5600; }

/* ---------- Auth layout ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-brand {
  position: relative; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(160deg, rgba(94, 10, 14, .92), rgba(122, 15, 20, .82)), url("../Assets/bg.png") center/cover no-repeat;
}
.auth-brand .school { font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.auth-brand h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); margin: 1rem 0 .5rem; }
.auth-brand h1 span { color: var(--gold); }
.auth-brand .lead { max-width: 30rem; opacity: .9; font-size: 1.05rem; }
.seal { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--gold); background: #fff; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h2 { font-size: 1.75rem; }
.auth-links { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; margin: -.25rem 0 1.25rem; }
.auth-switch { text-align: center; margin-top: 1.25rem; font-size: .9rem; color: var(--muted); }

/* ---------- App shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--maroon); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: .7rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
.logo { display: flex; align-items: center; gap: .65rem; color: #fff; font-weight: 800; letter-spacing: .02em; }
.logo:hover { text-decoration: none; }
.logo img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); background: #fff; }
.logo span em { font-style: normal; color: var(--gold); }
.nav { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.nav a { color: rgba(255, 255, 255, .85); padding: .5rem .8rem; border-radius: 8px; font-size: .92rem; }
.nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .16); color: #fff; }
.nav .logout { border: 1px solid rgba(255, 255, 255, .35); margin-left: .4rem; }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid rgba(255, 255, 255, .35); color: #fff; border-radius: 8px; padding: .45rem .7rem; font: inherit; font-weight: 700; cursor: pointer; }

.container { max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.hero {
  border-radius: 20px; color: #fff; padding: 2.5rem; margin-bottom: 2rem; position: relative; overflow: hidden;
  background: linear-gradient(120deg, rgba(94, 10, 14, .95), rgba(122, 15, 20, .78)), url("../Assets/bg.png") center/cover no-repeat;
}
.hero .eyebrow { color: var(--gold); font-weight: 700; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; }
.hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin: .4rem 0 .6rem; }
.hero p { opacity: .9; max-width: 38rem; margin: 0; }
.hero .user-chip { display: inline-block; margin-top: 1.25rem; background: rgba(255, 255, 255, .14); padding: .35rem .8rem; border-radius: 99px; font-size: .85rem; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.card h3 { font-size: 1.1rem; }
.section-title { font-size: 1.35rem; margin: 2.5rem 0 1rem; }

.ballot-card { display: flex; flex-direction: column; gap: .75rem; }
.ballot-card .top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.ballot-card .btn { align-self: flex-start; margin-top: auto; }
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 700; padding: .25rem .6rem; border-radius: 99px; white-space: nowrap; }
.badge-ok { background: var(--ok-50); color: var(--ok); }
.badge-pending { background: #fff7e0; color: #7a5600; }
.badge-closed { background: #eee; color: #555; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 2.6rem; margin-bottom: 1rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -.1rem; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--maroon-50); color: var(--maroon); font-weight: 800; display: grid; place-items: center; font-size: .85rem;
}
.reminder { border-left: 4px solid var(--gold); }
.reminder ul { margin: 0; padding-left: 1.1rem; }
.reminder li { margin-bottom: .4rem; }

.credits { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.credits span { background: var(--maroon-50); color: var(--maroon); font-weight: 600; font-size: .85rem; padding: .3rem .7rem; border-radius: 99px; }

/* ---------- Ballot ---------- */
.ballot-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.ballot-head h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0; }
.position { margin-bottom: 1.5rem; }
.position-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.position-head h2 { font-size: 1.1rem; margin: 0; }
.position.missing .position-head h2 { color: var(--err); }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border-radius: 12px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); transition: border-color .15s, background .15s, box-shadow .15s;
}
.choice label:hover { border-color: #cfc5c5; }
.choice input:focus-visible + label { box-shadow: 0 0 0 4px rgba(122, 15, 20, .18); }
.choice input:checked + label { border-color: var(--maroon); background: var(--maroon-50); }
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--maroon); color: #fff;
  display: grid; place-items: center; font-weight: 800; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.choice .name { font-weight: 700; }
.choice .party { font-size: .8rem; color: var(--muted); }
.radio-dot { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cfc5c5; flex: none; position: relative; }
.choice input:checked + label .radio-dot { border-color: var(--maroon); }
.choice input:checked + label .radio-dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--maroon); }

.submit-bar {
  position: sticky; bottom: 0; z-index: 10; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line); margin-top: 2rem;
}
.submit-bar-inner { max-width: 1080px; margin: 0 auto; padding: .9rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
.progress { flex: 1; }
.progress-track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: .35rem; }
.progress-fill { height: 100%; width: 0; background: var(--gold); transition: width .25s; }

.notice { text-align: center; padding: 3rem 1.5rem; }
.notice .icon { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; }
.notice .icon.ok { background: var(--ok-50); color: var(--ok); }
.notice .icon.warn { background: #fff7e0; color: #7a5600; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(29, 27, 28, .55); display: grid; place-items: center; padding: 1rem; }
.modal-card { background: #fff; border-radius: 18px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; padding: 1.75rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.summary { list-style: none; padding: 0; margin: 1rem 0 1.5rem; border: 1px solid var(--line); border-radius: 12px; }
.summary li { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-size: .92rem; }
.summary li:last-child { border-bottom: 0; }
.summary li span:first-child { color: var(--muted); }
.summary li span:last-child { font-weight: 700; text-align: right; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; }

/* ---------- Status table ---------- */
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.status-list li:last-child { border-bottom: 0; }

/* ---------- Footer ---------- */
.footer { text-align: center; padding: 2rem 1rem; color: var(--muted); font-size: .85rem; }
.footer a { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); }
.footer a { font-weight: 700; }
.footer a:hover { color: var(--maroon); text-decoration: none; }
.footer img.psix-badge {
  width: 26px; height: 26px; padding: 4px; border-radius: 50%;
  background: var(--maroon); object-fit: contain; box-sizing: border-box;
}
.auth-panel .footer { padding: 1.5rem 0 0; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--maroon); border-radius: 50%; animation: spin .8s linear infinite; margin: 3rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 2rem 1.5rem; min-height: auto; }
  .auth-brand .lead, .auth-brand .brand-foot { display: none; }
  .auth-brand h1 { font-size: 2rem; margin-bottom: 0; }
  .seal { width: 60px; height: 60px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero { padding: 1.75rem; }
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--maroon-700); flex-direction: column; align-items: stretch; padding: .5rem 1rem 1rem; }
  .nav.open { display: flex; }
  .nav .logout { margin: .4rem 0 0; text-align: center; }
}
