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

:root {
    /* Light theme colors */
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --bg-hover: #f3f4f6;
    --bg-active: #dbeafe;

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #6b7280;
    --text-heading: #111827;

    --border-primary: #e5e7eb;
    --border-secondary: #d1d5db;
    --border-light: #f3f4f6;

    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #dbeafe;

    --success-bg: #dcfce7;
    --success-text: #166534;
    --success-border: #bbf7d0;

    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --error-border: #fecaca;

    --code-bg: #f3f4f6;
    --code-text: #111827;
    --code-block-bg: #1f2937;
    --code-block-text: #e5e7eb;
    --code-block-border: #374151;
    --code-block-line-numbers: #9ca3af;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md:
        0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body.dark-theme {
    /* Dark theme colors */
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --bg-hover: #374151;
    --bg-active: #1e3a8a;

    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    --text-heading: #ffffff;

    --border-primary: #374151;
    --border-secondary: #4b5563;
    --border-light: #374151;

    --accent-primary: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-light: #1e3a8a;

    --success-bg: #14532d;
    --success-text: #86efac;
    --success-border: #166534;

    --error-bg: #7f1d1d;
    --error-text: #fecaca;
    --error-border: #991b1b;

    --code-bg: #374151;
    --code-text: #d1d5db;
    --code-block-bg: #1f2937;
    --code-block-text: #e5e7eb;
    --code-block-border: #4b5563;
    --code-block-line-numbers: #9ca3af;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md:
        0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
}

body {
    font-family: InterVariable, system-ui, sans-serif, ui-sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 24px;
    margin: 0;
    color: var(--text-heading);
    font-weight: 600;
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-secondary);
}

.connection-panel {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.connection-panel input {
    flex: 1;
    min-width: 300px;
    padding: 10px 14px;
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.15s;
}

.connection-panel input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

button {
    padding: 10px 20px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

button:hover {
    background: var(--accent-hover);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
}

button.secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-secondary);
}

button.secondary:hover {
    background: var(--bg-hover);
}

.status {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid transparent;
    margin-top: 12px;
    font-weight: 500;
    line-height: 1.5;
}

.status:empty {
    display: none;
}

.status.success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.status.error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
    font-weight: 600;
}

.status.error::before {
    content: "⚠️ ";
    margin-right: 4px;
}

.status.success::before {
    content: "✓ ";
    margin-right: 4px;
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.sidebar h2 {
    font-size: 16px;
    font-weight: 600;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-heading);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.repo-info {
    padding: 20px;
}

.repo-info h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-tertiary);
}

.repo-info .label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.repo-info .value {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-family: IBMPlexMono, ui-monospace, monospace;
}

.clone-url {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    margin-bottom: 12px;
}

.clone-url code {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-btn {
    padding: 4px 8px;
    font-size: 11px;
    min-width: 50px;
}

.copy-btn:hover {
    background: var(--accent-hover);
}

.branches-section {
    border-top: 1px solid var(--border-primary);
}

.branch-list {
    max-height: 300px;
    overflow-y: auto;
}

.branch-item {
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.branch-item:hover {
    background: var(--bg-hover);
}

.branch-item.active {
    background: var(--accent-light);
    color: var(--accent-primary);
    font-weight: 500;
}

.viewer {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.breadcrumb {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
    font-size: 13px;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.15s;
    cursor: pointer;
}

.breadcrumb a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.breadcrumb span {
    margin: 0 8px;
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

.file-list {
    padding: 0;
    list-style: none;
    margin: 0;
}

.file-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer !important;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background: var(--bg-hover);
}

.file-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--text-tertiary);
    cursor: pointer;
}

.file-name {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.file-size {
    color: var(--text-tertiary);
    font-size: 12px;
    cursor: pointer;
}

.file-content {
    padding: 0;
    overflow-x: auto;
    background: var(--code-block-bg);
    font-family: IBMPlexMono, Monaco, Menlo, monospace;
    font-size: 13px;
}

.file-content pre {
    margin: 0;
    white-space: pre;
    background: transparent;
    padding: 20px;
}

.file-content code {
    background: transparent;
}

.file-content code.hljs {
    padding: 0;
    background: transparent;
}

.line-numbers {
    display: flex;
    gap: 0;
    background: var(--code-block-bg);
}

.line-numbers .numbers {
    color: var(--code-block-line-numbers);
    text-align: right;
    user-select: none;
    min-width: 50px;
    padding: 20px 16px 20px 20px;
    border-right: 1px solid var(--code-block-border);
    background: var(--code-block-bg);
    line-height: 1.5;
}

.line-numbers pre:not(.numbers) {
    flex: 1;
    padding-left: 20px;
}

.loading {
    padding: 40px;
    text-align: center;
    color: var(--text-tertiary);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    padding: 60px 40px;
    text-align: center;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--text-tertiary);
    display: block;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-tertiary);
    font-size: 14px;
}

.welcome-hero {
    padding: 80px 40px;
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.welcome-hero svg {
    width: 96px;
    height: 96px;
    margin: 0 auto 32px;
    color: var(--accent-primary);
    display: block;
}

.welcome-hero h2 {
    font-size: 32px;
    color: var(--text-heading);
    margin-bottom: 16px;
    font-weight: 700;
}

.welcome-hero .subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 48px;
    line-height: 1.6;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 48px;
    text-align: left;
}

.feature-item {
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
}

.feature-item h4 {
    font-size: 16px;
    color: var(--text-heading);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-item p {
    font-size: 14px;
    color: var(--text-tertiary);
    line-height: 1.5;
    margin: 0;
}

.getting-started {
    margin-top: 48px;
    padding: 24px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    text-align: left;
}

.getting-started h3 {
    font-size: 18px;
    color: var(--text-heading);
    margin-bottom: 16px;
}

.getting-started ol {
    margin-left: 20px;
    color: var(--text-secondary);
}

.getting-started li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.error-message {
    padding: 40px;
    text-align: center;
    color: var(--error-text);
    background: var(--error-bg);
    margin: 20px;
    border-radius: 8px;
    border: 1px solid var(--error-border);
}

.file-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-header h3 {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.file-actions button {
    padding: 6px 12px;
    font-size: 12px;
}

.user-item {
    margin-bottom: 24px;
}

.user-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.repo-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.repo-item:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.repo-item strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.repo-item small {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: IBMPlexMono, monospace;
}

.markdown-content {
    padding: 20px 40px;
    background: var(--bg-secondary);
    font-family: InterVariable, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-heading);
}

.markdown-content h1 {
    font-size: 2em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border-primary);
}

.markdown-content h2 {
    font-size: 1.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border-primary);
}

.markdown-content h3 {
    font-size: 1.25em;
}

.markdown-content h4 {
    font-size: 1em;
}

.markdown-content h5 {
    font-size: 0.875em;
}

.markdown-content h6 {
    font-size: 0.85em;
    color: var(--text-tertiary);
}

.markdown-content p {
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-content ul,
.markdown-content ol {
    margin-top: 0;
    margin-bottom: 16px;
    padding-left: 2em;
}

.markdown-content li + li {
    margin-top: 0.25em;
}

.markdown-content code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background: var(--code-bg);
    border-radius: 6px;
    font-family: IBMPlexMono, Monaco, Menlo, monospace;
    color: var(--code-text);
}

.markdown-content pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background: var(--code-block-bg);
    border-radius: 6px;
    margin-bottom: 16px;
}

.markdown-content pre code {
    display: block;
    padding: 0;
    margin: 0;
    overflow: visible;
    line-height: inherit;
    word-wrap: normal;
    background: transparent;
    border: 0;
    color: var(--code-block-text);
}

.markdown-content pre code.hljs {
    background: transparent;
}

.markdown-content blockquote {
    padding: 0 1em;
    color: var(--text-tertiary);
    border-left: 0.25em solid var(--border-secondary);
    margin: 0 0 16px 0;
}

.markdown-content blockquote > :first-child {
    margin-top: 0;
}

.markdown-content blockquote > :last-child {
    margin-bottom: 0;
}

.markdown-content table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-bottom: 16px;
    width: 100%;
    overflow: auto;
}

.markdown-content table th,
.markdown-content table td {
    padding: 6px 13px;
    border: 1px solid var(--border-primary);
}

.markdown-content table th {
    font-weight: 600;
    background: var(--bg-tertiary);
}

.markdown-content table tr {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
}

.markdown-content table tr:nth-child(2n) {
    background: var(--bg-tertiary);
}

.markdown-content img {
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 6px;
}

.markdown-content a {
    color: var(--accent-primary);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: var(--border-primary);
    border: 0;
}

footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-primary);
    margin-top: 40px;
}

footer p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .connection-panel {
        flex-direction: column;
    }

    .connection-panel input {
        min-width: 100%;
    }

    .markdown-content {
        padding: 20px;
    }

    .welcome-hero {
        padding: 40px 20px;
    }
}
