/* GitHub Code Viewer - Main Styles */

.maple-code-blocks {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Dark Theme (Default) */
.maple-code-blocks[data-theme="dark"],
.maple-code-blocks.mcb-theme-dark {
    background: #1e1e1e;
    color: #d4d4d4;
}

.maple-code-blocks[data-theme="dark"] .mcb-header,
.maple-code-blocks.mcb-theme-dark .mcb-header {
    background: linear-gradient(180deg, #2d2d30 0%, #252526 100%);
    border-bottom: 1px solid #3e3e42;
}

.maple-code-blocks[data-theme="dark"] .mcb-sidebar,
.maple-code-blocks.mcb-theme-dark .mcb-sidebar {
    background: #252526;
    border-right: 1px solid #3e3e42;
}

.maple-code-blocks[data-theme="dark"] .mcb-editor,
.maple-code-blocks.mcb-theme-dark .mcb-editor {
    background: #1e1e1e;
}

/* Light Theme */
.maple-code-blocks[data-theme="light"],
.maple-code-blocks.mcb-theme-light {
    background: #ffffff;
    color: #333333;
}

.maple-code-blocks[data-theme="light"] .mcb-header,
.maple-code-blocks.mcb-theme-light .mcb-header {
    background: linear-gradient(180deg, #f3f3f3 0%, #e8e8e8 100%);
    border-bottom: 1px solid #d4d4d4;
}

.maple-code-blocks[data-theme="light"] .mcb-sidebar,
.maple-code-blocks.mcb-theme-light .mcb-sidebar {
    background: #f3f3f3;
    border-right: 1px solid #e8e8e8;
}

.maple-code-blocks[data-theme="light"] .mcb-editor,
.maple-code-blocks.mcb-theme-light .mcb-editor {
    background: #ffffff;
}

/* Header */
.mcb-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.mcb-title {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: inherit;
}

.mcb-repo-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    margin-left: 16px;
}

.mcb-github-icon,
.mcb-platform-icon {
    fill: currentColor;
    opacity: 0.7;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.mcb-repo-name {
    font-size: 13px;
    opacity: 0.8;
}

.mcb-controls {
    display: flex;
    gap: 8px;
}

.mcb-controls button {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.mcb-controls button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mcb-controls button svg {
    fill: currentColor;
    opacity: 0.7;
}

/* Content Area */
.mcb-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Sidebar */
.mcb-sidebar {
    width: 240px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mcb-search-box {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mcb-search-input {
    width: 100%;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: inherit;
    font-size: 12px;
    outline: none;
}

.mcb-search-input:focus {
    border-color: #007acc;
    background: rgba(0, 0, 0, 0.3);
}

/* File List */
.mcb-file-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.mcb-file-item {
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    transition: background-color 0.1s;
    user-select: none;
}

.mcb-file-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mcb-file-item.active {
    background: rgba(0, 122, 204, 0.3);
}

.mcb-file-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.mcb-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcb-file-size {
    font-size: 11px;
    opacity: 0.6;
}

/* Folder styles */
.mcb-folder .mcb-file-icon,
.mcb-parent-folder .mcb-file-icon {
    font-size: 16px;
}

.mcb-folder {
    cursor: pointer;
    font-weight: 600;
}

.mcb-folder:hover,
.mcb-parent-folder:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mcb-parent-folder {
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.mcb-breadcrumb {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    margin-bottom: 8px;
}

.mcb-path-label {
    opacity: 0.6;
    margin-right: 4px;
}

.mcb-current-path {
    font-family: monospace;
}

/* Editor Area */
.mcb-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tabs */
.mcb-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    min-height: 35px;
}

.mcb-tab {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    white-space: nowrap;
    user-select: none;
    position: relative;
}

.mcb-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mcb-tab.active {
    background: var(--editor-bg, #1e1e1e);
    border-bottom: 2px solid #007acc;
}

.mcb-tab-close {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.5;
}

.mcb-tab-close:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

/* Code Area */
.mcb-code-area {
    flex: 1;
    overflow: auto;
    position: relative;
}

.mcb-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    opacity: 0.3;
}

.mcb-welcome svg {
    fill: currentColor;
    margin-bottom: 16px;
}

.mcb-welcome h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 300;
}

.mcb-welcome p {
    margin: 0;
    font-size: 14px;
}

/* Code Container */
.mcb-code-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.mcb-code-header {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mcb-filename {
    font-size: 13px;
    font-weight: 500;
}

.mcb-copy-btn {
    padding: 4px 12px;
    background: rgba(0, 122, 204, 0.2);
    border: 1px solid #007acc;
    border-radius: 4px;
    color: #007acc;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.mcb-copy-btn:hover {
    background: rgba(0, 122, 204, 0.3);
}

.mcb-copy-btn.copied {
    background: rgba(0, 255, 0, 0.2);
    border-color: #00ff00;
    color: #00ff00;
}

/* Code Wrapper */
.mcb-code-wrapper {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

.mcb-code-wrapper pre {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    tab-size: 4;
}

.mcb-code-wrapper code {
    display: block;
    font-family: inherit;
    white-space: pre;
}

/* Line Numbers */
.line-numbers .line-number {
    display: inline-block;
    width: 40px;
    text-align: right;
    padding-right: 12px;
    color: #858585;
    user-select: none;
}

.line-numbers .line-content {
    white-space: pre;
}

/* Status Bar */
.mcb-status-bar {
    padding: 4px 16px;
    background: rgba(0, 122, 204, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.mcb-status-text {
    opacity: 0.8;
}

.mcb-file-info {
    opacity: 0.6;
}

/* Loading Spinner */
.mcb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    opacity: 0.6;
}

.mcb-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #007acc;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.mcb-loading span {
    font-size: 12px;
}

/* Error State */
.mcb-error {
    padding: 16px;
    background: #ff5252;
    color: white;
    border-radius: 4px;
    margin: 16px;
    text-align: center;
}

/* Scrollbars */
.mcb-file-list::-webkit-scrollbar,
.mcb-code-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.mcb-file-list::-webkit-scrollbar-track,
.mcb-code-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.mcb-file-list::-webkit-scrollbar-thumb,
.mcb-code-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.mcb-file-list::-webkit-scrollbar-thumb:hover,
.mcb-code-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Fullscreen Mode */
.maple-code-blocks.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    height: 100vh !important;
    border-radius: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mcb-sidebar {
        width: 200px;
    }
    
    .mcb-code-wrapper {
        padding: 8px;
    }
    
    .line-numbers .line-number {
        width: 30px;
        padding-right: 8px;
    }
}

@media (max-width: 480px) {
    .mcb-sidebar {
        display: none;
    }
    
    .mcb-header {
        padding: 8px;
    }
    
    .mcb-repo-info {
        margin-left: 8px;
    }
}
