/* =============================================
   Solution Mall - NTA/AD Design Guide
   Shared Stylesheet
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #0D6EFD;
  --primary-dark: #0a58ca;
  --secondary: #198754;
  --bg-white: #FFFFFF;
  --text-dark: #212529;
  --text-gray: #6C757D;
  --light-gray: #F8F9FA;
  --border: #DEE2E6;
  --sidebar-width: 280px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  color: var(--text-dark);
  background: var(--bg-white);
  line-height: 1.6;
}

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

/* ---- LEFT SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  padding: 12px 16px;
  background: var(--light-gray);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  text-align: center;
}

.sidebar-logo img {
  max-width: 160px;
  height: auto;
  display: block;
  margin: 0 auto 6px;
}

.sidebar-logo a {
  font-size: 0.8rem;
  color: var(--primary);
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  height: 5rem; /* 80px */
  width: 100%;
  padding: 0.75rem 1rem;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  color: var(--text-dark);
  border-left: 4px solid transparent;
  transition: background 0.15s;
}

.nav-item:hover {
  background: var(--light-gray);
  text-decoration: none;
}

.nav-item.active {
  border-left-color: var(--primary);
  background: var(--light-gray);
  color: var(--primary);
}

.nav-item svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-right: 16px;
  color: var(--primary);
  stroke: var(--primary);
}

.nav-item span {
  font-size: 0.9rem;
  line-height: 1.3;
}

/* ---- MAIN CONTENT AREA ---- */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-white);
  overflow-x: hidden;
  box-sizing: border-box;
}

.content-wrapper {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 50px;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ---- HERO SECTION ---- */
.hero {
  background: linear-gradient(135deg, #0D6EFD 0%, #5DADE2 100%);
  border-radius: 1rem;
  padding: 60px 50px;
  margin-bottom: 2rem;
  color: #fff;
}

.hero-tag {
  font-size: 0.875rem;
  background: rgba(255,255,255,0.2);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff !important;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.9);
  margin-bottom: 1.5rem;
  max-width: 700px;
}

.hero-buttons { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-primary {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  padding: 8px 24px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-primary:hover { background: #e9f0ff; transform: scale(1.02); text-decoration: none; }

.btn-secondary {
  background: transparent;
  color: #fff;
  font-weight: 600;
  padding: 8px 24px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover { background: rgba(255,255,255,0.15); text-decoration: none; }

/* ---- CHAPTER NAV CARDS ---- */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  background: #F4F7F6;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.chapter-card {
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  height: 130px;
  display: flex;
  align-items: center;
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,0.075);
  text-decoration: none;
  color: #333;
  transition: box-shadow 0.2s, transform 0.2s;
  overflow: hidden;
}
.chapter-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); transform: translateY(-2px); text-decoration: none; }

.chapter-card svg {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  margin-right: 16px;
  color: var(--primary);
  stroke: var(--primary);
}

.chapter-card-text { font-size: 16px; color: #333; line-height: 1.3; }

.chapter-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--primary);
  color: #fff;
  width: 24px; height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- CHAPTER PAGE TITLE ---- */
.page-title { margin-bottom: 2rem; }
.page-title h1 { font-size: 2.5rem; font-weight: 700; color: var(--primary); }
.page-title .subtitle { font-size: 0.875rem; color: var(--text-gray); margin-top: 6px; }
.page-title hr { border: none; border-top: 1px solid var(--border); margin-top: 1rem; }

/* ---- SECTION HEADINGS ---- */
h2 { font-size: 2rem; font-weight: 700; color: var(--primary); margin: 2rem 0 1rem; }
h3 { font-size: 1.5rem; font-weight: 600; color: var(--primary); margin: 1.5rem 0 0.75rem; }
h4 { font-size: 1.25rem; font-weight: 600; color: var(--primary); margin: 1.25rem 0 0.5rem; }

p { margin-bottom: 1.5rem; line-height: 1.6; color: var(--text-dark); }

/* ---- FIGURE / IMAGE ---- */
.figure-wrap {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #E7F1FF;
}
.figure-wrap img {
  width: 100%;
  height: auto;
  display: block;
}
.figure-caption {
  font-size: 0.875rem;
  color: var(--text-gray);
  padding: 8px 16px;
  background: var(--light-gray);
  border-top: 1px solid var(--border);
}

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
thead th {
  background: var(--light-gray);
  color: var(--text-dark);
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
  vertical-align: top;
}
tbody tr:nth-child(even) { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

/* ---- LISTS ---- */
ul.bullet-list, ol.num-list {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
ul.bullet-list li, ol.num-list li { margin-bottom: 0.4rem; }

/* ---- CARDS ---- */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.075);
  margin-bottom: 1.5rem;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); }

/* ---- SECTION DIVIDER ---- */
.section-divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ---- HIGHLIGHT BOX ---- */
.highlight-box {
  background: #E7F1FF;
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
}

/* ---- SCROLLBAR ---- */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ---- IMAGE WRAPPER ---- */
/* Constrain images inside content area only */
.content-wrapper img,
.main-content img {
  max-width: 100% !important;
  height: auto !important;
  display: block !important;
}
/* Logo image keeps its own sizing */
.sidebar-logo img {
  width: auto !important;
  max-width: 160px !important;
  display: block !important;
}

.img-wrap {
  width: 100%;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #E7F1FF;
  box-sizing: border-box;
}

.img-wrap img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  display: block !important;
}

.fig-caption {
  font-size: 0.875rem;
  color: var(--text-gray);
  padding: 8px 16px;
  background: var(--light-gray);
  border-top: 1px solid var(--border);
  line-height: 1.5;
}

.figure-wrap {
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.figure-wrap img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  display: block !important;
}

svg { max-width: 100%; height: auto; }

.content-wrapper * { box-sizing: border-box; }

.table-wrap { overflow-x: auto; }
.table-wrap table { max-width: none; }

/* ---- RESPONSIVE BREAKPOINTS ---- */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .content-wrapper { padding: 16px 12px; }
}
