:root {
  --blue-950: #0b1f4d;
  --blue-800: #123a82;
  --blue-600: #1d63d8;
  --blue-100: #e8f0ff;
  --red-600: #e31b3f;
  --red-100: #ffe8ed;
  --white: #ffffff;
  --ink: #182033;
  --muted: #68738d;
  --line: #d9e2f2;
  --surface: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 50px rgba(11, 31, 77, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0 !important;
  padding: clamp(18px, 3vw, 36px) !important;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif !important;
  line-height: 1.5;
  background:
    linear-gradient(135deg, rgba(29, 99, 216, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(227, 27, 63, 0.1), transparent 32%),
    #f7faff !important;
}

.page-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.95);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
  transition: opacity 420ms cubic-bezier(0.22, 1, 0.36, 1), transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.page-transition-overlay.is-visible {
  opacity: 1;
  transform: scale(1);
}

.page-transition-logo {
  width: clamp(160px, 24vw, 280px);
  aspect-ratio: 1 / 1;
  background: url("images/logoparade.PNG") center / contain no-repeat;
  filter: drop-shadow(0 18px 42px rgba(11, 31, 77, 0.22));
  animation: page-logo-pop 720ms ease;
}

@keyframes page-logo-pop {
  0% {
    opacity: 0;
    transform: scale(0.75);
  }
  45% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent),
    repeating-linear-gradient(
      90deg,
      rgba(18, 58, 130, 0.06) 0 1px,
      transparent 1px 80px
    );
}

body::after {
  content: "";
  position: fixed;
  top: clamp(12px, 2vw, 22px);
  left: clamp(12px, 2vw, 22px);
  z-index: 3;
  width: clamp(48px, 7vw, 72px);
  height: clamp(48px, 7vw, 72px);
  pointer-events: none;
  background:
    url("images/logoparade.PNG") center / contain no-repeat,
    rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(217, 226, 242, 0.82);
  border-radius: var(--radius);
  box-shadow: 0 16px 36px rgba(11, 31, 77, 0.16);
  backdrop-filter: blur(12px);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  color: var(--blue-950);
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  margin-bottom: 22px;
}

h2 {
  font-size: clamp(22px, 3vw, 30px);
  margin-bottom: 18px;
}

h3 {
  color: var(--blue-800);
  font-size: 18px;
  margin-bottom: 10px;
}

p {
  color: var(--muted);
}

a {
  color: var(--blue-600);
  font-weight: 700;
  text-decoration: none;
  transition: 180ms ease;
}

a:hover {
  color: var(--red-600);
}

.login,
.card,
body > div[style*="background:white"] {
  width: min(100%, 440px) !important;
  margin: 7vh auto !important;
  padding: clamp(24px, 4vw, 34px) !important;
  background: var(--surface) !important;
  border: 1px solid rgba(217, 226, 242, 0.9);
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.card {
  width: min(100%, 1080px) !important;
  margin: 0 auto 22px !important;
}

.menu-card {
  width: min(100%, 430px) !important;
}

.login h2,
.card h2,
body > h1,
body > h2 {
  position: relative;
  padding-bottom: 12px;
}

.login h2::after,
.card h2::after,
body > h1::after,
body > h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 76px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue-600), var(--red-600));
}

form {
  margin: 0;
}

input,
select,
textarea {
  width: 100% !important;
  min-height: 44px;
  margin: 8px 0 16px !important;
  padding: 11px 13px !important;
  color: var(--ink);
  font: inherit;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 4px rgba(29, 99, 216, 0.14);
}

button,
a[href],
.kembali,
.hapus {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px !important;
  color: var(--white) !important;
  font: 700 14px/1.2 Inter, "Segoe UI", Arial, sans-serif;
  text-decoration: none !important;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-800)) !important;
  border: 0;
  border-radius: var(--radius) !important;
  box-shadow: 0 10px 24px rgba(29, 99, 216, 0.2);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

button:hover,
a[href]:hover,
.kembali:hover,
.hapus:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 14px 28px rgba(29, 99, 216, 0.25);
}

button:disabled {
  color: var(--muted) !important;
  background: #eef3fb !important;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.hapus,
a[href*="hapus"],
a[href*="reset_vote"],
a[href*="logout"] {
  background: linear-gradient(135deg, var(--red-600), #b91532) !important;
  box-shadow: 0 10px 24px rgba(227, 27, 63, 0.18);
}

table {
  width: min(100%, 1120px) !important;
  margin: 0 auto 20px;
  overflow: hidden;
  border-collapse: separate !important;
  border-spacing: 0;
  background: var(--white) !important;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

th,
td {
  padding: 14px 16px !important;
  color: var(--ink);
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  text-align: left !important;
  vertical-align: middle;
}

th {
  color: var(--white);
  font-size: 13px;
  text-transform: uppercase;
  background: var(--blue-800) !important;
  letter-spacing: 0.04em;
}

tr:last-child td {
  border-bottom: 0 !important;
}

tr:nth-child(even) td {
  background: #f9fbff;
}

td:last-child a {
  margin: 3px;
}

img {
  border-radius: var(--radius) !important;
  border: 3px solid var(--white);
  box-shadow: 0 12px 28px rgba(11, 31, 77, 0.16);
}

.card > div[style*="display:inline-block"],
body > div[style*="display:inline-block"] {
  width: min(100%, 240px);
  margin: 14px !important;
  padding: 16px;
  vertical-align: top;
  text-align: center;
  background: #f9fbff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card > div[style*="display:inline-block"] h3,
body > div[style*="display:inline-block"] h3 {
  margin-top: 14px;
  color: var(--blue-950);
}

canvas {
  width: 100% !important;
  max-width: 100%;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.login button,
.login a,
.login input + button {
  width: 100%;
}

body > a {
  margin: 0 8px 16px 0;
}

body > h1,
body > h2,
body > p,
body > a,
body > br + a {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 760px) {
  body {
    padding: 14px !important;
  }

  .login,
  .card,
  body > div[style*="background:white"] {
    margin-top: 24px !important;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  th,
  td {
    padding: 12px !important;
  }

  .card > div[style*="display:inline-block"],
  body > div[style*="display:inline-block"] {
    width: 100%;
    margin: 10px 0 !important;
  }

  button,
  a[href],
  .kembali,
  .hapus {
    width: 100%;
    margin-bottom: 8px;
  }
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 54px) !important;
  background:
    linear-gradient(90deg, rgba(9, 24, 59, 0.92), rgba(9, 24, 59, 0.52)),
    linear-gradient(135deg, rgba(29, 99, 216, 0.28), rgba(227, 27, 63, 0.22)),
    url("images/loginpage.JPG") center / cover no-repeat fixed !important;
}

.login-page::before {
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 55%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.06) 0 1px,
      transparent 1px 92px
    );
}

.login-shell {
  --mouse-x: 0px;
  --mouse-y: 0px;
  position: relative;
  z-index: 1;
  width: min(100%, 1080px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: clamp(24px, 5vw, 70px);
  align-items: center;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.is-ready .login-shell {
  opacity: 1;
  transform: translate(var(--mouse-x), var(--mouse-y));
}

.login-hero {
  color: var(--white);
  text-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.login-kicker {
  width: fit-content;
  margin-bottom: 18px;
  padding: 8px 12px;
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}

.login-hero h1 {
  max-width: 640px;
  margin-bottom: 18px;
  color: var(--white);
  font-size: clamp(46px, 8vw, 92px);
  line-height: 0.95;
  font-weight: 900;
}

.login-subtitle {
  max-width: 520px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(16px, 2vw, 20px);
}

.login-page .login {
  width: 100% !important;
  margin: 0 !important;
  padding: clamp(24px, 4vw, 36px) !important;
  background: rgba(255, 255, 255, 0.55) !important;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.login-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.login-brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(11, 31, 77, 0.1);
}

.login-brand .brand-main {
  width: 68px;
  height: 68px;
}

.login-page .login h2 {
  margin-bottom: 22px;
  font-size: 26px;
}

.login-page label {
  display: block;
  margin-bottom: 6px;
  color: var(--blue-950);
  font-size: 13px;
  font-weight: 800;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 92px !important;
}

.password-toggle {
  position: absolute;
  right: 7px;
  top: 8px;
  width: auto !important;
  min-height: 34px;
  margin: 0 !important;
  padding: 8px 10px !important;
  color: var(--blue-800) !important;
  font-size: 12px;
  background: var(--blue-100) !important;
  box-shadow: none;
}

.password-toggle:hover {
  color: var(--white) !important;
  background: var(--blue-600) !important;
  box-shadow: none;
}

.login-submit {
  min-height: 48px;
  margin-top: 4px;
  font-size: 15px;
}

.login-submit.is-loading {
  position: relative;
  color: rgba(255, 255, 255, 0.78) !important;
  background: linear-gradient(135deg, var(--blue-800), var(--blue-950)) !important;
  box-shadow: 0 10px 24px rgba(11, 31, 77, 0.22);
  cursor: wait;
}

@media (max-width: 860px) {
  .login-page {
    display: block;
    background-attachment: scroll !important;
  }

  .login-shell {
    min-height: calc(100vh - 36px);
    grid-template-columns: 1fr;
    align-content: center;
  }

  .login-hero {
    text-align: left;
  }

  .login-subtitle {
    max-width: 100%;
  }

  .is-ready .login-shell {
    transform: none;
  }
}

/* Admin auth and dashboard */
.admin-login-page,
.admin-page {
  min-height: 100vh;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(9, 24, 59, 0.92), rgba(9, 24, 59, 0.62)),
    linear-gradient(135deg, rgba(29, 99, 216, 0.22), rgba(227, 27, 63, 0.18)),
    url("images/adminpage.JPG") center / cover no-repeat fixed !important;
}

.admin-login-page::before,
.admin-page::before {
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 48%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0 1px,
      transparent 1px 92px
    );
}

.admin-login-page {
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 54px) !important;
}

.admin-login-page .login {
  width: 100% !important;
  margin: 0 !important;
  padding: clamp(24px, 4vw, 36px) !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.admin-login-page label {
  display: block;
  margin-bottom: 6px;
  color: var(--blue-950);
  font-size: 13px;
  font-weight: 800;
}

.admin-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1080px);
  min-height: calc(100vh - clamp(36px, 6vw, 72px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
  gap: clamp(24px, 5vw, 70px);
  align-items: center;
}

.admin-hero {
  color: var(--white);
  text-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.admin-hero h1 {
  max-width: 640px;
  margin-bottom: 18px;
  color: var(--white);
  font-size: clamp(42px, 7vw, 82px);
  line-height: 0.98;
  font-weight: 900;
}

.admin-hero p:not(.login-kicker) {
  max-width: 540px;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(16px, 2vw, 20px);
}

.admin-menu-card {
  width: 100% !important;
  margin: 0 !important;
  padding: clamp(24px, 4vw, 36px) !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.admin-menu-card a {
  width: 100%;
  min-height: 46px;
  margin: 0 0 10px !important;
}

.admin-brand {
  margin-bottom: 22px;
}

/* Voting dashboard */
.voting-page {
  min-height: 100vh;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(9, 24, 59, 0.92), rgba(9, 24, 59, 0.62)),
    linear-gradient(135deg, rgba(29, 99, 216, 0.22), rgba(227, 27, 63, 0.18)),
    url("images/loginpage.JPG") center / cover no-repeat fixed !important;
}

.voting-page::before {
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 48%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0 1px,
      transparent 1px 92px
    );
}

.voting-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1180px);
  margin: 0 auto;
}

.voting-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
}

.voting-brand {
  margin-bottom: 18px;
}

.voting-brand img {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(255, 255, 255, 0.6);
}

.voting-header h1 {
  margin-bottom: 10px;
  color: var(--white);
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
}

.voting-header p:not(.login-kicker) {
  max-width: 660px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
}

.logout-link {
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--red-600), #b91532) !important;
}

.vote-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.vote-step {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 70px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}

.vote-step span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--blue-950);
  font-weight: 900;
  background: var(--white);
  border-radius: 50%;
}

.vote-step p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.vote-step.is-active {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
}

.vote-step.is-active span {
  color: var(--white);
  background: linear-gradient(135deg, var(--blue-600), var(--red-600));
}

.vote-step.is-done {
  background: rgba(29, 99, 216, 0.24);
}

.position-panel,
.vote-complete {
  padding: clamp(20px, 3vw, 30px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: var(--radius);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
}

.position-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 22px;
}

.position-copy .login-kicker {
  color: var(--white);
  background: linear-gradient(135deg, var(--blue-600), var(--red-600));
  border: 0;
}

.position-copy h2,
.vote-complete h2 {
  color: var(--blue-950);
}

.position-copy p:not(.login-kicker),
.vote-complete p {
  max-width: 720px;
  color: var(--muted);
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.candidate-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(11, 31, 77, 0.1);
}

.candidate-card img {
  width: 100% !important;
  height: 300px !important;
  object-fit: cover;
  border: 0;
  border-radius: 0 !important;
  box-shadow: none;
}

.candidate-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px;
}

.candidate-body h3 {
  margin-bottom: 14px;
  color: var(--blue-950);
  font-size: 22px;
}

.candidate-program {
  margin-bottom: 14px;
  padding: 14px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.candidate-program h4 {
  margin: 0 0 8px;
  color: var(--red-600);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.candidate-program p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.vote-form {
  margin-top: auto;
}

.vote-form button {
  width: 100%;
  min-height: 48px;
}

.vote-complete {
  max-width: 620px;
  margin: 7vh auto 0;
  text-align: center;
}

.vote-complete .login-kicker {
  margin-left: auto;
  margin-right: auto;
  color: var(--white);
  background: linear-gradient(135deg, var(--blue-600), var(--red-600));
  border: 0;
}

.vote-complete h3 {
  color: var(--blue-800);
}

@media (max-width: 760px) {
  .voting-page {
    background-attachment: scroll !important;
  }

  .voting-header {
    display: block;
  }

  .logout-link {
    width: 100%;
    margin-top: 8px;
  }

  .vote-steps {
    grid-template-columns: 1fr;
  }

  .candidate-card img {
    height: 260px !important;
  }
}

@media (max-width: 860px) {
  .admin-login-page,
  .admin-page {
    display: block;
    background-attachment: scroll !important;
  }

  .admin-shell,
  .admin-login-shell {
    min-height: calc(100vh - 36px);
    grid-template-columns: 1fr;
    align-content: center;
  }

  .admin-hero {
    text-align: left;
  }

  body::after {
    width: 46px;
    height: 46px;
  }
}
