/* ===== OT-IT Network Segmentation Design Guide - Main Stylesheet ===== */

/* Reset & Base */
*, *::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;
  --bg-light: #F8F9FA;
  --border: #DEE2E6;
  --sidebar-width: 280px;
}

html { scroll-behavior: smooth; }

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

/* ===== 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: 1000;
  overflow: hidden;
}

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

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

.sidebar-logo a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
  display: block;
}

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

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

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

.nav-item {
  display: flex;
  align-items: center;
  height: 5rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-dark);
  border-left: 4px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  gap: 1rem;
  position: relative;
}

.nav-item:hover { background: var(--bg-light); cursor: pointer; }

.nav-item.active {
  border-left-color: var(--primary);
  background: var(--bg-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-item svg {
  width: 24px; height: 24px;
  flex-shrink: 0;
  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);
}

.content-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

/* ===== HERO SECTION ===== */
.hero {
  background: linear-gradient(135deg, #0D6EFD 0%, #0a58ca 60%, #5DADE2 100%);
  border-radius: 1rem;
  padding: 3.75rem 3.125rem;
  color: white;
  margin-bottom: 2.5rem;
}

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

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #FFFFFF;
  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: 1rem; flex-wrap: wrap; }

.btn-primary-hero {
  background: white;
  color: var(--primary);
  border: none;
  padding: 0.625rem 1.75rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary-hero:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

.btn-secondary-hero {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.7);
  padding: 0.625rem 1.75rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, border-color 0.15s;
}

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

/* ===== CHAPTER NAVIGATION CARDS ===== */
.chapter-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 2rem 0;
}

.chapter-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px;
  height: 130px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: var(--text-dark);
  position: relative;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  transition: box-shadow 0.15s, transform 0.15s;
  overflow: hidden;
}

.chapter-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); transform: translateY(-2px); }

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

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

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

/* ===== SECTION HEADINGS ===== */
.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

.subsection-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
  margin: 2rem 0 1rem;
}

.sub-subsection-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin: 1.5rem 0 0.75rem;
}

/* ===== CONTENT ELEMENTS ===== */
p {
  margin-bottom: 1.5rem;
  line-height: 1.6;
  color: var(--text-dark);
}

ul, ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  line-height: 1.6;
}

li { margin-bottom: 0.4rem; }

/* ===== IMAGES ===== */
.figure-container {
  margin: 2rem 0;
  background: #E7F1FF;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
}

.figure-container img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  display: block;
  margin: 0 auto;
  aspect-ratio: 3/2;
  object-fit: cover;
}

.figure-caption {
  font-size: 0.875rem;
  color: var(--text-gray);
  margin-top: 0.75rem;
  font-style: italic;
}

/* ===== TABLES ===== */
.table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

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

thead th {
  background: var(--bg-light);
  color: var(--text-dark);
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: var(--bg-light); }

/* ===== INFO BOXES ===== */
.info-box {
  background: #E7F1FF;
  border-left: 4px solid var(--primary);
  border-radius: 0.375rem;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

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

.success-box {
  background: #D1E7DD;
  border-left: 4px solid var(--secondary);
  border-radius: 0.375rem;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

/* ===== SCENARIO CARDS (Ch3) ===== */
.scenario-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

.scenario-card h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

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

.metric-badge {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  text-align: center;
}

.metric-badge strong { color: var(--primary); display: block; font-size: 1rem; }

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.page-header .subtitle {
  font-size: 0.875rem;
  color: var(--text-gray);
}

/* ===== CALCULATOR STYLES ===== */
.calc-container {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

.calc-container h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

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

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

.calc-input-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dark);
}

.calc-input-group input[type="number"],
.calc-input-group input[type="range"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.calc-input-group input[type="range"] {
  padding: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

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

.calc-result h4 { font-size: 1rem; margin-bottom: 0.75rem; opacity: 0.9; }

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

.result-item {
  background: rgba(255,255,255,0.15);
  border-radius: 0.375rem;
  padding: 0.75rem;
  text-align: center;
}

.result-item .result-label { font-size: 0.75rem; opacity: 0.85; margin-bottom: 0.25rem; }
.result-item .result-value { font-size: 1.25rem; font-weight: 700; }

.calc-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.625rem 1.5rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  transition: background 0.15s;
}

.calc-btn:hover { background: var(--primary-dark); }

/* ===== FOOTER ===== */
.page-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-gray);
  font-size: 0.875rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .chapter-cards-grid { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.75rem; }
}
