/* Reset and base styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.6; color: #333; background: #f5f7fa; }

/* Top Navigation Bar */
.top-nav { position: fixed; top: 0; left: 0; right: 0; height: 80px; background: white; border-bottom: 1px solid #000; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; z-index: 1000; }
.logo-container { height: 60px; display: flex; align-items: center; }
.logo { height: 100%; width: auto; object-fit: contain; }
.nav-title { color: #1a1a1a; font-size: 24px; font-weight: 600; flex-grow: 1; text-align: center; }
.nav-actions { display: flex; gap: 15px; }
.pdf-btn { background: #1e3a8a; color: white; border: none; padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.pdf-btn:hover { background: #1e40af; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(30,58,138,0.3); }

/* Sidebar Navigation */
.sidebar { position: fixed; top: 80px; left: 0; width: 340px; height: calc(100vh - 110px); background: white; border-right: 1px solid #000; overflow-y: auto; overflow-x: hidden; padding: 15px 10px 15px 10px; z-index: 999; scroll-behavior: auto; }
.page-nav { margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #ddd; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.page-nav-link { color: #1e3a8a; text-decoration: none; font-size: 13px; font-weight: 500; transition: all 0.2s ease; }
.page-nav-link:hover { color: #1e40af; text-decoration: underline; }
.page-nav-link.disabled { color: #999; cursor: not-allowed; }
.page-nav-separator { color: #999; font-size: 12px; }
.nav-controls { display: flex; gap: 6px; margin-bottom: 12px; margin-left: 0; }
.nav-btn { flex: 1; background: #1e3a8a; color: white; border: none; padding: 6px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.nav-btn:hover { background: #1e40af; }
.nav-tree { list-style: none; margin-left: 0; padding-left: 0; }
.nav-subtree { list-style: none; padding-left: 15px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease; margin: 0; }
.nav-subtree.expanded { max-height: 2000px; }
.nav-item { margin: 0; display: grid; grid-template-columns: 22px 1fr; align-items: start; gap: 0; line-height: 1.2; }
.nav-item > .nav-subtree { grid-column: 1 / -1; margin-top: 0; }
.nav-item.active > .nav-link { background: #dbeafe; color: #1e3a8a; font-weight: 600; border-left: 3px solid #1e3a8a; }
.nav-item.active-section > .nav-link { background: #e0f2fe; color: #0369a1; font-weight: 500; border-left: 2px solid #7dd3fc; }
.nav-toggle { display: inline-block; width: 16px; height: 16px; line-height: 11px; text-align: center; cursor: pointer; user-select: none; transition: transform 0.2s ease; color: #666; font-size: 14px; border: 1px solid #999; border-radius: 2px; margin-top: 2px; flex-shrink: 0; }
.nav-toggle.expanded { transform: rotate(90deg); }
.nav-toggle-placeholder { display: inline-block; width: 16px; height: 16px; line-height: 11px; text-align: center; color: #ccc; font-size: 14px; border: 1px solid #ddd; border-radius: 2px; margin-top: 2px; flex-shrink: 0; cursor: default; }
.nav-link { padding: 2px 10px 2px 10px; color: #555; text-decoration: none; border-radius: 4px; transition: all 0.2s ease; display: block; line-height: 1.4; margin-bottom: 5px; }
.nav-link:hover { background: #f3f4f6; color: #1e3a8a; }
.h1-link { font-weight: 600; font-size: 14px; }
.h2-link { font-size: 13px; padding-left: 8px; }
.h3-link { font-size: 12px; color: #777; padding-left: 12px; }

/* Main Content Area */
.main-content { margin-left: 340px; margin-top: 80px; margin-bottom: 30px; padding: 40px; max-width: 1200px; background: white; min-height: calc(100vh - 110px); border-left: 1px solid #000; }
h1 { font-size: 2.5em; color: #1a1a1a; margin-bottom: 30px; padding-bottom: 15px; border-bottom: 3px solid #1e3a8a; scroll-margin-top: 100px; }
h2 { font-size: 1.8em; color: #2c3e50; margin-top: 40px; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid #e0e0e0; scroll-margin-top: 100px; }
h3 { font-size: 1.4em; color: #374151; margin-top: 30px; margin-bottom: 15px; scroll-margin-top: 100px; }
h4, h5, h6 { color: #4b5563; margin-top: 25px; margin-bottom: 12px; scroll-margin-top: 100px; }
p { margin-bottom: 15px; line-height: 1.8; color: #444; }
ul, ol { margin: 15px 0; padding-left: 40px; line-height: 1.8; color: #444; }
ul li, ol li { margin-bottom: 8px; }
ul { list-style-type: disc; }
ol { list-style-type: decimal; }
ul ul { list-style-type: circle; margin-top: 8px; }
ul ul ul { list-style-type: square; }
table { margin: 25px 0; border-collapse: collapse; width: 100%; box-shadow: 0 2px 8px rgba(0,0,0,0.1); border-radius: 8px; overflow: hidden; }
td, th { padding: 12px 15px; border: 1px solid #e0e0e0; }
th { background: #1e3a8a; color: white; font-weight: 600; text-align: left; }
tr:nth-child(even) { background: #f8f9fa; }
tr:hover { background: #f0f2f5; }
img { max-width: 100%; height: auto; margin: 20px 0; display: block; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
code { font-family: "Courier New", Consolas, monospace; background: #f4f4f4; padding: 3px 6px; border-radius: 4px; color: #e83e8c; font-size: 0.9em; }
strong { font-weight: 600; color: #1a1a1a; }
em { font-style: italic; color: #546e7a; }
br { line-height: 1.8; }
a { color: #1e3a8a; text-decoration: none; border-bottom: 1px solid transparent; transition: all 0.2s ease; }
a:hover { border-bottom-color: #1e3a8a; }

/* Index Page Styles */
.index-container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; }
.index-logo { max-width: 400px; height: auto; margin-bottom: 40px; }
.index-title { font-size: 3em; font-weight: 700; color: #1e3a8a; margin-bottom: 20px; }
.index-subtitle { font-size: 1.2em; color: #666; margin-bottom: 40px; }
.index-nav { display: flex; flex-direction: column; gap: 15px; max-width: 400px; width: 100%; }
.index-link { display: block; padding: 15px 30px; background: #1e3a8a; color: white; text-decoration: none; border-radius: 6px; font-size: 16px; font-weight: 600; transition: all 0.3s ease; }
.index-link:hover { background: #1e40af; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(30,58,138,0.3); }

/* Search Box */
.search-container { position: relative; display: flex; align-items: center; gap: 8px; }
.search-input-wrapper { position: relative; display: flex; align-items: center; }
.search-box { width: 250px; padding: 8px 35px 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: all 0.3s ease; }
.search-box:focus { outline: none; border-color: #1e3a8a; box-shadow: 0 0 0 3px rgba(30,58,138,0.1); }
.search-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; cursor: pointer; color: #666; transition: color 0.2s ease; }
.search-icon:hover { color: #1e3a8a; }
.search-icon svg { width: 100%; height: 100%; }
.search-dropdown { position: absolute; top: calc(100% + 5px); left: 0; width: 100%; background: white; border: 1px solid #ddd; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); max-height: 500px; overflow-y: auto; z-index: 1001; display: none; }
.search-input-wrapper { position: relative; }
.search-dropdown.show { display: block; }
.search-result { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.2s ease; }
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: #f3f4f6; }
.search-result-title { font-weight: 600; font-size: 13px; color: #1e3a8a; margin-bottom: 4px; }
.search-result-context { font-size: 12px; color: #666; line-height: 1.4; }
.search-result-match { background: #fef3c7; padding: 1px 3px; border-radius: 2px; font-weight: 500; }
.search-no-results { padding: 15px 12px; text-align: center; color: #999; font-size: 13px; }

/* Search Navigation Controls */
.search-nav-controls { display: none; align-items: center; gap: 6px; }
.search-nav-controls.show { display: flex; }
.search-nav-btn { width: 28px; height: 28px; border: 1px solid #ddd; background: white; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; color: #666; font-size: 14px; font-weight: bold; }
.search-nav-btn:hover:not(:disabled) { background: #f3f4f6; border-color: #1e3a8a; color: #1e3a8a; }
.search-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.search-counter { font-size: 12px; color: #666; white-space: nowrap; min-width: 70px; text-align: center; }

/* Highlight styles for found text */
.highlight-word { background-color: #fef3c7; padding: 2px 4px; border-radius: 3px; animation: highlight-pulse 1.5s ease-in-out 2; }
@keyframes highlight-pulse {
    0%, 100% { background-color: #fef3c7; }
    50% { background-color: #fde68a; box-shadow: 0 0 10px rgba(253, 230, 138, 0.6); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar { width: 320px; }
    .main-content { margin-left: 320px; padding: 20px; }
    .nav-title { font-size: 18px; }
    .search-box { width: 180px; }
}

/* Footer Bar */
.footer-bar { position: fixed; bottom: 0; left: 0; right: 0; height: 30px; background: white; border-top: 1px solid #000; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; z-index: 1000; font-size: 11px; color: #666; }
.footer-copyright { font-weight: 500; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: #1e3a8a; text-decoration: none; transition: color 0.2s ease; }
.footer-links a:hover { color: #1e40af; text-decoration: underline; }

/* Print Styles */
@media print {
    .top-nav, .sidebar, .footer-bar { display: none; }
    .main-content { margin: 0; padding: 20px; box-shadow: none; border: none; }
    body { background: white; }
}

