/* ============================================================
   Lightning Protection and Grounding Design Guide
   Shared Stylesheet - Solution Mall Knowledge Center
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: #212529;
  background: #FFFFFF;
  overflow-x: hidden;
}

/* ---- Left Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 280px;
  height: 100vh;
  background: #FFFFFF;
  border-right: 1px solid #DEE2E6;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.sidebar-logo {
  padding: 0.75rem 1rem;
  background: #F8F9FA;
  border-bottom: 1px solid #DEE2E6;
  flex-shrink: 0;
  text-align: center;
}

.sidebar-logo img {
  max-width: 180px;
  height: auto;
  display: block;
  margin: 0 auto 0.4rem;
}

.sidebar-logo a {
  color: #0D6EFD;
  text-decoration: none;
  font-size: 0.8rem;
}

.sidebar-logo a:hover { text-decoration: underline; }

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  height: 80px;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: #212529;
  font-size: 1rem;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 4px solid transparent;
}

.sidebar-nav a:hover {
  background: #F8F9FA;
}

.sidebar-nav a.active {
  background: #F8F9FA;
  border-left-color: #0D6EFD;
  color: #0D6EFD;
  font-weight: 600;
}

.sidebar-nav a svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-right: 16px;
  color: #0D6EFD;
  stroke: #0D6EFD;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-text {
  flex: 1;
  line-height: 1.3;
  font-size: 0.9rem;
}

/* ---- Main Content Area ---- */
.main-content {
  margin-left: 280px;
  min-height: 100vh;
  background: #FFFFFF;
  padding: 40px 50px;
}

.content-wrapper {
  max-width: 1000px;
  margin: 0 auto;
}

/* ---- Hero Section ---- */
.hero {
  background: linear-gradient(135deg, #0D6EFD 0%, #5DADE2 100%);
  border-radius: 1rem;
  padding: 60px 50px;
  margin-bottom: 2.5rem;
  max-width: 1000px;
}

.hero-tag {
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: inline-block;
  background: rgba(255,255,255,0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

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

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

.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn-primary {
  background: #FFFFFF;
  color: #0D6EFD;
  border: none;
  padding: 0.6rem 1.8rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #f0f0f0;
  transform: scale(1.02);
}

.btn-secondary {
  background: transparent;
  color: #FFFFFF;
  border: 1px solid rgba(255,255,255,0.8);
  padding: 0.6rem 1.8rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.15);
}

/* ---- Section Titles ---- */
h1.page-title {
  color: #0D6EFD;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

h2.section-title {
  color: #0D6EFD;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  margin-top: 2rem;
}

h3.subsection-title {
  color: #0D6EFD;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

h4.sub-subsection {
  color: #0D6EFD;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

.page-subtitle {
  color: #6C757D;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.divider {
  border: none;
  border-top: 1px solid #DEE2E6;
  margin: 1.5rem 0 2rem;
}

/* ---- Paragraphs ---- */
p {
  color: #212529;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* ---- Images ---- */
.figure-block {
  margin: 1.5rem 0 2rem;
}

.figure-block img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 1px solid #DEE2E6;
  display: block;
}

.figure-caption {
  color: #6C757D;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  text-align: center;
}

/* ---- Cards ---- */
.card {
  background: #FFFFFF;
  border-radius: 0.5rem;
  border: 1px solid #DEE2E6;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  padding: 1.5rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

/* ---- Chapter Navigation Cards ---- */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  background: #F4F7F6;
  padding: 20px;
  border-radius: 0.5rem;
  margin: 2rem 0;
}

.chapter-card {
  background: #0D6EFD;
  border-radius: 8px;
  padding: 15px;
  height: 130px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  text-decoration: none;
  color: #FFFFFF;
  position: relative;
  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);
}

.chapter-card svg {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: #FFFFFF;
  stroke: #FFFFFF;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chapter-card-text {
  font-size: 16px;
  color: #FFFFFF;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

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

/* ---- Tables ---- */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #FFFFFF;
  border: 1px solid #DEE2E6;
  font-size: 0.9rem;
}

thead th {
  background: #F8F9FA;
  color: #212529;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #DEE2E6;
  text-align: left;
}

tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #DEE2E6;
  color: #212529;
  min-height: 40px;
}

tbody tr:nth-child(even) { background: #F8F9FA; }
tbody tr:last-child td { border-bottom: none; }

/* ---- Lists ---- */
ul.bullet-list, ol.numbered-list {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

ul.bullet-list li, ol.numbered-list li {
  line-height: 1.6;
  margin-bottom: 0.5rem;
  color: #212529;
}

/* ---- Info Boxes ---- */
.info-box {
  background: #E7F1FF;
  border-left: 4px solid #0D6EFD;
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.warning-box {
  background: #FFF3CD;
  border-left: 4px solid #FFC107;
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

/* ---- Scenario Cards (Chapter 3) ---- */
.scenario-card {
  background: #FFFFFF;
  border: 1px solid #DEE2E6;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 2.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

.scenario-card img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  display: block;
}

.scenario-card-body {
  padding: 1.5rem;
}

.scenario-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 1rem;
}

.metric-item {
  background: #F8F9FA;
  border: 1px solid #DEE2E6;
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.875rem;
}

.metric-label {
  color: #6C757D;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.metric-value {
  color: #0D6EFD;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---- Calculator Styles (Chapter 9) ---- */
.calculator-card {
  background: #FFFFFF;
  border: 1px solid #DEE2E6;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

.calc-title {
  color: #0D6EFD;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #0D6EFD;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.calc-field label {
  font-size: 0.875rem;
  color: #6C757D;
  font-weight: 500;
}

.calc-field input, .calc-field select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #DEE2E6;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  color: #212529;
  background: #FFFFFF;
  transition: border-color 0.15s;
}

.calc-field input:focus, .calc-field select:focus {
  outline: none;
  border-color: #0D6EFD;
  box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}

.calc-result {
  background: linear-gradient(135deg, #0D6EFD 0%, #5DADE2 100%);
  border-radius: 0.5rem;
  padding: 1.25rem;
  color: #FFFFFF;
  margin-top: 1rem;
}

.calc-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.calc-result-item {
  text-align: center;
}

.calc-result-label {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}

.calc-result-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.calc-result-unit {
  font-size: 0.8rem;
  opacity: 0.85;
}

.calc-btn {
  background: #0D6EFD;
  color: #FFFFFF;
  border: none;
  padding: 0.6rem 2rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.75rem;
}

.calc-btn:hover {
  background: #0b5ed7;
  transform: scale(1.02);
}

/* ---- Status Badge ---- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pass { background: #D1E7DD; color: #0F5132; }
.badge-fail { background: #F8D7DA; color: #842029; }
.badge-warn { background: #FFF3CD; color: #664D03; }
.badge-high { background: #F8D7DA; color: #842029; }
.badge-med  { background: #FFF3CD; color: #664D03; }
.badge-low  { background: #D1E7DD; color: #0F5132; }

/* ---- Scrollbar ---- */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #DEE2E6; border-radius: 2px; }

/* ---- Links ---- */
a { color: #0D6EFD; text-decoration: none; }
a:hover { text-decoration: underline; color: #0b5ed7; }
