@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

:root {
  --primary: #5044A4;
  --primary-light: #9e92ee;
  --primary-dark: #2b2266;
  --bg-main: #f8fafc;
  --bg-sidebar: rgba(255, 255, 255, 0.8);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --font: 'Poppins', sans-serif;
}

* {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 300px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  padding: 24px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}

.logo-sec {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.logo-size {
  width: 48px;
  height: auto;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.sidebar h1 {
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

/* --- SEARCH --- */
.search-container {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#docSearch {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

#docSearch:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.search-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.search-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* --- DROPDOWNS --- */
.dropdown {
  margin-bottom: 8px;
}

.dropdown-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-btn:hover {
  background: rgba(79, 70, 229, 0.05);
  color: var(--primary);
}

.open .dropdown-btn {
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary);
}

.arrow {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
  opacity: 0.5;
}

.open .arrow {
  transform: rotate(90deg);
  opacity: 1;
}

.dropdown-content {
  display: none;
  padding-left: 12px;
  margin-top: 4px;
}

.open .dropdown-content {
  display: block;
}

.dropdown-content a {
  display: block;
  padding: 8px 14px;
  margin: 2px 0;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}

.dropdown-content a:hover {
  background: rgba(79, 70, 229, 0.04);
  color: var(--primary);
  padding-left: 18px;
}

.dropdown-content a.active {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
  font-weight: 600;
  border-left-color: var(--primary);
}

/* --- CONTENT --- */
.content {
  margin-left: 300px;
  padding: 60px 80px;
  flex: 1;
  max-width: 1200px;
}

h1 {
  font-family: var(--font);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary-dark);
  margin-top: 0;
  margin-bottom: 8px;
  text-align: left;
}

.version {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 48px;
  text-align: left;
}

section {
  background: white;
  padding: 40px;
  border-radius: 20px;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.3s ease;
}

section:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

h2 {
  font-family: var(--font);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 0;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

h2::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 2px;
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #334155;
  margin-top: 0;
}

p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* --- TABLES --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background: transparent;
}

td {
  padding: 32px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

/* Ensure consistent column split */
tr td:first-child {
  width: 50%;
  border-right: 1px solid var(--border);
  text-align: center;
  background-color: #fcfcfd;
}

tr td:last-child {
  width: 50%;
}

tr:last-child td {
  border-bottom: none;
}

/* Figure styling */
.fig-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.img-size {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  margin-bottom: 24px;
}

.img-size:last-child {
  margin-bottom: 0;
}

.img-size:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-lg);
}

/* --- UTILS --- */
.search-highlight {
  background-color: #fef08a;
  color: #854d0e;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: bold;
}

#scrollToTop {
  display: none;
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

#scrollToTop:hover {
  background: var(--primary-dark);
  transform: translateY(-5px);
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
  .sidebar {
    width: 260px;
    padding: 16px;
  }

  .content {
    margin-left: 260px;
    padding: 40px;
  }
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .content {
    margin-left: 0;
    padding: 24px;
  }

  section {
    padding: 24px;
  }

  td {
    display: block;
    width: 100%;
  }
}

/* --- SEARCH RESULTS OVERLAY --- */
.search-results-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  z-index: 1000;
  padding: 80px 20px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results-header {
  max-width: 800px;
  margin: 0 auto 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--border);
  padding-bottom: 20px;
}

.close-results {
  background: none;
  border: none;
  font-size: 2.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-results:hover {
  color: var(--primary);
}

.results-list {
  max-width: 800px;
  margin: 0 auto;
}

.result-item {
  margin-bottom: 32px;
  padding: 16px;
  border-radius: 12px;
  transition: background 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.result-item:hover {
  background: rgba(79, 70, 229, 0.03);
}

.result-item h3 {
  margin: 0 0 8px 0;
}

.result-item h3 a {
  color: var(--primary);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 600;
}

.result-item h3 a:hover {
  text-decoration: underline;
}

.result-snippet {
  color: var(--text-muted);
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-path {
  font-size: 0.8rem;
  color: #16a34a;
  margin-bottom: 4px;
}

.no-results-msg {
  text-align: center;
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-top: 100px;
}