/* ============================================================
   Solution Mall - User & Role Permission Model Design Guide
   Main Stylesheet
   ============================================================ */

/* 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: #fff;
}

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

.sidebar-logo {
  padding: 12px 16px;
  background: #F8F9FA;
  border-bottom: 1px solid #DEE2E6;
  flex-shrink: 0;
}

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

.sidebar-logo a {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: #0D6EFD;
  text-decoration: none;
}

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

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

.nav-item {
  display: flex;
  align-items: center;
  height: 80px; /* 5rem */
  padding: 12px 16px;
  text-decoration: none;
  color: #212529;
  font-size: 1rem;
  border-left: 4px solid transparent;
  transition: background 0.15s;
  gap: 16px;
  position: relative;
}

.nav-item:hover {
  background: #F8F9FA;
  cursor: pointer;
}

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

.nav-item svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: #0D6EFD;
}

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

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
  margin-left: 280px;
  min-height: 100vh;
  background: #fff;
}

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

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

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

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

.hero p {
  font-size: 1rem;
  line-height: 1.6;
  opacity: 0.9;
  margin-bottom: 32px;
  max-width: 700px;
}

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

.btn-primary {
  background: #fff;
  color: #0D6EFD;
  font-weight: 600;
  font-size: 1rem;
  padding: 10px 28px;
  border-radius: 6px;
  border: none;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
}

.btn-primary:hover { background: #e8f0fe; transform: translateY(-1px); }

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

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

/* ============================================================
   SECTION HEADINGS
   ============================================================ */
h1.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #0D6EFD;
  margin-bottom: 8px;
}

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

.section-divider {
  border: none;
  border-top: 1px solid #DEE2E6;
  margin: 24px 0 32px;
}

h2.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: #0D6EFD;
  margin: 40px 0 16px;
}

h3.subsection-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #0D6EFD;
  margin: 32px 0 12px;
}

h4.sub-subtitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0D6EFD;
  margin: 24px 0 10px;
}

p { margin-bottom: 1.5rem; color: #212529; }

/* ============================================================
   CHAPTER NAVIGATION CARDS (Homepage)
   ============================================================ */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 32px 0;
  background: #F4F7F6;
  padding: 24px;
  border-radius: 12px;
}

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

.chapter-card:hover {
  box-shadow: 0 4px 16px rgba(13,110,253,0.15);
  transform: translateY(-2px);
}

.chapter-card-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: #0D6EFD;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chapter-card-icon svg { width: 40px; height: 40px; }

.chapter-card-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: #333;
  line-height: 1.3;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

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

/* ============================================================
   IMAGES & FIGURES
   ============================================================ */
.figure-block {
  margin: 32px 0;
}

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

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

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: 8px;
  border: 1px solid #DEE2E6;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.9rem;
}

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

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #DEE2E6;
  color: #212529;
  vertical-align: top;
}

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

/* ============================================================
   INFO BOXES & CALLOUTS
   ============================================================ */
.info-box {
  background: #E7F1FF;
  border-left: 4px solid #0D6EFD;
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 24px 0;
}

.warning-box {
  background: #FFF3CD;
  border-left: 4px solid #FFC107;
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 24px 0;
}

.success-box {
  background: #D1E7DD;
  border-left: 4px solid #198754;
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 24px 0;
}

/* ============================================================
   LISTS
   ============================================================ */
ul.bullet-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

ul.bullet-list li {
  padding: 6px 0 6px 20px;
  position: relative;
  line-height: 1.6;
  color: #212529;
}

ul.bullet-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #0D6EFD;
  font-weight: 700;
}

ol.numbered-list {
  padding-left: 20px;
  margin: 0 0 1.5rem;
}

ol.numbered-list li {
  padding: 4px 0;
  line-height: 1.6;
  color: #212529;
}

/* ============================================================
   METRIC CARDS (for KPIs)
   ============================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.metric-card {
  background: #F8F9FA;
  border: 1px solid #DEE2E6;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0D6EFD;
  display: block;
}

.metric-label {
  font-size: 0.8rem;
  color: #6C757D;
  margin-top: 4px;
}

/* ============================================================
   SCENARIO CARDS (Chapter 3)
   ============================================================ */
.scenario-card {
  background: #fff;
  border: 1px solid #DEE2E6;
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.scenario-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.scenario-badge {
  background: #0D6EFD;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.scenario-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #212529;
}

/* ============================================================
   CALCULATOR STYLES (Chapter 9)
   ============================================================ */
.calculator-container {
  background: #F8F9FA;
  border: 1px solid #DEE2E6;
  border-radius: 12px;
  padding: 32px;
  margin: 24px 0;
}

.calc-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.calc-tab {
  padding: 8px 20px;
  border-radius: 6px;
  border: 1px solid #DEE2E6;
  background: #fff;
  color: #6C757D;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.calc-tab.active {
  background: #0D6EFD;
  color: #fff;
  border-color: #0D6EFD;
}

.calc-panel { display: none; }
.calc-panel.active { display: block; }

.calc-input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.calc-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 6px;
}

.calc-field input, .calc-field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #DEE2E6;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #212529;
  background: #fff;
  transition: border-color 0.2s;
}

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

.calc-result {
  background: #fff;
  border: 1px solid #DEE2E6;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.calc-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.result-item {
  text-align: center;
  padding: 16px;
  background: #E7F1FF;
  border-radius: 8px;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0D6EFD;
  display: block;
}

.result-label {
  font-size: 0.8rem;
  color: #6C757D;
  margin-top: 4px;
}

.btn-calc {
  background: #0D6EFD;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 32px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.btn-calc:hover { background: #0b5ed7; transform: translateY(-1px); }

/* ============================================================
   FOOTER
   ============================================================ */
.page-footer {
  margin-top: 64px;
  padding: 32px 0;
  border-top: 1px solid #DEE2E6;
  text-align: center;
  color: #6C757D;
  font-size: 0.875rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-280px); }
  .main-content { margin-left: 0; }
  .chapter-grid { grid-template-columns: repeat(2, 1fr); }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .calc-input-group { grid-template-columns: 1fr; }
  .calc-result-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .chapter-grid { grid-template-columns: 1fr; }
  .content-wrapper { padding: 24px 20px; }
  .hero { padding: 40px 24px; }
  .hero h1 { font-size: 1.75rem; }
}
