/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fafafa;
    --border-color: #e5e5e7;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --accent: #007aff;
    --accent-hover: #0051d5;
    --sidebar-bg: #f5f5f7;
    --item-hover: #e8e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.nav-section h2 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 8px 12px;
    margin-bottom: 4px;
}

.nav-list {
    list-style: none;
}

.nav-list li {
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.nav-list li:hover {
    background: var(--item-hover);
}

.nav-list li.active {
    background: var(--accent);
    color: white;
}

.nav-list a.active {
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
}

/* Collapsible project navigation */
.nav-item-project,
.nav-item-all-tasks {
    margin-bottom: 2px;
}

.nav-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
    gap: 0.5rem;
}

.nav-item-header:hover {
    background: var(--item-hover);
}

.nav-item-link {
    flex: 1;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    padding: 0;
    margin: 0;
}

.nav-item-link:hover {
    text-decoration: none;
}

.project-badge {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 10px;
    white-space: nowrap;
}

.expand-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 10px;
    color: var(--text-secondary);
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
}

.expand-toggle:hover {
    color: var(--text-primary);
}

.nav-item-views {
    list-style: none;
    margin: 0;
    padding: 0;
    padding-left: 1.5rem;
    margin-top: 4px;
}

.nav-item-views li {
    padding: 6px 12px;
    margin: 0;
}

.nav-item-views a {
    display: block;
    padding: 4px 8px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    transition: background 0.2s;
}

.nav-item-views a:hover {
    background: var(--item-hover);
    text-decoration: none;
}

.nav-item-new-project {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.nav-item-new-project a {
    color: var(--accent);
    font-weight: 500;
}

.nav-list li.loading {
    color: var(--text-secondary);
    cursor: default;
    font-style: italic;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-secondary);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

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

.breadcrumb-separator {
    color: var(--text-secondary);
    margin: 0 4px;
}

.breadcrumb-item.active {
    color: var(--text-primary);
    cursor: default;
}

.breadcrumb-item.active:hover {
    background: transparent;
}

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

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: background 0.2s;
}

.btn-icon:hover:not(:disabled) {
    background: var(--item-hover);
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* Directory View */
.directory-view {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.directory-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.view-options {
    display: flex;
    gap: 4px;
}

.view-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.view-btn:hover {
    background: var(--item-hover);
}

.view-btn.active {
    background: var(--accent);
    color: white;
}

.directory-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.items-list {
    margin-bottom: 16px;
}

.item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

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

.item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

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

.item-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.item-badge.text-file {
    background: var(--accent);
    color: white;
}

/* File Viewer */
.file-viewer {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.file-header h2 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-close:hover {
    background: var(--item-hover);
    color: var(--text-primary);
}

.file-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
    background: var(--bg-tertiary);
}

.file-content pre {
    margin: 0;
    padding: 0;
    background: transparent;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 32px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

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

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* Error State */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 32px;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-state h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.error-state p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.btn-primary {
    padding: 8px 16px;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

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

.btn-danger {
    padding: 0.75rem 1.5rem;
    background: #ff3b30;
    border: 1px solid #ff3b30;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: white;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #d32f2f;
    border-color: #d32f2f;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}









