:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #ecf0f1;
    --text-color: #2c3e50;
    --border-color: #bdc3c7;
    --success-color: #27ae60;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.navbar-logo:hover {
    color: var(--secondary-color);
}

.navbar-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--secondary-color);
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Search Section */
.search-section {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.search-section h1 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.search-button {
    padding: 0.75rem 1.5rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

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

/* Search Results */
.search-results {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.search-results h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

#resultsList {
    display: grid;
    gap: 1rem;
}

.result-item {
    padding: 1rem;
    background-color: #f8f9fa;
    border-left: 4px solid var(--secondary-color);
    border-radius: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.result-item a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.result-item a:hover {
    text-decoration: underline;
}

.result-path {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
}

/* Repositories Section */
.repositories-section {
    margin-top: 2rem;
}

.repositories-section h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.repo-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.repo-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.file-list ul {
    list-style: none;
}

.file-list li {
    padding: 0.5rem 0;
}

.file-link {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.file-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.no-files {
    color: #7f8c8d;
    font-style: italic;
}

/* Tree View Styles */
.file-tree {
    margin-top: 1rem;
}

.tree-list {
    list-style: none;
    padding-left: 0;
}

.tree-list .tree-list {
    padding-left: 1.5rem;
    margin-top: 0.25rem;
}

.tree-folder,
.tree-file {
    padding: 0.25rem 0;
    margin: 0.25rem 0;
}

.folder-toggle {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    font-weight: 500;
    color: var(--primary-color);
    transition: color 0.2s ease;
}

.folder-toggle:hover {
    color: var(--secondary-color);
}

details > summary::-webkit-details-marker {
    display: none;
}

details > summary::before {
    content: "▶ ";
    display: inline-block;
    margin-right: 0.25rem;
    transition: transform 0.2s ease;
}

details[open] > summary::before {
    transform: rotate(90deg);
}

.tree-children {
    margin-top: 0.25rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--border-color);
    margin-left: 0.25rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background-color: white;
    border-radius: 8px;
    color: #7f8c8d;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.95rem;
}

.breadcrumb a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.breadcrumb-repo,
.breadcrumb-file {
    color: var(--text-color);
}

/* Markdown Content */
.markdown-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    line-height: 1.8;
}

.markdown-content h1 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.markdown-content h2 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    color: var(--primary-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
}

.markdown-content a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.markdown-content a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.markdown-content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #c7254e;
}

.markdown-content pre {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-content pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid var(--secondary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: #7f8c8d;
    font-style: italic;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.markdown-content th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar-menu {
        gap: 1rem;
    }

    .search-box {
        flex-direction: column;
    }

    .repo-grid {
        grid-template-columns: 1fr;
    }

    .search-section,
    .markdown-content {
        padding: 1rem;
    }

    .markdown-content {
        padding: 1rem;
    }
}
