/* ScholarZim Visual Design and Color Guide (v2.0) */

:root {
  /* 2. Primary Colour Palette */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8F9FA;
  --text-navy: #001F3F;
  --text-muted: #6C757D;
  --text-white: #FFFFFF;
  --cta-cyan: #00BCD4;
  --cta-cyan-hover: #00A0B5;
  --cta-cyan-light: rgba(0, 188, 212, 0.12);

  /* 3. Functional and Secondary Accents */
  --accent-gold: #FFD700;
  --accent-gold-bg: #FFFDF0;
  --accent-gold-border: #FFE566;
  --accent-green: #28A745;
  --accent-green-bg: #E8F5E9;
  --utility-grey: #6C757D;
  --utility-grey-light: #F8F9FA;
  --utility-grey-border: #E9ECEF;
  --utility-disabled: #ADB5BD;

  /* 4. Typography & Spacing */
  --font-system: -apple-system, BlinkMacSystemFont, "San Francisco", "Roboto", "Segoe UI", sans-serif;
  
  --h1-size: 26px;
  --h1-lh: 1.2;
  --h2-size: 20px;
  --h2-lh: 1.3;
  --body-size: 16px;
  --body-lh: 1.5;

  /* Touch Ergonomics */
  --min-tap-target: 44px;
  --border-radius-sm: 4px;
  --border-radius-pill: 9999px;
  --header-height: 60px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-system);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-navy);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1 {
  font-size: var(--h1-size);
  line-height: var(--h1-lh);
  font-weight: 700;
  color: var(--text-navy);
}

h2 {
  font-size: var(--h2-size);
  line-height: var(--h2-lh);
  font-weight: 600;
  color: var(--text-navy);
}

/* 6. Performance-Driven Sticky Header (Max 60px height) */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: var(--text-navy);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-white);
  font-weight: 700;
  font-size: 1.15rem;
  height: var(--min-tap-target);
}

.brand-logo .logo-icon {
  width: 32px;
  height: 32px;
  background-color: var(--cta-cyan);
  color: var(--text-navy);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  min-height: var(--min-tap-target);
  display: flex;
  align-items: center;
  border-radius: var(--border-radius-sm);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.12);
}

.nav-link.active {
  border-bottom: 3px solid var(--cta-cyan);
}

/* Header Controls & Role Switcher */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.offline-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--border-radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(40, 167, 69, 0.15);
  color: #1E7E34;
  border: 1px solid var(--accent-green);
}

.offline-pill.is-offline {
  background: #FFF3CD;
  color: #856404;
  border-color: #FFEEBA;
}

.role-switcher-badge {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
}

.role-switcher-badge select {
  background: transparent;
  border: none;
  color: var(--cta-cyan);
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

/* Main Container */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
}

.public-good-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--utility-grey-light);
  border: 1px solid var(--utility-grey-border);
  padding: 0.35rem 1rem;
  border-radius: var(--border-radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-navy);
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: var(--h1-size);
  line-height: var(--h1-lh);
  color: var(--text-navy);
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  font-size: var(--body-size);
  line-height: var(--body-lh);
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 1.5rem;
}

/* 5.1 Subject Quick-Link Chips (Interactive, 2px Cyan border, Navy text, Cyan fill on tap) */
.subject-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--min-tap-target);
  padding: 0.5rem 1.25rem;
  border-radius: var(--border-radius-pill);
  border: 2px solid var(--cta-cyan);
  background-color: var(--bg-primary);
  color: var(--text-navy);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.subject-chip:hover, .subject-chip:active, .subject-chip.active {
  background-color: var(--cta-cyan);
  color: var(--text-white);
}

/* 5.3 Buttons (Minimum 44x44px Tap Target) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--min-tap-target);
  min-width: var(--min-tap-target);
  padding: 0.6rem 1.25rem;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.btn-cyan, .btn-primary {
  background-color: var(--cta-cyan);
  color: var(--text-white);
}

.btn-cyan:hover, .btn-primary:hover {
  background-color: var(--cta-cyan-hover);
}

.btn-navy {
  background-color: var(--text-navy);
  color: var(--text-white);
}

.btn-navy:hover {
  background-color: #00152B;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--utility-grey-border);
  color: var(--text-navy);
}

.btn-outline:hover {
  background-color: var(--utility-grey-light);
}

.btn-sm {
  min-height: 38px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
}

.btn-disabled, .btn:disabled {
  background-color: var(--utility-disabled) !important;
  color: var(--text-white) !important;
  cursor: not-allowed;
  opacity: 0.7;
}

/* 3. Gold Announcements Strip */
.announcements-strip {
  background-color: var(--accent-gold-bg);
  border: 1px solid var(--accent-gold-border);
  border-left: 4px solid var(--accent-gold);
  border-radius: var(--border-radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.announcements-strip h3 {
  color: #856404;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.announcements-strip p {
  color: #664D03;
  font-size: 0.9rem;
}

/* Cards & Layout Containers */
.card-panel {
  background-color: var(--bg-primary);
  border: 1px solid var(--utility-grey-border);
  border-radius: var(--border-radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.resource-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--utility-grey-border);
  border-radius: var(--border-radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.resource-card:hover {
  border-color: var(--cta-cyan);
}

/* 5.1 Metadata Badges (12px text, 4px radius) */
.badge {
  display: inline-block;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-level { background-color: var(--utility-grey-light); color: var(--text-navy); border: 1px solid var(--utility-grey-border); }
.badge-subject { background-color: var(--cta-cyan-light); color: #007A8A; }
.badge-type { background-color: #E2E8F0; color: var(--text-navy); }

/* 3. Green Verified Educator Badge */
.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background-color: var(--accent-green-bg);
  color: var(--accent-green);
  font-weight: 600;
  font-size: 12px;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(40, 167, 69, 0.3);
}

/* 5.2 Student Progress Bar (8px height track #E9ECEF with Cyan #00BCD4 fill & mandatory disclaimer sub-text) */
.progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--utility-grey-border);
  border-radius: var(--border-radius-pill);
  overflow: hidden;
  margin: 0.5rem 0 0.25rem;
}

.progress-fill {
  height: 100%;
  background-color: var(--cta-cyan);
  border-radius: var(--border-radius-pill);
  transition: width 0.3s ease;
}

.progress-disclaimer {
  font-size: 12px;
  color: var(--utility-grey);
  margin-top: 0.25rem;
}

/* Form Controls */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-navy);
  margin-bottom: 0.35rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  min-height: var(--min-tap-target);
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--utility-grey-border);
  border-radius: var(--border-radius-sm);
  color: var(--text-navy);
  font-size: 1rem;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--cta-cyan);
  box-shadow: 0 0 0 3px var(--cta-cyan-light);
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: var(--utility-grey-light);
  border: 1px solid var(--utility-grey-border);
  border-radius: var(--border-radius-sm);
  padding: 1rem 1.25rem;
}

.stat-val {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-navy);
}

.stat-lbl {
  font-size: 0.85rem;
  color: var(--utility-grey);
}

/* Footer */
.footer {
  background-color: var(--text-navy);
  color: var(--text-white);
  padding: 2rem 1rem;
  margin-top: auto;
  font-size: 0.9rem;
}

.footer a {
  color: var(--cta-cyan);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 31, 63, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-container {
  width: 100%;
  max-width: 500px;
  background: var(--bg-primary);
  border-radius: var(--border-radius-sm);
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .nav-links { display: none; } /* Mobile ergonomics */
}
