/* ============================================= */
/* ✅ UNIVERSAL RESET & BASE STYLES */
/* ============================================= */
* {
  box-sizing: border-box;
}

:root {
  --header-height: 120px; /* adjust if your header is taller */
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  font-family: 'Poppins', sans-serif;
  background-color: #f9f9f9;
  overflow-x: hidden;
}

/* ✅ FIX HEADER OVERLAP ON ALL DEVICES */
body {
  margin: 0;
  background: url("KENT A (2).jpg") no-repeat center center/cover;
  background-color: #f8f9fa;
  font-family: 'Poppins', sans-serif;
  overflow-x: hidden;
  padding-top: calc(var(--header-height, 120px) + env(safe-area-inset-top, 0px));
}

/* Safe-area support for iPhones with notches */
@supports (padding: max(0px)) {
  body {
    padding-top: max(
      calc(var(--header-height, 120px) + 10px),
      env(safe-area-inset-top)
    );
  }
}

/* Responsive text */
h1, h2, h3 {
  word-wrap: break-word;
}

/* ============================================= */
/* ✅ LOGIN PAGE */
/* ============================================= */
.login-container {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  width: 350px;
  text-align: center;
  animation: fadeIn 1s ease-in-out;
}

.school-logo {
  width: 80px;
  height: 80px;
  border-radius: 90%;
  margin-bottom: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.tagline {
  font-size: 14px;
  font-style: italic;
  color: #eee;
  margin-bottom: 25px;
}

.login-container h1 {
  margin-bottom: 25px;
  font-size: 24px;
  color: #011316f3;
  font-weight: 600;
  letter-spacing: 1px;
}

.login-container input {
  width: 94%;
  padding: 12px;
  margin: 12px 0;
  border: none;
  outline: none;
  border-radius: 10px;
  background: rgb(241, 238, 238);
  color: #000;
  font-size: 15px;
}

.login-container input::placeholder {
  color: #0e0101;
}

select {
  width: 100%;
  padding: 12px;
  margin: 12px 0 15px 0;
  border-radius: 8px;
  border: none;
  outline: none;
  font-size: 15px;
}

.login-container button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #0066cc, #00ccff);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  margin-top: 10px;
}

.login-container button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 102, 204, 0.6);
}

#error-message {
  color: #ff4d4d;
  font-size: 14px;
  margin-top: 12px;
  font-weight: 500;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================= */
/* ✅ HEADER */
/* ============================================= */
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  position: fixed;
  top: 0;
  width: 100%;
  backdrop-filter: blur(8px);
  z-index: 1000;
}

.header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.school-logo.small {
  width: 50px;
  height: 50px;
}

/* ============================================= */
/* ✅ VOTING PAGE */
/* ============================================= */
.vote-container {
  max-width: 1100px;
  margin: 0 auto;
  margin-top: 120px;
  padding: 1.5rem;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  scroll-behavior: smooth;
}

.vote-container h2#vote-title {
  text-align: center;
  margin-bottom: 2rem;
  color: #004080;
  font-size: 1.6rem;
}

/* Candidate Grid */
.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
}

/* Candidate Card */
.candidate-card {
  background-color: #ffffff;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #e5e7eb;
}

.candidate-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.candidate-photo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid #004080;
  margin-bottom: 0.75rem;
  object-fit: cover;
}

/* Vote Buttons */
.vote-btn {
  width: 100%;
  padding: 0.5rem 1rem;
  background-color: #28a745;
  color: white;
  font-size: 0.9rem;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.vote-btn:hover {
  background-color: #218838;
}

/* ============================================= */
/* ✅ RESULTS PAGE */
/* ============================================= */
.results-page {
  padding-top: calc(var(--header-height, 120px) + env(safe-area-inset-top, 0px));
  min-height: 100vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.results-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  color: white;
}

#total-votes {
  text-align: center;
  font-size: 1rem;
  margin-bottom: 25px;
  color: #ffeb3b;
  font-weight: 600;
}

.gender-section {
  margin-bottom: 40px;
}

.gender-section h2 {
  text-align: left;
  margin: 10px 0;
  color: #f1efef;
  font-size: 1.4rem;
}

/* Result Card Grid */
.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.result-card {
  margin-bottom: 20px;
  padding: 15px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  color: #222;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.result-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.result-card.winner {
  border: 2px solid gold;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  animation: pulse 1.5s infinite;
}
/* ========================== */
/* 👑 Winner Crown */
/* ========================== */
.result-card.winner {
  position: relative;
  border: 2px solid gold;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  animation: pulse 1.5s infinite;
}

/* Crown styling */
.result-card.winner::before {
  content: "👑";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
  animation: floatCrown 2s ease-in-out infinite;
}

@keyframes floatCrown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}


@keyframes pulse {
  0% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }
  50% { box-shadow: 0 0 25px rgba(255, 215, 0, 1); }
  100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }
}

.progress-bar {
  background: rgba(200, 200, 200, 0.3);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 10px;
  height: 25px;
}

.progress {
  height: 100%;
  background: linear-gradient(135deg, #33ccff, #00cc66);
  color: white;
  font-size: 14px;
  text-align: right;
  padding-right: 10px;
  line-height: 25px;
  border-radius: 10px 0 0 10px;
  transition: width 0.5s ease-in-out;
}

/* 🏠 Back to Home Button (Centered Beneath Results) */
.home-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 40px auto; /* Centers the button horizontally */
  padding: 14px 35px;
  background: linear-gradient(135deg, #33ccff, #00cc66);
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

/* Hover effect */
.home-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Ensure container keeps it centered visually */
.results-container {
  display: flex;
  flex-direction: column;
  align-items: center; /* centers child items */
  justify-content: center;
}


/* ============================================= */
/* ✅ RESPONSIVE RESULTS PAGE */
/* ============================================= */
@media screen and (max-width: 1024px) {
  .candidate-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media screen and (max-width: 768px) {
  .results-page {
    padding-top: calc(var(--header-height, 120px) + 20px);
  }
  .candidate-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 480px) {
  .results-page {
    padding-top: calc(var(--header-height, 120px) + 30px);
  }
  .candidate-grid {
    grid-template-columns: 1fr;
  }
  .result-card {
    padding: 10px;
  }
  .progress {
    font-size: 12px;
  }
}
/* ============================================= */
/* ✅ ADMIN DASHBOARD — Refined & Responsive */
/* ============================================= */

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #0077b6, #00b4d8);
  color: white;
  padding: 15px 25px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1001;
}

.school-logo.small {
  height: 45px;
  width: auto;
}

.admin-container {
  display: flex;
  margin-top: 80px; /* matches fixed header */
  min-height: calc(100vh - 80px);
  background: rgba(255, 255, 255, 0.05);
}

/* ================= Sidebar ================= */
.sidebar {
  width: 220px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.3s ease;
}

.nav-btn {
  padding: 12px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: 0.3s;
}

.nav-btn.active,
.nav-btn:hover {
  background: linear-gradient(135deg, #33ccff, #00cc66);
  font-weight: 600;
}

/* ================= Content ================= */
.content {
  flex: 1;
  padding: 30px;
  color: rgb(15, 14, 14);
  overflow-y: auto;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

/* ================= Mobile Sidebar Toggle ================= */
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .menu-btn {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 70px;
    left: -260px;
    width: 220px;
    height: calc(100vh - 70px);
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
  }

  .sidebar.active {
    left: 0;
  }

  .admin-container {
    flex-direction: column;
  }

  .content {
    padding: 20px;
  }
}

/* ================= Smaller Screens (phones) ================= */
@media (max-width: 600px) {
  .admin-header {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  .school-logo.small {
    height: 40px;
  }

  .sidebar {
    width: 200px;
  }

  .content {
    padding: 15px;
  }
}

/* ================= Buttons, Inputs, Lists ================= */
#candidate-form input,
#candidate-form select,
#candidate-form button {
  width: 100%;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 6px;
  border: none;
  outline: none;
  font-size: 14px;
}

#candidate-form button {
  background: linear-gradient(135deg, #33ccff, #00cc66);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

#candidate-form button:hover {
  background: linear-gradient(135deg, #00cc66, #33ccff);
}

#candidate-list {
  margin-top: 15px;
}

/* ================= Scrollbar Styling ================= */
.content::-webkit-scrollbar {
  width: 8px;
}
.content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 5px;
}



