/* ---- Design Tokens ---- */
:root {
  --green: #0d6335;
  --green-dark: #003f28;
  --green-light: rgba(13, 99, 53, .08);
  --orange: #f47920;
  --red: #de2010;
  --black: #111;
  --ink: #17271d;
  --muted: #5b6b5f;
  --line: #e5ebe7;
  --bg: #f4f6f5;
  --white: #fff;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(18, 36, 26, .06);
  /* Legacy aliases for page compatibility */
  --primary-green: #0d6335;
  --primary-orange: #f47920;
  --text-dark: #333;
  --dark-bg: #1e1e2f;
  --light-bg: #f4f6f5;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; }

/* ---- Navbar ---- */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: .65rem clamp(1rem, 4vw, 3rem);
  background: var(--green-dark);
  min-height: 5.2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.logo-container img {
  height: 5rem;
  width: 5rem;
  border-radius: 50%;
  object-fit: cover;
}

.logo-text {
  color: #fff;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0;
}

.logo-text span { color: rgba(255, 255, 255, .78); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  color: rgba(255, 255, 255, .88);
  font-weight: 600;
  font-size: .92rem;
  padding: .7rem 0;
  position: relative;
  border-radius: 0;
}

.nav-links a:hover { color: #fff; }

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: .35rem;
  height: 3px;
  background: var(--orange);
  transform: scaleX(0);
  transition: transform .3s ease;
  transform-origin: left;
}

.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }

.nav-btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.55rem;
  padding: .65rem 1.1rem;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff !important;
  font-weight: 700;
}

/* ---- Home Hero ---- */
.home-hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 4.5rem);
  padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 6vw, 6rem);
  overflow: hidden;
  isolation: isolate;
}

.home-hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.home-hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.home-hero-slide.active { opacity: 1; }

.home-hero-slide-one { background-image: url("img/zambian-voters-cards.jpg"); background-position: center 42%; }
.home-hero-slide-two { background-image: url("img/zambian-voter-card-woman.jpg"); background-position: center 46%; }

.home-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: transparent;
}

.home-hero-content {
  position: relative;
  z-index: 1;
  max-width: 52rem;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--orange);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.eyebrow::before {
  content: "";
  width: 2.5rem;
  height: .35rem;
  border-radius: 999px;
  background: var(--orange);
}

.home-hero-content h1 {
  color: var(--white);
  font-size: clamp(2.7rem, 7vw, 5.75rem);
  line-height: .94;
  margin-bottom: 1.3rem;
}

.home-lede {
  color: rgba(255, 255, 255, .82);
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin-bottom: 2rem;
  max-width: 38rem;
  margin-left: auto;
  margin-right: auto;
}

.home-hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  background: var(--green);
  color: var(--white);
  padding: .8rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 700;
  box-shadow: 0 16px 36px rgba(13, 99, 53, .25);
  transition: transform .2s ease, background .2s ease;
}

.btn-primary:hover { background: #0a502a; transform: translateY(-2px); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  color: var(--white);
  padding: .8rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .1);
  font-weight: 700;
  transition: transform .2s ease, border-color .2s ease;
}

.btn-secondary:hover { border-color: rgba(255, 255, 255, .7); transform: translateY(-2px); }

/* ---- Home Sections ---- */
.home-section {
  padding: clamp(3rem, 7vw, 5rem) clamp(1rem, 6vw, 6rem);
}

.home-alt { background: rgba(0, 63, 40, .04); }

.home-section-inner {
  max-width: 71rem;
  margin: 0 auto;
}

.home-section h2 {
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.05;
  margin-bottom: 1rem;
}

.home-desc {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 42rem;
  margin-bottom: 1.5rem;
}

.home-emphasis {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--green-light);
  color: var(--green);
  font-weight: 800;
  font-size: 1rem;
  max-width: 42rem;
}

.home-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.home-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.home-card {
  display: grid;
  gap: .55rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  align-content: start;
}

.home-card strong {
  color: var(--ink);
  font-size: 1rem;
}

.home-card p {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.55;
  margin: 0;
}

.home-card-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.home-card-num {
  color: var(--green);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
}

.home-card-highlight {
  border-left: 4px solid var(--green);
}

.home-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  list-style: none;
  margin-top: .5rem;
}

.tag {
  display: inline-flex;
  padding: .3rem .65rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
}

.tag-self { background: #e8f4ed; color: var(--green); }
.tag-official { background: #dbeafe; color: #1e40af; }
.tag-media { background: #fef3c7; color: #92400e; }
.tag-user { background: #f3e8ff; color: #6b21a8; }

/* ---- Carousel ---- */
.home-carousel-section {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.carousel-container {
  position: relative;
  overflow: hidden;
  max-width: 42rem;
  margin: 0 auto;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
}

.carousel-slide {
  flex: 0 0 100%;
  text-align: center;
  padding: 2rem 1.5rem;
}

.carousel-avatar {
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--orange);
}

.carousel-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
}

.carousel-slide blockquote {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--ink);
  font-style: italic;
  max-width: 32rem;
  margin: 0 auto 1rem;
}

.carousel-slide cite {
  color: var(--orange);
  font-weight: 700;
  font-size: .9rem;
  font-style: normal;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: .6rem;
  margin-top: .5rem;
}

.carousel-dot {
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  background: #ccc;
  cursor: pointer;
  transition: background 0.3s;
}

.carousel-dot.active {
  background: var(--orange);
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.home-feature-card {
  display: grid;
  gap: .6rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.home-feature-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.home-feature-card h3 {
  color: var(--ink);
  font-size: 1.1rem;
}

.home-feature-card p {
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.6;
  margin: 0;
}

/* ---- Shared Page Layout (candidates, auth, admin pages) ---- */
.container {
  width: auto;
  max-width: none;
  margin: 2rem 0.5rem;
  padding: 1.5rem 1rem;
  background: var(--white);
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.container table th,
.container table td {
  white-space: nowrap;
  padding: 0.85rem 1.2rem;
}

.container table {
  width: 100%;
  table-layout: auto;
}

.container h1, .container h2, .container h3 { color: var(--green); }

button {
  background: var(--orange);
  color: var(--white);
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s ease;
}

button:hover { background: #d96815; }

form input, form textarea, form select {
  width: 100%;
  padding: 0.8rem;
  margin: 0.5rem 0 1.5rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: var(--white);
  color: var(--text-dark);
  box-sizing: border-box;
  font-family: inherit;
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

table th, table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

table th {
  background: var(--green);
  color: var(--white);
}

/* ---- Pagination ---- */
.pagination {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.pagination a {
  padding: 0.5rem 1rem;
  background: #eee;
  color: var(--text-dark);
  border-radius: 4px;
  text-decoration: none;
}

.pagination a.active, .pagination a:hover {
  background: var(--green);
  color: var(--white);
}

/* ---- Admin Layout ---- */
.admin-wrapper {
  display: flex;
  min-height: calc(100vh - 4.5rem);
}

.admin-sidebar {
  width: 250px;
  background: var(--dark-bg);
  color: #f0f0f0;
  padding: 2rem 1rem;
  flex-shrink: 0;
}

.admin-sidebar a {
  display: block;
  color: #f0f0f0;
  padding: 1rem;
  text-decoration: none;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  transition: background 0.2s;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
  background: var(--green);
  color: var(--white);
}

.admin-content {
  flex: 1;
  padding: 2rem;
  background: var(--light-bg);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 1rem;
}

/* ---- Candidate list rows ---- */
.candidate-row { cursor: pointer; transition: background-color 0.2s; }
.candidate-row:hover { background-color: rgba(13, 99, 53, 0.05); }

/* ---- Footer ---- */
footer {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) auto minmax(9rem, 1fr);
  align-items: center;
  gap: 1rem;
  min-height: 5.5rem;
  padding: .9rem clamp(1rem, 4vw, 3rem);
  background: var(--green-dark);
  color: rgba(255, 255, 255, .82);
  text-align: center;
  margin-top: auto;
}

footer p { margin: 0; font-size: .78rem; }

.footer-tagline {
  color: var(--orange);
  font-weight: bold;
  font-size: .85rem;
}

/* ---- Candidate detail page inline-style overrides ---- */
.cand-hero-title { color: var(--orange) !important; }
.cand-section h2,
.cand-card h3,
.bottom-banner h3 { color: var(--ink) !important; }

.cand-section h2 { margin-top: 0; }

/* ---- Auth page ---- */
.auth-form-container {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: var(--white);
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid #eaeaea;
}

.auth-card h2 {
  text-align: center;
  color: var(--green);
  margin-top: 0;
  font-size: 2rem;
}

.auth-card p.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 2rem;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .home-grid-4,
  .home-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .navbar {
    flex-direction: column;
    align-items: center;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .admin-wrapper {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
  }

  footer {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 640px) {
  .home-grid-4,
  .home-grid-3,
  .home-grid-2,
  .home-feature-grid {
    grid-template-columns: 1fr;
  }
}
