/* =========================================================
   GLOBAL RESETS & BODY
   ========================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  width: 100%;
  overflow-x: hidden;
  background-color: #e5ece8;
  color: #333;
}

/* =========================================================
   HEADER
   ========================================================= */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background-color: #2d5a43;
  gap: 10px;
  width: 100%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

header h2 {
  color: #ffffff;
  margin: 0;
  font-size: 1.1rem;
  white-space: nowrap;
}

header nav ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap; /* a nav with 3+ pills (e.g. admin.html) overflowed off-screen on narrow phones without this (Sept 2026) */
  justify-content: center;
  gap: 8px;
}

header nav a {
  text-decoration: none;
  color: #2d5a43;
  font-weight: bold;
  background-color: #ffffff;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-block;
  white-space: nowrap;
  box-shadow:
    -2px -2px 5px rgba(255, 255, 255, 0.15),
    3px 3px 7px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.15s ease, transform 0.15s ease, background 0.2s;
}

header nav a:hover {
  transform: translateY(-1px);
  box-shadow:
    -2px -2px 6px rgba(255, 255, 255, 0.2),
    4px 4px 9px rgba(0, 0, 0, 0.4);
}

header nav a:active,
header nav a.active {
  color: #ffffff;
  background-color: #21421b;
  transform: translateY(1px);
  box-shadow:
    inset 2px 2px 5px rgba(0, 0, 0, 0.4),
    inset -2px -2px 4px rgba(255, 255, 255, 0.06);
}

/* =========================================================
   MAIN LAYOUT (SIDE-BY-SIDE 70/30)
   ========================================================= */
.main-container {
  display: flex;
  gap: 15px;
  padding: 15px;
  width: 100%;
}

.left-content {
  flex: 6;
  min-width: 0;
}

.right-sidebar {
  flex: 4;
  min-width: 0;
  background-color: #fcf8ed;
  padding: 15px;
  border-radius: 8px;
  box-sizing: border-box;
}

/* =========================================================
   VIDEO BOX
   ========================================================= */
.video-box {
  overflow: hidden;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #1e1e1e;
  border-radius: 8px;
  border: 2px solid #2d5a43;
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.video-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.play-button {
  width: 0;
  height: 0;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
  border-left: 35px solid #ffffff;
  margin-bottom: 15px;
  transition: transform 0.2s;
}

.video-box p {
  color: #ffffff;
  font-size: 16px;
  margin: 0;
}

.video-box:hover {
  background-color: #0b0b0b;
}

.video-box:hover .play-button {
  transform: scale(1.15);
}

/* =========================================================
   GALLERY GRID
   ========================================================= */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  margin-bottom: 40px;
}

.gallery-item {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  border: 1px solid #cccccc;
  overflow: hidden;
  transition: transform 0.2s, background-color 0.2s;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.gallery-item:hover {
  background-color: #2d5a43;
  color: #ffffff;
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* =========================================================
   SIDEBAR WIDGETS
   ========================================================= */
.right-sidebar h3 {
  color: #2d5a43;
  font-size: 18px;
  margin-top: 0;
  margin-bottom: 15px;
  border-bottom: 2px solid #2d5a43;
  padding-bottom: 5px;
}

.sidebar-widget {
  background-color: #ffffff;
  padding: 12px;
  margin-bottom: 15px;
  border-radius: 6px;
  border-left: 4px solid #2d5a43;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.sidebar-widget h4 {
  margin: 0 0 8px 0;
  color: #333333;
  font-size: 13px;
}

.sidebar-widget ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.sidebar-widget li {
  font-size: 12px;
  color: #555555;
  margin-bottom: 8px;
  line-height: 1.4;
}

.sidebar-widget p {
  font-size: 12px;
  color: #555555;
  margin: 0;
  line-height: 1.4;
}

.announcement-box {
  border-left-color: #d9534f;
}

/* =========================================================
   SIDEBAR CALENDAR WIDGET
   ========================================================= */
.calendar-widget {
  background: #ffffff;
  border-radius: 8px;
  padding: 10px;
  margin-top: 15px;
  border: 1px solid #dcdcdc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.calendar-widget h4 {
  color: #24471f;
  font-size: 13px;
  margin-bottom: 2px;
}

.sidebar-subtext {
  font-size: 11px;
  color: #666;
  margin-bottom: 10px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.sidebar-calendar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
  table-layout: fixed;
}

.sidebar-calendar-table th {
  background-color: #315c2b;
  color: #ffffff;
  padding: 6px 4px;
  font-weight: 600;
  border-radius: 4px 4px 0 0;
}

.sidebar-calendar-table td {
  padding: 6px 4px;
  border-bottom: 1px solid #e2e8e4;
  color: #333;
  vertical-align: top;
  word-wrap: break-word;
}

.sidebar-calendar-table tbody tr:nth-child(even) {
  background-color: #f8faf8;
}

.sidebar-calendar-table tbody tr:hover {
  background-color: #eef4f0;
}

/* Badge (single definitive version — covers calendar + exam badges) */
.badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 6px;
  margin-top: 4px;
  text-transform: uppercase;
}

.bg-green  { background-color: #d1fae5; color: #065f46; }
.bg-red    { background-color: #fee2e2; color: #991b1b; }
.bg-yellow { background-color: #fef3c7; color: #92400e; }
.bg-blue   { background-color: #e0e7ff; color: #3730a3; }
.bg-purple { background-color: #f3e8ff; color: #6b21a8; }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  background-color: #2d5a43;
  color: #ffffff;
  padding: 25px 15px;
  text-align: center;
  margin-top: 30px;
}

.footer-content p {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 15px;
  padding-top: 12px;
}

.footer-bottom p {
  font-size: 12px;
  color: #d0dad4;
}

/* =========================================================
   STAFF LOGIN BUTTON + MODAL
   ========================================================= */
.staff-btn {
  background-color: #fdf6e3;
  color: #333333;
  border: 1px solid #e0d6b8;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.staff-btn:hover {
  background-color: #f5ebcc;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #ffffff;
  padding: 24px;
  border-radius: 8px;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  position: relative;
}

.modal-content h2 {
  font-size: 18px;
  margin-top: 0;
  margin-bottom: 20px;
  color: #2c3e50;
  text-align: center;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 22px;
  font-weight: bold;
  color: #888;
  cursor: pointer;
}

.close-btn:hover {
  color: #000;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 14px;
  margin-bottom: 5px;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 8px 10px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.login-submit-btn {
  width: 100%;
  padding: 10px;
  background-color: #2c3e50;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
}

.login-submit-btn:hover {
  background-color: #1a252f;
}

.error-text {
  color: #e74c3c;
  font-size: 13px;
  margin-bottom: 10px;
  display: none;
  text-align: center;
}

/* =========================================================
   RESULTS / SEARCH PAGE
   (used on the student-results page, e.g. matokeo.html)
   ========================================================= */
.container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}

.section-header {
  text-align: center;
  margin-bottom: 35px;
}

.section-header h1 {
  color: #24471f;
  font-size: 32px;
  margin-bottom: 8px;
  position: relative;
  display: inline-block;
}

.section-header h1::after {
  content: '';
  display: block;
  width: 60%;
  height: 3px;
  background-color: #315c2b;
  margin: 8px auto 0;
  border-radius: 2px;
}

.section-header p {
  color: #555;
  font-size: 16px;
}

.class-btn-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 35px;
  flex-wrap: wrap;
}

.class-btn {
  background-color: #ffffff;
  color: #315c2b;
  border: 2px solid #315c2b;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.class-btn:hover,
.class-btn.active {
  background-color: #315c2b;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.results-section {
  display: none;
  background: #ffffff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid #d0dad4;
}

.results-section.active {
  display: block;
}

.section-title {
  color: #24471f;
  font-size: 22px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8e4;
  padding-bottom: 10px;
}

.year-btn-container {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.year-btn {
  background-color: #e8f0eb;
  color: #315c2b;
  border: 1px solid #315c2b;
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.year-btn:hover,
.year-btn.active {
  background-color: #315c2b;
  color: #ffffff;
}

.year-content {
  display: none;
}

.year-content.active {
  display: block;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.exam-card {
  background: #f9fbf9;
  padding: 22px 18px;
  border-radius: 10px;
  border-left: 5px solid #315c2b;
  border-top: 1px solid #e0e7e2;
  border-right: 1px solid #e0e7e2;
  border-bottom: 1px solid #e0e7e2;
  text-align: center;
}

.exam-card.necta-card {
  border-left-color: #d97706;
  max-width: 450px;
  margin: 0 auto;
}

.exam-card h3 {
  color: #24471f;
  font-size: 18px;
  margin-bottom: 8px;
}

.exam-card p {
  font-size: 14px;
  color: #666;
  margin-bottom: 18px;
}

.btn-action {
  display: inline-block;
  background-color: #315c2b;
  color: white;
  text-decoration: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease;
}

.btn-action:hover {
  background-color: #21421b;
}

.pdf-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 15px;
}

.search-widget-container {
  margin-top: 25px;
  background: #f4f8f5;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #cee0d5;
  display: none;
}

.search-widget-container.active {
  display: block;
}

.search-widget-container label {
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
  color: #24471f;
}

.search-input-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.search-input-group input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 15px;
}

.result-box {
  margin-top: 15px;
  padding: 16px;
  background-color: #ffffff;
  border-left: 4px solid #315c2b;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.student-result-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-top: 10px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.result-row:last-child {
  border-bottom: none;
}

.result-key {
  font-weight: 600;
  color: #475569;
  margin-right: 12px;
}

.result-value {
  font-weight: 600;
  color: #1e293b;
  text-align: right;
  word-break: break-word;
}

.loading-spinner {
  color: #64748b;
  font-style: italic;
}

.hidden {
  display: none !important;
}

/* =========================================================
   LEADERSHIP CARDS (uongozi.html)
   ========================================================= */
.card {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #d0dad4;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px 25px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.card.featured {
  grid-column: 1 / -1;
  max-width: 700px;
  margin: 0 auto 15px auto;
  border-top: 5px solid #315c2b;
  background: linear-gradient(180deg, #ffffff 0%, #f7faf8 100%);
}

.avatar-box {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background-color: #e8f0eb;
  border: 3px solid #315c2b;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: #315c2b;
}

.card.featured .avatar-box {
  width: 130px;
  height: 130px;
}

.avatar-box svg {
  width: 60px;
  height: 60px;
  fill: currentColor;
}

.role-badge {
  background-color: #e8f3ea;
  color: #24471f;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  border: 1px solid #c0d8c5;
}

.card h3 {
  color: #1a1a1a;
  font-size: 20px;
  margin-bottom: 6px;
}

.card.featured h3 {
  font-size: 24px;
}

.title-sub {
  color: #315c2b;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 15px;
}

.description {
  color: #666;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
  padding: 0 10px;
}

.card-footer {
  margin-top: auto;
  width: 100%;
  padding-top: 15px;
  border-top: 1px dashed #e0e7e2;
  font-size: 13px;
  color: #666;
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* =========================================================
   MOBILE FINE-TUNING
   ========================================================= */
@media screen and (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }

  .card.featured {
    grid-column: auto;
  }
}

@media screen and (max-width: 600px) {
  header {
    padding: 10px 8px;
  }

  header h2 {
    font-size: 0.95rem;
  }

  header nav a {
    font-size: 11px;
    padding: 5px 8px;
  }

  /* 1. Home page: preserve dual-column layout on phones */
  .main-container {
    gap: 8px;
    padding: 8px 5px;
  }

  .right-sidebar {
    padding: 8px 5px;
  }

  /* 3. Leadership cards: one clean card per row */
  .grid {
    grid-template-columns: 1fr;
  }

  /* 4. Search widget & buttons: bigger tap targets, 16px input to stop iOS auto-zoom */
  .btn-action,
  .class-btn,
  .year-btn {
    padding: 11px 20px;
    font-size: 15px;
  }

  .search-input-group input[type="text"] {
    padding: 12px;
    font-size: 16px;
  }

  .site-footer {
    padding: 18px 10px;
  }

  .footer-content p {
    font-size: 13px;
  }
}

/* 5. Nav pills: shrink further on very small phones so text never wraps */
@media screen and (max-width: 400px) {
  header h2 {
    font-size: 0.85rem;
  }

  header nav a {
    font-size: 10px;
    padding: 4px 6px;
  }

  header nav ul {
    gap: 5px;
  }
}