:root {
    --sidebar-width: 280px;
}

.main-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background-color: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
    gap: 1rem;
}

.project-info {
    flex: 1;
    min-width: 0;
}

.project-title {
    margin: 0 0 0.1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.2;
}

.project-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-author {
    opacity: 0.7;
    font-size: 0.85rem;
}

.action-buttons {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-shrink: 0;
}

.action-buttons .btn {
    color: var(--bs-secondary-color);
    border: none;
    font-size: 1.1rem;
}

.action-buttons .btn:hover {
    color: var(--bs-primary);
    background-color: var(--bs-secondary-bg);
}

.action-buttons .btn:disabled {
    opacity: 0.4;
}

.dropdown {
    position: relative;
}

.content-area {
    flex: 1;
    display: flex;
    min-height: 0;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
    overflow-y: auto;
    overflow-x: hidden;
    transition: margin-left 0.3s ease;
    flex-shrink: 0;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar.hidden {
    display: none;
}

.code-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.file-header {
    background-color: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.file-name {
    font-family: 'Monaco', 'Consolas', monospace;
    font-weight: 600;
    margin: 0;
    font-size: 0.95rem;
}

.copy-btn {
    color: var(--bs-secondary-color);
    border: none !important;
    background: none !important;
    font-size: 0.9rem;
    padding: 0.2rem !important;
}

.copy-btn:hover {
    color: var(--bs-primary);
    background-color: var(--bs-secondary-bg) !important;
}

.copy-btn:disabled {
    opacity: 0.4;
}

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

.file-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

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

.file-item.active {
    background-color: var(--bs-primary);
    color: var(--bs-primary-text-emphasis);
}

#codeContainer {
    flex: 1;
    overflow: hidden;
}

.cm-editor {
    height: 100%;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 14px;
}

.cm-focused {
    outline: none;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.error-message {
    padding: 2rem;
    text-align: center;
}

.sidebar-toggle {
    display: none;
}

/* Mobile sidebar backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-backdrop.show {
    display: block;
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 250px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: inline-block;
    }

    .project-title {
        font-size: 1rem;
    }

    .project-author {
        font-size: 0.8rem;
    }

    .action-buttons {
        gap: 0.3rem;
    }

    .action-buttons .btn {
        font-size: 1rem;
        padding: 0.25rem;
    }

    .file-header {
        padding: 0.4rem 1rem;
    }

    .file-name {
        font-size: 0.9rem !important;
    }

    .copy-btn {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .project-title {
        font-size: 0.95rem;
        line-height: 1.1;
        margin-bottom: 0.05rem;
    }

    .project-author {
        font-size: 0.75rem;
    }

    .action-buttons {
        gap: 0.2rem;
    }

    .action-buttons .btn {
        font-size: 0.9rem;
        padding: 0.2rem;
    }

    .file-header {
        padding: 0.35rem 0.75rem;
    }

    .file-name {
        font-size: 0.8rem !important;
    }

    .copy-btn {
        font-size: 0.8rem;
        padding: 0.15rem !important;
    }
}

.theme-dropdown {
    min-width: 140px;
}
