/*
Theme Name: CME Classic
Theme URI: https://sunshinelearner.com
Author: CME Home
Description: A WordPress theme matching the Moodle Classic color scheme and layout for CME Home.
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: cme-classic
*/

/* =============================================
   CSS Variables — Moodle Classic color scheme
   ============================================= */
:root {
  --primary:    #0f6cbf;
  --secondary:  #ced4da;
  --success:    #357a32;
  --info:       #008196;
  --warning:    #f0ad4e;
  --danger:     #ca3120;
  --light:      #f8f9fa;
  --dark:       #343a40;
  --gray:       #6a737b;
  --white:      #ffffff;
  --link-color: #0f6cbf;
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* =============================================
   Reset / Base
   ============================================= */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: #1d2125;
  background-color: var(--light);
}

a {
  color: var(--link-color);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 500;
  line-height: 1.2;
  color: #1d2125;
}

p { margin-top: 0; margin-bottom: 1rem; }

/* =============================================
   Skip Link (accessibility)
   ============================================= */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* =============================================
   NAVBAR  (matches Moodle Classic white navbar)
   ============================================= */
#site-navigation-wrapper {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: var(--white);
  border-bottom: 1px solid var(--secondary);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.navbar-inner {
  display: flex;
  align-items: center;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 56px;
  gap: 1rem;
}

/* Brand / site name */
.navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1d2125 !important;
  white-space: nowrap;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}
.navbar-brand:hover { color: var(--primary) !important; text-decoration: none; }

.navbar-brand img {
  height: 40px;
  width: auto;
}

/* Primary nav links */
.primary-nav {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.primary-nav > li { position: relative; }

.primary-nav > li > a {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  height: 56px;
  color: rgba(0,0,0,.55);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.primary-nav > li > a:hover,
.primary-nav > li.current-menu-item > a,
.primary-nav > li.current-menu-ancestor > a {
  color: var(--primary);
  border-bottom-color: var(--primary);
  text-decoration: none;
}

/* Dropdown */
.primary-nav .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--secondary);
  border-top: 2px solid var(--primary);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  z-index: 1000;
}
.primary-nav li:hover > .sub-menu { display: block; }

.primary-nav .sub-menu li a {
  display: block;
  padding: 0.5rem 1rem;
  color: rgba(0,0,0,.75);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}
.primary-nav .sub-menu li a:hover {
  background-color: var(--light);
  color: var(--primary);
}

/* User nav (right side) */
.navbar-user {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: rgba(0,0,0,.55);
}
.navbar-user a {
  color: var(--primary);
  text-decoration: none;
}
.navbar-user a:hover { text-decoration: underline; }

/* Hamburger toggle (mobile) */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--secondary);
  border-radius: 4px;
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(0,0,0,.55);
  margin: 4px 0;
  border-radius: 2px;
}

/* =============================================
   PAGE HEADER CARD
   (matches Moodle's white card header under nav)
   ============================================= */
#page-header {
  background: var(--white);
  border-bottom: 1px solid var(--secondary);
}

.page-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.page-header-inner h1 {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
  font-size: 0.875rem;
  color: var(--gray);
}
.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  margin: 0 0.4rem;
  color: var(--secondary);
}
.breadcrumb-item a { color: var(--primary); }
.breadcrumb-item.active { color: var(--gray); }

/* =============================================
   MAIN CONTENT WRAPPER
   ============================================= */
#page-wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Content + Sidebar grid */
.content-sidebar-wrap {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}
.content-sidebar-wrap.no-sidebar {
  grid-template-columns: 1fr;
}

/* =============================================
   CARD  (used for post/page cards)
   ============================================= */
.card {
  background: var(--white);
  border: 1px solid #dee2e6;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.card-body { padding: 1.25rem; }
.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.card-meta {
  font-size: 0.82rem;
  color: var(--gray);
  margin-bottom: 0.75rem;
}
.card-thumbnail { width: 100%; }
.card-excerpt { font-size: 0.95rem; color: #495057; }
.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #dee2e6;
  background: var(--light);
  font-size: 0.875rem;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.btn-primary:hover {
  background-color: #0a58a0;
  border-color: #0a58a0;
  color: var(--white);
  text-decoration: none;
}
.btn-secondary {
  background-color: var(--white);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-secondary:hover {
  background-color: var(--light);
  text-decoration: none;
}

/* Read more link */
.read-more {
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 500;
}

/* =============================================
   SINGLE POST / PAGE
   ============================================= */
.entry-header { margin-bottom: 1.5rem; }
.entry-title { font-size: 1.75rem; font-weight: 700; }
.entry-meta { font-size: 0.85rem; color: var(--gray); margin-top: 0.25rem; }

.entry-content {
  font-size: 1rem;
  line-height: 1.7;
  color: #212529;
}
.entry-content h2 { font-size: 1.4rem; margin-top: 1.5rem; }
.entry-content h3 { font-size: 1.2rem; margin-top: 1.25rem; }
.entry-content ul, .entry-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.entry-content blockquote {
  border-left: 4px solid var(--primary);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  color: var(--gray);
  background: var(--light);
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar .widget {
  background: var(--white);
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.sidebar .widget-title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dark);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar ul li { padding: 0.3rem 0; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
.sidebar ul li:last-child { border-bottom: none; }
.sidebar ul li a { color: var(--primary); }

/* =============================================
   FOOTER
   ============================================= */
#colophon {
  background: var(--dark);
  color: rgba(255,255,255,.75);
  margin-top: 2rem;
  border-top: 3px solid var(--primary);
}

.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.footer-widget-title {
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.footer-widget ul { list-style: none; margin: 0; padding: 0; }
.footer-widget ul li { padding: 0.25rem 0; font-size: 0.875rem; }
.footer-widget ul li a { color: rgba(255,255,255,.65); }
.footer-widget ul li a:hover { color: var(--white); text-decoration: none; }

.footer-bottom {
  background: rgba(0,0,0,.2);
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  color: rgba(255,255,255,.5);
}
.footer-bottom a { color: rgba(255,255,255,.65); }

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
  display: flex;
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  gap: 0.25rem;
}
.page-link {
  display: block;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--secondary);
  border-radius: 4px;
  color: var(--primary);
  background: var(--white);
  text-decoration: none;
  font-size: 0.9rem;
}
.page-link:hover { background: var(--light); }
.page-link.current {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* =============================================
   ALERT / NOTICE
   ============================================= */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  font-size: 0.9rem;
}
.alert-info    { background: #d1ecf1; border-color: #bee5eb; color: #0c5460; }
.alert-success { background: #d4edda; border-color: #c3e6cb; color: #155724; }
.alert-warning { background: #fff3cd; border-color: #ffeeba; color: #856404; }
.alert-danger  { background: #f8d7da; border-color: #f5c6cb; color: #721c24; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 991px) {
  .content-sidebar-wrap {
    grid-template-columns: 1fr;
  }
  .sidebar { order: 2; }
}

@media (max-width: 767px) {
  .primary-nav { display: none; flex-direction: column; width: 100%; }
  .primary-nav.open { display: flex; }
  .nav-toggle { display: flex; flex-direction: column; }

  .navbar-inner { flex-wrap: wrap; }

  .primary-nav > li > a {
    height: auto;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--secondary);
    border-left: 3px solid transparent;
  }
  .primary-nav > li > a:hover,
  .primary-nav > li.current-menu-item > a {
    border-left-color: var(--primary);
    border-bottom-color: var(--secondary);
    background: var(--light);
  }

  .primary-nav .sub-menu {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    padding-left: 1rem;
    background: var(--light);
  }
  .primary-nav li.open > .sub-menu { display: block; }

  .navbar-user { margin-left: 0; width: 100%; padding: 0.5rem 1rem; font-size: 0.85rem; }
}
