/* --- BASIS & LAYOUT --- */
body { 
    margin: 0; 
    display: flex; 
    height: 100vh; 
    background: #1e1e1e; 
    color: #ccc; 
    font-family: sans-serif; 
    overflow: hidden; 
}

#main { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    min-width: 0; 
}

header { 
    height: 40px; 
    background: #333; 
    display: flex; 
    align-items: center; 
    padding: 0 10px; 
    justify-content: space-between; 
}

#editor-container { flex: 1; }

/* --- LOGIN BOX --- */
.login-container { width: 100%; display: flex; height: 100vh; justify-content: center; align-items: center; }
.login-box { background: #252526; padding: 40px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); text-align: center; }
.login-box input { padding: 10px; border-radius: 4px; border: 1px solid #3c3c3c; background: #3c3c3c; color: white; margin-bottom: 10px; width: 200px; display: block; margin: 0 auto 10px auto; }
.login-box button { padding: 10px 20px; background: #0e639c; color: white; border: none; border-radius: 4px; cursor: pointer; width: 100%; }
.login-box button:hover { background: #1177bb; }
.error { color: #f48771; margin-bottom: 10px; font-size: 0.9em; }

/* --- SIDEBAR (EXPLORER) --- */
#sidebar {
    display: flex;
    flex-direction: column;
    width: 350px;
    min-width: 200px;
    background: #252526;
    border-left: 1px solid #333;
    transition: width 0.3s ease, margin-right 0.3s ease;
    overflow: hidden; /* Verhindert doppelte Scrollbalken während Animation */
}

#sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    visibility: hidden;
}

.sidebar-header {
    padding: 10px;
    background: #252526;
    z-index: 10;
}

#sidebar h3 {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #858585;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#sidebar-filter {
    width: 100%;
    box-sizing: border-box;
    padding: 6px;
    background: #3c3c3c;
    border: 1px solid #555;
    color: white;
    border-radius: 3px;
    outline: none;
}
#sidebar-filter:focus { border-color: #007acc; }

/* --- TREE VIEW --- */
#file-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 0 0 150px 0;
    list-style: none;
    margin: 0;
}

/* KEIN border-bottom für Tree-Items für saubereren Look */
#file-list li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree-item {
    width: fit-content;
    border-bottom: 1px dotted #444;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 3px;
    font-size: 13px;
    color: #cccccc;
}
.tree-item:hover { background: #2a2d2e; }
.tree-item.active-file { background: #37373d; color: white; border-left: 2px solid #007acc; }

.tree-sub-container {
    margin-left: 12px;
    border-left: 1px dotted #444;
    list-style: none;
    padding: 0;
}

.tree-arrow {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #858585;
    transition: transform 0.2s;
}
.tree-arrow.open { transform: rotate(90deg); }

/* --- TABS --- */
#tab-bar {
    background: #252526;
    display: flex;
    height: 35px;
    border-bottom: 1px solid #1e1e1e;
    
    /* WICHTIG: Damit man bei vielen Tabs scrollen kann */
    overflow-x: auto; 
    overflow-y: hidden; /* Verhindert vertikales Wackeln */
    white-space: nowrap; /* Tabs bleiben in einer Reihe */
    
    /* Für Firefox */
    scrollbar-width: thin;
    scrollbar-color: #444 #252526;
}

/* Schicke, dünne Scrollbar für Chrome, Edge und Safari */
#tab-bar::-webkit-scrollbar {
    height: 4px; /* Sehr flach, damit es nicht stört */
}

#tab-bar::-webkit-scrollbar-track {
    background: #252526;
}

#tab-bar::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 10px;
}

#tab-bar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.tab {
    background: #2d2d2d;
    color: #969696;
    padding: 0 10px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-right: 1px solid #252526;
    font-size: 13px;
    min-width: 120px;
    max-width: 250px;
    white-space: nowrap;
}
.tab.active { background: #1e1e1e; color: white; border-top: 1px solid #007acc; }
.tab:hover { background: #2a2d2e; }

.tab-close {
    padding: 4px;
    margin-left: auto;
    font-size: 14px;
    border-radius: 3px;
    opacity: 0.6;
}
.tab-close:hover { opacity: 1; background: #444; color: white; }

.tab.unsaved .filename-span::after {
    content: ' ●';
    color: #e2c08d;
    font-weight: bold;
}

/* --- KONTEXTMENÜ --- */
.context-menu {
    display: none;
    position: fixed;
    z-index: 10000;
    background: #252526;
    border: 1px solid #454545;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    padding: 5px 0;
    min-width: 180px;
    border-radius: 4px;
}
.menu-item { padding: 8px 15px; font-size: 13px; color: #cccccc; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.menu-item:hover { background: #007acc; color: white; }
.menu-item.delete:hover { background: #a10000; }
.menu-divider { height: 1px; background: #454545; margin: 5px 0; }

/* --- BUTTONS & ICONS --- */
.btn-icon {
    min-height: 32px;
    background: transparent;
    border: 1px solid #444;
    color: #ccc;
    cursor: pointer;
    padding: 5px 10px;
    margin-right: 5px;
    border-radius: 3px;
}
.btn-icon:hover { background: #444; color: white; }
.btn-icon.active { background-color: #0e639c; color: white; }

.save-btn { min-height: 32px; background: #0e639c; color: white; border: none; padding: 0 15px; cursor: pointer; border-radius: 3px; }
.logout-link {align-content: center; color: #f48771; text-decoration: none; font-size: 12px; margin-left: 15px; border: 1px solid #f48771; padding: 4px 8px; border-radius: 3px; }

/* --- DETAILS (Backup Menü falls Rechtsklick nicht genutzt wird) --- */
details summary { list-style: none; cursor: pointer; color: #858585; padding: 0 5px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: '⋮'; font-size: 16px; }
details[open] .btn-group {
    position: absolute; right: 10px; background: #252526; border: 1px solid #444; 
    padding: 5px; z-index: 100; display: flex; gap: 5px; border-radius: 4px;
}