/* ═══════════════════════════════════════════════════════════════
   GLOBAL STYLES.CSS
   Shared across every page (header/nav, footer, resets, design
   tokens, and the common .resource-card component).
   Load this file FIRST on every page, before any page-specific
   stylesheet (resources.css, index.css, etc).
═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────
   DESIGN TOKENS
   Combined token set used by the header/nav, footer, and both
   the resources page and the home page. Page-specific stylesheets
   may add their own additional/override tokens for local sizing
   (e.g. index.css overrides --radius-sm/md/lg for its own scale).
───────────────────────────────────────────────────────────── */
:root {
  /* brand colors */
  --blue:        #2563EB;
  --blue-dark:   #1D4ED8;
  --blue-light:  #EFF6FF;
  --blue-mid:    #BFDBFE;
  --green:       #10B981;
  --green-dark:  #059669;
  --green-light: #D1FAE5;
  --amber:       #F59E0B;
  --amber-light: #FEF3C7;
  --danger:      #EF4444;

  /* ink / text scale */
  --ink:         #0F172A;
  --ink-2:       #1E293B;
  --ink-mid:     #1E293B;
  --ink-3:       #334155;
  --ink-soft:    #475569;
  --muted:       #64748B;
  --muted-2:     #94A3B8;
  --ink-mute:    #94A3B8;
  --border:      #E2E8F0;
  --surface:     #F8FAFC;
  --white:       #FFFFFF;

  /* page-level aliases (used throughout resources.html) */
  --primary:         #2563EB;
  --primary-light:   #EFF6FF;
  --primary-mid:     #BFDBFE;
  --secondary:       #10B981;
  --secondary-light: #D1FAE5;
  --bg:              #FFFFFF;
  --bg-alt:          #F8FAFC;
  --text-head:       #0F172A;
  --text-body:       #334155;
  --text-muted:      #64748B;
  --text-faint:      #94A3B8;
  --warning:         #F59E0B;

  /* layout */
  --nav-h:    64px;
  --topbar-h: 36px;

  /* radii (default/global scale — page files may override) */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* shadows */
  --shadow-sm: 0 1px 4px rgba(15,23,42,.07);
  --shadow-md: 0 4px 20px rgba(15,23,42,.10);
  --shadow-lg: 0 8px 32px rgba(15,23,42,.12);

  /* type */
  --font-sans:    'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Sora', var(--font-sans);
}

/* ─────────────────────────────────────────────────────────────
   RESET / BASE
───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--text-body);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0px;
}

/* Page content offset below the fixed header (used on every page) */
.page-wrapper {
  padding-top: var(--nav-h);
  padding-bottom: 80px;
}

/* Shared grid utilities used across pages */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.grid-5 { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }

/* Shared shimmer/skeleton loading utility */
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton {
  background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════════════
   HEADER / NAVBAR
═══════════════════════════════════════════════════════════════ */
#edukated-header {
  position: fixed;
  top: 0;
  left: 0; right: 0;
  z-index: 1000;
  background: var(--white);
  border-bottom: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-sans);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  height: var(--nav-h); padding: 0 20px;
  display: flex; align-items: center; gap: 12px;
}

/* Logo */
.nav-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; flex-shrink: 0; }
.nav-logo-mark { display: flex; align-items: center; }
.nav-logo-text { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }

/* Search */
.nav-search-wrap { flex: 1; max-width: 380px; position: relative; }
.nav-search-box { position: relative; display: flex; align-items: center; }
.nav-search-icon { position: absolute; left: 12px; color: var(--muted-2); pointer-events: none; }
.nav-search-input {
  width: 100%; height: 40px; padding: 0 14px 0 38px;
  border: 1.5px solid var(--border); border-radius: 20px;
  background: var(--surface); font-family: var(--font-sans);
  font-size: 0.84rem; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.nav-search-input::placeholder { color: var(--muted-2); }
.nav-search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); background: white; }
.nav-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  max-height: 420px; overflow-y: auto; z-index: 2000;
}
.nav-search-results:empty { display: none; }

/* Desktop nav links */
.nav-links { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.nav-link {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 7px;
  font-size: 0.875rem; font-weight: 600; color: var(--ink-3);
  text-decoration: none; transition: color .15s, background .15s;
}
.nav-link:hover, .nav-link.active { color: var(--blue); background: var(--blue-light); }
.nav-link--highlight { color: var(--green-dark); background: #ECFDF5; }
.nav-link--highlight:hover, .nav-link--highlight.active { background: #D1FAE5; color: var(--green-dark); }

/* Nav right */
.nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 18px; border-radius: 8px; font-family: var(--font-sans);
  font-size: 0.84rem; font-weight: 700; text-decoration: none;
  cursor: pointer; border: 2px solid transparent;
  transition: background .15s, color .15s, border-color .15s; white-space: nowrap;
}
.nav-btn--outline { color: var(--blue); border-color: var(--blue-mid); background: transparent; }
.nav-btn--outline:hover { background: var(--blue-light); border-color: var(--blue); }
.nav-btn--primary { color: white; background: var(--blue); border-color: var(--blue); }
.nav-btn--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.nav-btn--full { width: 100%; }

/* Bell */
.nav-bell-wrap { position: relative; }
.nav-bell-btn {
  position: relative; width: 40px; height: 40px;
  border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--ink-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.nav-bell-btn:hover { background: var(--blue-light); color: var(--blue); }
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px; background: var(--danger);
  color: white; font-size: 0.62rem; font-weight: 800;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid white; font-family: var(--font-sans);
}
.notif-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 340px; background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  z-index: 2000; overflow: hidden;
}

/* Avatar + user dropdown */
.nav-user-menu { position: relative; }
.nav-avatar-btn { display: flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue) 0%, #7C3AED 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
#navInitials { font-family: var(--font-sans); font-size: 0.78rem; font-weight: 800; color: white; letter-spacing: 0.02em; }
.nav-avatar-caret { color: var(--muted); transition: transform .15s; }
.nav-avatar-btn[aria-expanded="true"] .nav-avatar-caret { transform: rotate(180deg); }
.nav-user-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  min-width: 210px; background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  z-index: 2000; overflow: hidden; padding: 6px 0;
}
.nav-user-dropdown-header {
  padding: 10px 16px 8px; font-family: var(--font-sans);
  font-size: 0.78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.nav-dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  font-family: var(--font-sans); font-size: 0.86rem; font-weight: 500;
  color: var(--ink-2); text-decoration: none; background: none;
  border: none; width: 100%; text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-dropdown-item:hover { background: var(--surface); color: var(--blue); }
.nav-dropdown-item--danger { color: var(--danger); }
.nav-dropdown-item--danger:hover { background: #FEF2F2; color: #B91C1C; }
.nav-dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* Bottom mobile nav */
.mobile-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: 62px; background: white; border-top: 1.5px solid var(--border);
  box-shadow: 0 -4px 20px rgba(15,23,42,.08); z-index: 999;
  padding: 0 4px; align-items: stretch; justify-content: space-around;
}
.mbn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; flex: 1; padding: 8px 4px 10px; text-decoration: none;
  color: var(--muted); font-family: var(--font-sans); font-size: 0.67rem;
  font-weight: 600; letter-spacing: 0.01em; transition: color .15s; position: relative;
}
.mbn-item:hover, .mbn-item.active { color: var(--blue); }
.mbn-item.active svg { stroke: var(--blue); }
.mbn-center-bubble {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--blue) 0%, #7C3AED 100%);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(37,99,235,.35); margin-top: -20px; margin-bottom: 2px; flex-shrink: 0;
}
.mbn-item--center:hover .mbn-center-bubble,
.mbn-item--center.active .mbn-center-bubble { background: linear-gradient(135deg, var(--blue-dark) 0%, #6D28D9 100%); }
.mbn-item--center .mbn-center-bubble + span { margin-top: -4px; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.nav-user-dropdown[style*="block"], .notif-dropdown[style*="block"], .nav-mobile-drawer[style*="block"] { animation: slideDown .18s ease; }

/* ═══════════════════════════════════════════════════════════════
   SHARED RESOURCE CARD COMPONENT
   Identical component used on both resources.html and index.html
   (e.g. "related resources" / "recently added" style cards).
═══════════════════════════════════════════════════════════════ */
.resource-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.resource-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.resource-card__img { width: 100%; height: 180px; object-fit: cover; background: var(--surface); }
.resource-card__img-placeholder {
  width: 100%; height: 180px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  background: linear-gradient(135deg, var(--primary-light), #EFF6FF);
}
.resource-card__body { padding: 18px 20px; flex: 1; display: flex; flex-direction: column; }
.resource-card__badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--primary); background: var(--primary-light);
  padding: 3px 9px; border-radius: 5px; margin-bottom: 10px;
}
.resource-card__badge--green { color: #047857; background: var(--secondary-light); }
.resource-card__badge--amber { color: #92400E; background: var(--amber-light); }
.resource-card__title {
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 700;
  color: var(--text-head); line-height: 1.4; margin-bottom: 8px;
}
.resource-card__desc {
  font-size: 0.83rem; color: var(--text-muted); line-height: 1.6; flex: 1; margin-bottom: 16px;
}
.resource-card__meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.75rem; color: var(--text-faint);
}

.leaderboard-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.leaderboard-table {
  min-width: 560px; /* forces scroll instead of squeeze on small screens */
  border-collapse: collapse;
  width: 100%;
}

/* Optional: subtle scroll affordance on mobile */
@media (max-width: 640px) {
  .leaderboard-scroll::after {
    content: "";
  }
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════════ */
.site-footer { background: #0F172A; color: rgba(255,255,255,.65); padding: 48px 0 24px; font-size: 0.84rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 36px; }
.footer-brand .logo { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; color: #fff; margin-bottom: 10px; }
.footer-brand p { line-height: 1.7; max-width: 240px; }
.footer-col h4 { font-family: var(--font-display); font-size: 0.8rem; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.footer-col a { display: block; color: rgba(255,255,255,.55); padding: 3px 0; font-size: 0.83rem; transition: color .15s; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — header/nav/footer/page-wrapper
═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .footer-grid   { grid-template-columns: 1fr 1fr; }
  .nav-search-wrap { max-width: 220px; }
  .nav-links { display: none; }
  #navRegisterBtn { display: none; }
}
@media (max-width: 768px) {
  .footer-grid   { grid-template-columns: 1fr; }
  .footer-col:not(.footer-brand) { display: none; }
  .page-wrapper  { padding-bottom: 70px; }
}
@media (max-width: 640px) {
  .nav-search-wrap { display: none; }
  #navLoginBtn    { display: none !important; }
  #navRegisterBtn { display: none !important; }
  .mobile-bottom-nav { display: flex; }
  .nav-actions { gap: 6px; }
}
@media (min-width: 641px) {
  .mobile-bottom-nav { display: none; }
}
  #edukated-footer {
    background: #0D1F3C;
    padding: 32px 20px 24px;
    font-family: var(--font-body, 'Inter', sans-serif);
    position: relative;
    overflow: hidden;
  }
  #edukated-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
  }
  .ef-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    position: relative;
    z-index: 1;
  }
  .ef-brand {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-display, 'Sora', sans-serif);
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
  }
  .ef-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
  }
  .ef-links a {
    font-size: 0.82rem;
    font-weight: 500;
    color: #94A3B8;
    text-decoration: none;
    padding: 3px 9px;
    border-radius: 5px;
    transition: color .15s, background .15s;
  }
  .ef-links a:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
  }
  .ef-divider {
    width: 32px;
    height: 1px;
    background: rgba(255,255,255,0.10);
    border-radius: 2px;
  }
  .ef-legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
  }
  .ef-legal a {
    font-size: 0.74rem;
    font-weight: 500;
    color: #64748B;
    text-decoration: none;
    transition: color .15s;
  }
  .ef-legal a:hover { color: #94A3B8; }
  .ef-dot {
    font-size: 0.74rem;
    color: #1E3A5F;
  }
  .ef-copy {
    font-size: 0.72rem;
    color: #475569;
    margin-top: 2px;
  }
