/*
Theme Name:  StudyCBSE
Theme URI:   https://studycbse.com
Author:      StudyCBSE
Author URI:  https://studycbse.com
Description: Elementor-compatible WordPress theme for CBSE educational content. Fully editable with Elementor — NCERT Solutions, Important Questions & Sample Papers for Classes 6–12.
Version:     2.0.0
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: studycbse
Tags:        education, full-width-template, custom-menu, featured-images, elementor, translation-ready
*/

/* =========================================================
   CSS VARIABLES
   ========================================================= */
:root {
  --navy:       #1a3c7e;
  --navy-dark:  #0f2554;
  --navy-mid:   #1e4897;
  --orange:     #e07b1a;
  --orange-lt:  #f59322;
  --bg:         #f8f9fc;
  --white:      #ffffff;
  --text:       #222222;
  --text-muted: #555555;
  --border:     #dde3ef;
  --shadow:     0 2px 12px rgba(26,60,126,.10);
  --shadow-h:   0 6px 24px rgba(26,60,126,.18);
  --radius:     8px;
  --font-head:  'Merriweather', Georgia, serif;
  --font-body:  'Source Sans 3', Arial, sans-serif;
  --wrap:       1200px;
}

/* =========================================================
   RESET & BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; padding: 0; margin: 0; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-head); line-height: 1.3; }

/* =========================================================
   SITE STRUCTURE — Elementor full-width support
   ========================================================= */
#page { display: flex; flex-direction: column; min-height: 100vh; }
#content { flex: 1; }

/* Elementor full-width page — remove all padding */
.elementor-page #content,
.page-template-elementor-full-width #content,
body.elementor-page .site-content {
  padding: 0;
  margin: 0;
}

/* Prevent Elementor sections from being constrained */
.elementor-section-full_width .elementor-container {
  max-width: 100%;
}

/* =========================================================
   HEADER
   ========================================================= */
#masthead {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 9999;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  width: 100%;
}
.header-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logo */
.site-branding { display: flex; align-items: center; flex-shrink: 0; }
.site-branding a { text-decoration: none; display: flex; align-items: center; gap: 10px; }
.custom-logo { max-height: 44px; width: auto; display: block; }
.site-title-text {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -.5px;
  white-space: nowrap;
}
.site-title-text span { color: var(--orange-lt); }

/* Navigation */
#primary-navigation { display: flex; align-items: center; }
#primary-menu { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
#primary-menu li { position: relative; }
#primary-menu li a {
  display: block;
  color: rgba(255,255,255,.9);
  font-size: .85rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 5px;
  transition: background .18s, color .18s;
  white-space: nowrap;
}
#primary-menu li a:hover,
#primary-menu li.current-menu-item > a,
#primary-menu li.current-page-ancestor > a {
  background: rgba(255,255,255,.15);
  color: #fff;
  text-decoration: none;
}

/* Dropdown */
#primary-menu li ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--navy-dark);
  min-width: 200px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  padding: 6px 0;
  z-index: 10000;
}
#primary-menu li:hover > ul { display: block; }
#primary-menu li ul li a {
  border-radius: 0;
  padding: 9px 16px;
  font-size: .83rem;
}

/* Mobile toggle */
.menu-toggle {
  display: none;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.5);
  color: #fff;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: .85rem;
  cursor: pointer;
  transition: all .2s;
}
.menu-toggle:hover { background: rgba(255,255,255,.1); }

/* =========================================================
   HEADER — Elementor header override
   (If user builds header with Elementor, hide default)
   ========================================================= */
body.has-elementor-header #masthead { display: none; }

/* =========================================================
   MAIN CONTENT AREA
   ========================================================= */
.site-content { width: 100%; }

/* Standard page layout (non-Elementor pages) */
.page-wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* Two-column layout */
.content-sidebar-wrap {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}
.main-col { min-width: 0; }
.sidebar-col { min-width: 0; }

/* =========================================================
   ELEMENTOR COMPATIBILITY
   ========================================================= */

/* Full width pages — no restrictions */
.page-template-full-width #content,
.page-template-elementor-canvas #content {
  padding: 0 !important;
  max-width: 100% !important;
}

/* Ensure Elementor widgets render correctly */
.elementor-widget-wrap { width: 100%; }

/* Override any theme padding on Elementor sections */
.elementor-section { width: 100%; }

/* =========================================================
   BREADCRUMB
   ========================================================= */
.breadcrumb {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: .83rem;
  color: var(--text-muted);
  padding: 14px 0 10px;
}
.breadcrumb a { color: var(--navy); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #bbb; }

/* =========================================================
   TYPOGRAPHY — for non-Elementor content
   ========================================================= */
.page-title, .entry-title {
  font-family: var(--font-head);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--navy);
  margin-bottom: 16px;
  line-height: 1.25;
}
.page-intro {
  font-size: .95rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 24px;
}
.entry-content h2 {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--navy);
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.entry-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin: 20px 0 10px;
}
.entry-content p { margin-bottom: 1em; }
.entry-content ul, .entry-content ol { padding-left: 24px; margin-bottom: 1em; }
.entry-content ul li { list-style: disc; }
.entry-content ol li { list-style: decimal; }

/* =========================================================
   CARDS & GRIDS — usable in Elementor HTML widgets
   ========================================================= */
.class-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.class-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  transition: all .22s;
  box-shadow: var(--shadow);
  text-decoration: none;
  display: block;
}
.class-card:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow-h);
  transform: translateY(-3px);
  text-decoration: none;
}
.class-card h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}
.class-card p { font-size: .82rem; color: var(--text-muted); line-height: 1.7; }

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.chapter-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all .2s;
  box-shadow: var(--shadow);
  display: block;
  text-decoration: none;
}
.chapter-card:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow-h);
  transform: translateY(-2px);
  text-decoration: none;
}
.chapter-card h3 { font-size: .93rem; font-weight: 700; color: var(--navy); margin-bottom: 5px; }
.chapter-card p { font-size: .81rem; color: var(--text-muted); margin-bottom: 8px; }
.chapter-card .tag {
  font-size: .75rem;
  color: var(--navy);
  font-weight: 600;
  background: #eef1fb;
  padding: 2px 9px;
  border-radius: 20px;
  display: inline-block;
}

/* Subject cards */
.subject-list { display: flex; flex-direction: column; gap: 16px; }
.subject-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.subject-icon {
  width: 60px; height: 60px;
  border-radius: 8px;
  background: #f0f4ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}
.subject-info { flex: 1; min-width: 0; }
.subject-info h3 {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}
.subject-links { display: flex; gap: 10px; flex-wrap: wrap; font-size: .87rem; align-items: center; }
.subject-links a { color: var(--text-muted); transition: color .18s; }
.subject-links a:hover { color: var(--navy); text-decoration: underline; }
.subject-links a.hl { color: var(--navy); font-weight: 600; }
.subject-links .sep { color: #ddd; }

/* Popular content cards */
.pop-card {
  border-radius: var(--radius);
  padding: 24px 20px;
  display: block;
  text-decoration: none;
  transition: all .2s;
  box-shadow: var(--shadow);
}
.pop-card.blue { background: var(--navy); color: #fff; }
.pop-card.orange { background: var(--orange); color: #fff; }
.pop-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-h); filter: brightness(1.08); text-decoration: none; }
.pop-card h3 { font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.4; }
.pop-card p { font-size: .84rem; color: rgba(255,255,255,.88); margin-top: 4px; }

/* Pills */
.pills-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 7px 18px;
  border: 1.5px solid var(--border);
  border-radius: 25px;
  font-size: .84rem;
  font-weight: 600;
  background: var(--white);
  color: var(--navy);
  transition: all .18s;
  text-decoration: none;
  display: inline-block;
}
.pill:hover, .pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  text-decoration: none;
}

/* =========================================================
   ANSWER BOX & Q&A
   ========================================================= */
.answer-box {
  background: #fffbe8;
  border-left: 4px solid #c8973a;
  border-radius: 0 6px 6px 0;
  padding: 14px 16px;
  margin: 10px 0;
  font-size: .9rem;
  line-height: 1.75;
}
.answer-box strong { color: #7a5200; }
.equation { text-align: center; padding: 14px; font-size: 1rem; letter-spacing: 1px; }
.question-item { padding: 12px 0; border-bottom: 1px solid var(--border); font-size: .93rem; }
.question-item:last-child { border-bottom: none; }

/* Table of contents */
.toc {
  background: #f0f4ff;
  border-left: 4px solid var(--navy);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 20px;
  margin-bottom: 28px;
}
.toc h4 { font-weight: 700; color: var(--navy); margin-bottom: 10px; font-size: .95rem; }
.toc ul li { padding: 3px 0; }
.toc ul li::before { content: "›"; color: var(--navy); margin-right: 6px; font-weight: 700; }
.toc ul li a { color: var(--navy); font-size: .87rem; }

/* =========================================================
   WIDGETS / SIDEBAR
   ========================================================= */
.widget {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.widget-title {
  font-family: var(--font-head);
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}
.widget ul li {
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: .87rem;
}
.widget ul li:last-child { border-bottom: none; }
.widget ul li a { color: var(--navy); display: flex; align-items: center; gap: 6px; }
.widget ul li a::before { content: "›"; color: var(--orange); font-weight: 700; }
.widget ul li a:hover { text-decoration: underline; }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-primary {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  padding: 12px 28px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-primary:hover { background: var(--navy-dark); transform: translateY(-2px); color: #fff; text-decoration: none; }
.btn-read {
  background: var(--navy); color: #fff; font-size: .8rem; font-weight: 700;
  padding: 6px 14px; border-radius: 4px; border: none; cursor: pointer;
  display: inline-block; text-decoration: none; transition: background .2s;
}
.btn-read:hover { background: var(--navy-dark); color: #fff; }

/* =========================================================
   RELATED ARTICLES
   ========================================================= */
.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.related-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.related-card img { width: 90px; height: 65px; object-fit: cover; border-radius: 5px; flex-shrink: 0; }
.related-card h4 { font-size: .88rem; font-weight: 700; color: var(--navy); margin-bottom: 8px; }

/* =========================================================
   HERO SECTION (PHP fallback)
   ========================================================= */
.hero-section {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-mid) 60%, #2a5bb5 100%);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: .22;
}
.hero-content { position: relative; text-align: center; padding: 60px 24px 70px; max-width: 720px; }
.hero-content h1 {
  font-family: var(--font-head); font-size: 2rem; font-weight: 900;
  color: #fff; line-height: 1.3; text-shadow: 0 2px 8px rgba(0,0,0,.4);
  margin-bottom: 14px;
}
.hero-content p { color: rgba(255,255,255,.88); font-size: 1rem; margin-bottom: 28px; }

/* =========================================================
   FOOTER
   ========================================================= */
#colophon {
  background: var(--navy-dark);
  color: rgba(255,255,255,.8);
  padding: 44px 0 0;
}
.footer-widgets {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px 30px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
}
.footer-widget-area h4 {
  color: #fff; font-size: .9rem; font-weight: 700;
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1.5px solid rgba(255,255,255,.15);
}
.footer-widget-area p { font-size: .84rem; line-height: 1.75; color: rgba(255,255,255,.7); }
.footer-widget-area ul li { padding: 4px 0; }
.footer-widget-area ul li a { font-size: .84rem; color: rgba(255,255,255,.7); transition: color .18s; }
.footer-widget-area ul li a:hover { color: #fff; }
.social-icons { display: flex; gap: 10px; margin-top: 14px; }
.social-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 700; transition: opacity .2s;
  text-decoration: none; color: #fff;
}
.social-icon:hover { opacity: .8; color: #fff; }
.si-fb  { background: #3b5998; }
.si-tw  { background: #1da1f2; }
.si-yt  { background: #ff0000; }
.si-ig  { background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); }

/* Footer Elementor override */
body.has-elementor-footer #colophon { display: none; }

.site-info {
  max-width: var(--wrap); margin: 0 auto;
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex; gap: 20px; justify-content: center;
  flex-wrap: wrap; font-size: .82rem;
}
.site-info a { color: rgba(255,255,255,.6); }
.site-info a:hover { color: #fff; }
.site-info span { color: rgba(255,255,255,.4); }

/* =========================================================
   SEARCH FORM
   ========================================================= */
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
  flex: 1; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 6px;
  font-size: .93rem; font-family: var(--font-body);
}
.search-form button {
  background: var(--navy); color: #fff;
  padding: 10px 20px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer;
}

/* =========================================================
   PAGINATION
   ========================================================= */
.navigation.pagination { margin: 30px 0; }
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 5px;
  border: 1.5px solid var(--border); font-size: .85rem; font-weight: 600; color: var(--navy);
  transition: all .18s;
}
.page-numbers.current, .page-numbers:hover {
  background: var(--navy); color: #fff; border-color: var(--navy); text-decoration: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
  .class-grid { grid-template-columns: repeat(3, 1fr); }
  .content-sidebar-wrap { grid-template-columns: 1fr 260px; }
}
@media (max-width: 860px) {
  .content-sidebar-wrap { grid-template-columns: 1fr; }
  .sidebar-col { display: none; }
  .class-grid { grid-template-columns: repeat(2, 1fr); }
  .chapter-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-widgets { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: 1fr; }
  .hero-content h1 { font-size: 1.55rem; }
}
@media (max-width: 600px) {
  .header-inner { padding: 0 16px; }
  .class-grid { grid-template-columns: 1fr 1fr; }
  .chapter-grid { grid-template-columns: 1fr 1fr; }
  .footer-widgets { grid-template-columns: 1fr; }
  #primary-navigation { display: none; }
  #primary-navigation.toggled {
    display: block; background: var(--navy-dark);
    position: absolute; top: 60px; left: 0; right: 0;
    padding: 8px 0; z-index: 9999; box-shadow: 0 8px 20px rgba(0,0,0,.3);
  }
  #primary-navigation.toggled ul { flex-direction: column; gap: 0; }
  #primary-navigation.toggled ul li a { padding: 11px 20px; border-radius: 0; }
  #primary-navigation.toggled ul li ul { position: static; box-shadow: none; background: rgba(0,0,0,.2); }
  .menu-toggle { display: block; }
  .subject-card { flex-wrap: wrap; }
  .hero-content h1 { font-size: 1.3rem; }
  .page-title, .entry-title { font-size: 1.4rem; }
}
