:root {
    --bg-main: #0c1017;
    --bg-surface: #141b26;
    --bg-sidebar: #0f1626;
    --bg-input: #172238;
    --bg-hover: rgba(56, 189, 248, 0.08);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(56, 189, 248, 0.3);
    
    --accent-cyan: #38bdf8;
    --accent-indigo: #818cf8;
    --accent-teal: #2dd4bf;
    --accent-emerald: #34d399;
    --accent-amber: #fbbf24;

    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-code: #38bdf8;

    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.25);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-input: #f1f5f9;
    --bg-hover: rgba(2, 132, 199, 0.05);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(2, 132, 199, 0.3);

    --accent-cyan: #0284c7;
    --accent-indigo: #4f46e5;
    --accent-teal: #0d9488;
    --accent-emerald: #059669;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-code: #0284c7;

    --shadow-card: 0 10px 25px rgba(0, 0, 0, 0.05);
}

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

body, html {
    width: 100%;
    height: 100%;
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

#app {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 300px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-header {
    padding: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.2rem;
}
.sidebar-brand i {
    color: var(--accent-cyan);
}

.search-box {
    padding: 12px 14px;
}
.search-box input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.88rem;
    outline: none;
}
.search-box i {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}
.tree-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 3px;
    transition: var(--transition);
}
.tree-item:hover, .tree-item.active {
    background: var(--bg-hover);
    color: var(--accent-cyan);
}
.tree-item-name {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main View */
.main-view {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: 64px;
    padding: 0 1.8rem;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.path-crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 600;
}
.crumb-item {
    color: var(--accent-cyan);
    cursor: pointer;
    transition: var(--transition);
}
.crumb-item:hover {
    text-decoration: underline;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Content Panel */
.content-panel {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.grid-panel {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.grid-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}
.grid-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    background: var(--bg-hover);
}
.grid-card-icon {
    font-size: 2.2rem;
    color: var(--accent-cyan);
    margin-bottom: 10px;
}
.grid-card-name {
    font-size: 0.88rem;
    font-weight: 600;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

}
.grid-card-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Preview Modal / Drawer */
.preview-panel {
    width: 600px;
    height: 100%;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: var(--transition);
}
.preview-panel.hidden {
    display: none;
}

.preview-header {
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.preview-title {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-body {
    flex: 1;
    overflow: auto;
    padding: 1.2rem;
}
.preview-code {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.6;
    background: var(--bg-main);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    white-space: pre;
    overflow-x: auto;
    color: var(--text-main);
}
.preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    display: block;
    margin: 0 auto;
}

.meta-box {
    margin-top: 1rem;
    background: var(--bg-main);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    font-size: 0.82rem;
}
.meta-item {
    color: var(--text-muted);
}
.meta-item span {
    color: var(--text-main);
    font-weight: 600;
    font-family: var(--font-mono);
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}
