/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header styles */
header {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.version {
    font-size: 0.8rem;
    opacity: 0.8;
}

.search-container {
    margin-top: 1rem;
    position: relative;
    display: flex;
    gap: 0.5rem;
}

#searchInput {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    max-width: 600px;
}

.search-container button {
    padding: 0.5rem 1.5rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.search-container button:hover {
    background: #2980b9;
}

#searchResults {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 100;
    max-height: 60vh;
    overflow-y: auto;
}

/* Main layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Navigation panel */
.navigation-panel {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #e1e4e8;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.navigation-panel h2 {
    padding: 1rem;
    margin: 0;
    font-size: 1.2rem;
    border-bottom: 1px solid #e1e4e8;
    background: #f6f8fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.navigation-list {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem;
}

.nav-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #24292e;
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover {
    background: #f6f8fa;
    color: #0366d6;
}

.nav-link.active {
    background: #e1f0ff;
    color: #0366d6;
    font-weight: 500;
}

/* Content panel */
.content-panel {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;
    padding: 1rem;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

.welcome-message {
    color: #586069;
    text-align: center;
    margin-top: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.welcome-message h3 {
    color: #24292e;
    margin-bottom: 1rem;
}

.features {
    text-align: left;
    margin-top: 2rem;
    background: #f6f8fa;
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
}

.features h4 {
    margin-top: 0;
    color: #24292e;
}

.features ul {
    padding-left: 1.5rem;
}

/* Content styles */
pre {
    background: #f6f8fa;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    position: relative;
    border: 1px solid #e1e4e8;
}

code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #e1e4e8;
    color: #24292e;
    border: none;
    border-radius: 3px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-button:hover {
    background: #d1d5da;
}

.highlight {
    background-color: rgba(255, 235, 59, 0.3);
    padding: 0 2px;
    border-radius: 2px;
}

/* Search results styles */
.results-header {
    padding: 0.75rem 1rem;
    background: #f6f8fa;
    font-weight: 500;
    border-bottom: 1px solid #e1e4e8;
    position: sticky;
    top: 0;
}

.result-item {
    padding: 1rem;
    border-bottom: 1px solid #e1e4e8;
    cursor: pointer;
    transition: background 0.1s;
}

.result-item:hover {
    background: #f6f8fa;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #0366d6;
}

.file-meta {
    font-size: 0.8rem;
    color: #586069;
    background: #e1e4e8;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.file-components {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.file-lang, .file-topic {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.file-lang {
    background: #e1f0ff;
    color: #0366d6;
}

.file-topic {
    background: #f0f4ff;
    color: #4a69bd;
}

.file-name {
    font-size: 0.8rem;
    color: #586069;
    font-family: monospace;
}

/* Loading and error states */
.loading {
    padding: 2rem;
    text-align: center;
    color: #586069;
}

.error {
    color: #cb2431;
    background: #ffebee;
    padding: 1rem;
    border-radius: 4px;
    border-left: 3px solid #cb2431;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    
    .navigation-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e1e4e8;
    }
    
    .navigation-list {
        max-height: 200px;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    #searchInput {
        max-width: 100%;
    }
    
    .search-container button {
        width: 100%;
    }
}