/* ==========================================================================
   KPEMBE M/A JHS - COMPLETE CSS DESIGN SYSTEM
   ========================================================================== */

/* 1. ROOT VARIABLES & THEMES */
:root {
  --primary-orange: #E65100;
  --secondary-orange: #FF7043;
  --light-orange: #FFF3E0;
  --dark-text: #0F172A;
  --muted-text: #64748B;
  --light-bg: #F8FAFC;
  --card-bg: rgba(255, 255, 255, 0.94);
  --glass-bg: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(226, 232, 240, 0.85);
  --input-bg: rgba(248, 250, 252, 0.8);
  --input-border: #E2E8F0;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 12px 30px -5px rgba(230, 81, 0, 0.12), 0 8px 15px -6px rgba(0, 0, 0, 0.04);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --footer-bg: #0F172A;
  --footer-text: #CBD5E1;
}

[data-theme="dark"] {
  --primary-orange: #FF7043;
  --secondary-orange: #FF8A65;
  --light-orange: #3E2723;
  --dark-text: #F1F5F9;
  --muted-text: #94A3B8;
  --light-bg: #090D16;
  --card-bg: rgba(15, 23, 42, 0.92);
  --glass-bg: rgba(15, 23, 42, 0.88);
  --glass-border: rgba(51, 65, 85, 0.8);
  --input-bg: rgba(30, 41, 59, 0.8);
  --input-border: #334155;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 30px -5px rgba(0, 0, 0, 0.5);
  --footer-bg: #030712;
  --footer-text: #94A3B8;
}

/* 2. BASE STYLES */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--light-bg);
  background-image: linear-gradient(rgba(248, 250, 252, 0.35), rgba(248, 250, 252, 0.35)), url('background.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--dark-text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background-image: linear-gradient(rgba(9, 13, 22, 0.85), rgba(9, 13, 22, 0.85)), url('background.png');
}

main.container {
  flex: 1 0 auto;
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  width: 100%;
}

/* 3. HEADER & NAVIGATION */
header {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--glass-border);
  padding: 0.8rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.school-logo {
  height: 48px;
  width: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  cursor: pointer;
}

.brand-text h1 {
  font-size: 1.15rem;
  color: var(--primary-orange);
  font-weight: 800;
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.7rem;
  font-style: italic;
  color: var(--muted-text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.desktop-nav ul {
  display: flex;
  list-style: none;
  gap: 0.4rem;
}

.nav-tab {
  background: none;
  border: none;
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted-text);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.nav-tab:hover {
  color: var(--primary-orange);
  background: var(--light-orange);
}

.nav-tab.active {
  color: white;
  background: var(--primary-orange);
}

.theme-toggle-btn {
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  color: var(--dark-text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.25s ease;
}

.theme-toggle-btn:hover {
  transform: scale(1.08);
}

/* 4. HERO & SECTIONS */
.hero {
  position: relative;
  background: linear-gradient(135deg, rgba(230, 81, 0, 0.88), rgba(15, 23, 42, 0.88)), url('background.png');
  background-size: cover;
  background-position: center;
  color: white;
  padding: 4.5rem 1.8rem;
  text-align: center;
  border-radius: var(--radius-lg);
  margin-top: 1rem;
  box-shadow: var(--shadow-md);
}

.hero h2 {
  font-size: 2.3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 1.1rem;
  margin-bottom: 1.8rem;
}

/* 5. CARDS & GRID */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 1.8rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--glass-border);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.interactive-card {
  cursor: pointer;
}

.card h3 {
  color: var(--primary-orange);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.card p {
  color: var(--muted-text);
  font-size: 0.92rem;
}

.card-link {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--primary-orange);
}

/* 6. STAFF DIRECTORY & IMAGE PREVIEW BADGES */
.img-preview-container {
  display: inline-block;
  position: relative;
  cursor: pointer;
}

.staff-avatar {
  width: 95px;
  height: 95px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #4caf50;
  display: block;
  margin: 0 auto;
}

.view-badge {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  white-space: nowrap;
}

.click-hint-banner {
  font-size: 0.8rem;
  color: var(--muted-text);
  background: var(--light-orange);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--glass-border);
}

/* 7. FORMS, BUTTONS & ANIMATED LOADING SPINNER */
.btn {
  background-color: var(--primary-orange);
  color: white;
  padding: 0.8rem 1.6rem;
  border: none;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.btn:hover {
  background-color: var(--secondary-orange);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}

/* Dynamic Spinner Icon Animation */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.form-group input, 
.form-group select, 
.form-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--dark-text);
  font-size: 0.95rem;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-orange);
}

/* 8. RESULTS REPORT TABLE LAYOUT */
.results-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.results-header {
  text-align: center;
  margin-bottom: 1.2rem;
  border-bottom: 2px solid var(--primary-orange);
  padding-bottom: 0.8rem;
}

.report-logo {
  height: 60px;
  width: 60px;
  border-radius: 50%;
  margin-bottom: 0.4rem;
}

.results-header h2 {
  font-size: 1.3rem;
  color: var(--primary-orange);
  font-weight: 800;
}

.results-header p {
  font-size: 0.8rem;
  color: var(--muted-text);
}

.results-header h3 {
  font-size: 1.05rem;
  margin-top: 0.4rem;
  font-weight: 700;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

#resultsTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

#resultsTable th, 
#resultsTable td {
  padding: 0.65rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.88rem;
}

#resultsTable th {
  background: var(--light-orange);
  color: var(--dark-text);
  font-weight: 700;
}

/* 9. ABOUT & CONTENT HELPERS */
.divider {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 1.2rem 0;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-top: 1rem;
}

.about-grid h4 {
  color: var(--primary-orange);
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.styled-list {
  padding-left: 1.2rem;
}

.styled-list li {
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted-text);
}

/* 10. LIGHTBOX & MODALS */
.lightbox {
  display: none;
  position: fixed;
  z-index: 2000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.88);
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-hint {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  margin-top: 0.8rem;
  text-align: center;
}

/* 11. TAB CONTENT ANIMATION */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 12. PWA FLOATING INSTALL WIDGET */
.pwa-floating-widget {
  position: fixed;
  right: 15px;
  bottom: 85px;
  z-index: 2500;
}

.pwa-widget-content {
  background: #0f172a;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  padding: 0.6rem 0.9rem;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
}

.pwa-widget-text strong {
  display: block;
  font-size: 0.82rem;
  line-height: 1.1;
  color: #ffffff;
  font-weight: 700;
}

.pwa-widget-text p {
  font-size: 0.75rem;
  color: #fb923c;
  font-weight: 600;
}

.pwa-widget-btn {
  background: #e65100 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border-radius: 20px !important;
  padding: 0.35rem 0.8rem !important;
  font-size: 0.75rem !important;
}

.pwa-widget-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.2rem;
  cursor: pointer;
}

/* 13. MOBILE BOTTOM NAVIGATION BAR */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  z-index: 1000;
  padding: 0.4rem 0.5rem;
  justify-content: space-around;
  align-items: center;
}

.mobile-tab-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted-text);
  font-weight: 600;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
}

.mobile-tab-btn.active {
  color: var(--primary-orange);
  background: var(--light-orange);
}

/* 14. FOOTER */
footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 1.8rem 1rem;
  margin-top: auto;
  font-size: 0.85rem;
  border-top: 3px solid var(--primary-orange);
  position: relative;
  z-index: 10;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

footer strong {
  color: var(--primary-orange);
}

.developer-credit {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* 15. RESPONSIVE BREAKPOINTS */
@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }
  .mobile-nav {
    display: flex;
  }
  .hero {
    padding: 3rem 1.2rem;
  }
  .hero h2 {
    font-size: 1.7rem;
  }
  .hero p {
    font-size: 0.95rem;
  }
  footer {
    padding-bottom: 85px; /* Ensures clear separation above bottom nav */
  }
}
