:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --accent: #bb86fc;
    --primary: #3700b3;
    --success: #03dac6;
    --danger: #cf6679;
    --border-radius: 8px;
}

/* GLOBAL RESET & BASE */
* { box-sizing: border-box; }
body { background-color: var(--bg-color); color: var(--text-main); font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; margin: 0; padding-bottom: 50px; overflow-x: hidden; }
.hidden { display: none !important; }

/* --- LOGIN PAGE --- */
.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; width: 100%; position: relative; }
.login-card { background: var(--card-bg); padding: 40px; border-radius: var(--border-radius); width: 100%; max-width: 350px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); text-align: center; border: 1px solid #333; z-index: 2; }
.login-card input { width: 100%; padding: 12px; margin: 10px 0; background: #121212; border: 1px solid #333; color: white; border-radius: 6px; outline: none; transition: 0.3s; }
.login-card input:focus { border-color: var(--accent); }
.login-card button { width: 100%; padding: 12px; background: var(--primary); color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 16px; margin-top: 10px; font-weight: bold; transition: 0.2s; }
.login-card button:hover { background: var(--accent); color: #000; }
.login-card button:disabled { background: #333; color: #888; cursor: not-allowed; opacity: 0.7; }
.alert { color: var(--danger); margin-bottom: 15px; font-size: 0.9em; background: rgba(207, 102, 121, 0.1); padding: 10px; border-radius: 4px; }

/* --- DASHBOARD --- */
.top-bar { display: flex; justify-content: space-between; padding: 15px 40px; align-items: center; background: rgba(30, 30, 30, 0.8); backdrop-filter: blur(10px); border-bottom: 1px solid #333; position: sticky; top: 0; z-index: 100; width: 100%; }
.logo { 
    font-weight: bold; 
    letter-spacing: 2px; 
    color: white; 
    font-size: 1.2rem; 
    
    /* Новые стили для выравнивания */
    display: flex;
    align-items: center;
    gap: 12px; /* Отступ между картинкой и текстом */
    text-decoration: none; /* Если вдруг лого станет ссылкой */
}

.logo-img {
    height: 40px; /* Фиксируем высоту под размер меню */
    width: auto;  /* Ширина подстроится автоматически */
    object-fit: contain; /* Чтобы картинка не сплющилась */
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.2)); /* Легкая тень для красоты */
}
.container { max-width: 1200px; margin: 30px auto; padding: 0 20px; width: 100%; }

/* User Menu */
.user-menu-container { position: relative; }
.user-pill { display: flex; align-items: center; gap: 10px; background: #121212; padding: 5px 15px 5px 5px; border-radius: 30px; cursor: pointer; border: 1px solid #333; transition: 0.2s; }
.user-pill:hover { border-color: var(--accent); }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.dropdown-content { display: none; position: absolute; right: 0; top: 120%; background: var(--card-bg); min-width: 220px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border-radius: 8px; z-index: 10; border: 1px solid #333; overflow: hidden; }
.dropdown-content a { color: var(--text-main); padding: 12px 20px; text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 0.9em; transition: 0.2s; }
.dropdown-content a:hover { background-color: #333; }
.dropdown-content a.danger { color: var(--danger); }
.dropdown-content a.danger:hover { background-color: rgba(207, 102, 121, 0.1); }
.show { display: block; }

/* Search */
.search-section { display: flex; gap: 15px; margin-bottom: 40px; }
.search-box { display: flex; align-items: center; background: var(--card-bg); padding: 12px 25px; border-radius: 50px; transition: 0.3s; border: 1px solid transparent; width: 100%; }
.search-box:focus-within { box-shadow: 0 0 15px rgba(187, 134, 252, 0.1); border-color: var(--accent); background: #1a1a1a; }
.search-box input { background: transparent; border: none; color: white; width: 100%; font-size: 16px; outline: none; }

/* Dashboard Cards */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.card { background: var(--card-bg); padding: 25px; border-radius: var(--border-radius); box-shadow: 0 4px 10px rgba(0,0,0,0.2); border: 1px solid #333; }
.card.full-width { grid-column: 1 / -1; }
.card h3 { margin: 0 0 20px 0; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 1px; }
.big-stat { text-align: center; margin-bottom: 15px; }
.big-stat span { font-size: 3em; font-weight: bold; color: var(--success); display: block; line-height: 1; text-shadow: 0 0 10px rgba(3, 218, 198, 0.2); }
.big-stat small { color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-size: 0.7em; margin-top: 5px; display: block; }
.stat-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; font-size: 0.9em; }
.progress-bg { flex: 1; height: 6px; background: #333; margin: 0 15px; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.5s ease; box-shadow: 0 0 5px var(--accent); }

/* VMs List */
.vm-list { list-style: none; padding: 0; margin: 0; max-height: 250px; overflow-y: auto; }
.vm-list li { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid #2a2a2a; font-size: 0.9em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 12px; flex-shrink: 0; }
.status-running { background: var(--success); box-shadow: 0 0 5px var(--success); }
.status-stopped { background: var(--danger); }

/* Disks & SMART Table */
.disk-item { background: #1a1a1a; border-radius: 8px; margin-bottom: 8px; overflow: hidden; border: 1px solid #333; transition: 0.2s; }
.disk-header { padding: 12px 15px; display: grid; grid-template-columns: 1.5fr 1fr 0.8fr 0.8fr 0.5fr 20px; align-items: center; cursor: pointer; font-size: 0.9em; gap: 10px; }
.disk-header:hover { background: #252525; }
.disk-details { background: #121212; border-top: 1px solid #333; padding: 20px; display: none; }
.disk-item.active .disk-details { display: block; }

.smart-table-wrapper { margin-top: 15px; overflow-x: auto; border-radius: 6px; background: #080808; border: 1px solid #333; }
.smart-table { width: 100%; border-collapse: collapse; font-family: 'Consolas', monospace; font-size: 0.8em; color: #888; white-space: nowrap; }
.smart-table th { background: #1a1a1a; color: var(--accent); text-align: left; padding: 8px 10px; text-transform: uppercase; font-size: 0.75em; border-bottom: 1px solid #333; }
.smart-table td { padding: 6px 10px; border-bottom: 1px solid #111; }
.smart-table tr:hover td { background: #111; color: #eee; }
.smart-table tr td:last-child { color: var(--success); font-weight: bold; }
.raw-smart-text { font-family: 'Consolas', monospace; font-size: 0.75em; color: #666; background: #080808; padding: 15px; border-radius: 6px; margin-top: 15px; overflow-x: auto; border: 1px solid #333; }

/* Bookmarks */
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.section-title h3 { margin: 0; font-weight: normal; color: var(--text-muted); font-size: 0.9em; text-transform: uppercase; }
.bookmarks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; margin-bottom: 40px; }
.bookmark-item { background: var(--card-bg); padding: 15px; border-radius: var(--border-radius); text-align: center; color: var(--text-main); transition: 0.2s; position: relative; height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid #333; }
.bookmark-item:hover { transform: translateY(-3px); border-color: var(--accent); }
.bookmark-item img { width: 32px; height: 32px; margin-bottom: 10px; object-fit: contain; }
.bm-link-overlay { position: absolute; top:0; left:0; width:100%; height:100%; z-index: 1; }
.bm-controls { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; gap: 8px; border-radius: var(--border-radius); z-index: 2; }
.edit-mode .bm-controls { display: flex; }
.bm-btn { background: #444; border: none; color: white; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1em; padding: 5px; transition: 0.2s; }
.icon-btn:hover, .icon-btn.active { color: var(--accent); transform: scale(1.1); }

/* --- ADMIN & PROFILE FORMS --- */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.admin-card { background: var(--card-bg); border-radius: var(--border-radius); border: 1px solid #333; overflow: hidden; padding: 0; }
.add-user-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 15px; padding: 20px; background: #252525; border-bottom: 1px solid #333; align-items: center; }
.users-table { width: 100%; border-collapse: collapse; }
.users-table th { text-align: left; padding: 15px 20px; color: #888; font-size: 0.8em; text-transform: uppercase; border-bottom: 1px solid #333; background: #222; }
.users-table td { padding: 15px 20px; border-bottom: 1px solid #333; vertical-align: middle; }
.users-table tr:hover { background: #252525; }
.role-group { display: flex; gap: 8px; flex-wrap: wrap; }
.role-checkbox { display: none; }
.role-pill { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.75em; background: #333; color: #aaa; cursor: pointer; border: 1px solid #444; transition: 0.2s; user-select: none; }
.role-checkbox:checked + .role-pill { background: var(--accent); color: black; font-weight: bold; border-color: var(--accent); }

.profile-form label { display: block; margin-bottom: 5px; color: #aaa; font-size: 0.9em; }
.dark-input, .add-user-form input, #bmForm input { width: 100%; padding: 12px; background: #2c2c2c; border: 1px solid #444; color: white; border-radius: 4px; box-sizing: border-box; outline: none; transition: 0.2s; }
.dark-input:focus, .add-user-form input:focus, #bmForm input:focus { border-color: var(--accent); background: #333; }
.save-btn, #bmForm button, .add-user-form button { width: 100%; padding: 12px; background: var(--success); border: none; border-radius: 4px; color: #000; font-weight: bold; cursor: pointer; transition: 0.2s; }
.save-btn:hover { opacity: 0.9; }
.cancel-btn { background: #333; color: white; border: none; padding: 12px 30px; border-radius: 4px; cursor: pointer; font-size: 1rem; display: inline-block; text-align: center; text-decoration: none; transition: 0.2s; }
.cancel-btn:hover { background: #444; }

:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --accent: #bb86fc;
    --primary: #3700b3;
    --success: #03dac6;
    --danger: #cf6679;
    --border-radius: 8px;
}

body { background-color: var(--bg-color); color: var(--text-main); font-family: 'Segoe UI', sans-serif; margin: 0; padding-bottom: 50px; }
.hidden { display: none !important; }

/* --- COMMON MODAL --- */
.modal { display: none; position: fixed; z-index: 200; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); backdrop-filter: blur(5px); }
.modal-content { background-color: var(--card-bg); margin: 5% auto; padding: 30px; border: 1px solid #444; width: 90%; max-width: 500px; border-radius: var(--border-radius); position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.close { position: absolute; right: 20px; top: 15px; font-size: 28px; cursor: pointer; color: var(--text-muted); }
.modal-form label { display: block; margin-bottom: 8px; color: #aaa; font-size: 0.9em; }
.modal-form input, .modal-form textarea { width: 100%; padding: 12px; margin-bottom: 20px; background: #121212; border: 1px solid #444; color: white; border-radius: 4px; box-sizing: border-box; outline: none; }
.modal-form button { width: 100%; padding: 12px; background: var(--success); border: none; border-radius: 4px; color: #000; font-weight: bold; cursor: pointer; }

/* --- ISMD LAYOUT --- */
.ismd-body { display: flex; height: 100vh; overflow: hidden; background: #121212; color: #e0e0e0; }
.ismd-sidebar { width: 320px; background: #1e1e1e; border-right: 1px solid #333; display: flex; flex-direction: column; padding: 20px; box-sizing: border-box; flex-shrink: 0; }
.ismd-content { flex: 1; position: relative; overflow-y: auto; padding: 40px; background: #121212; min-width: 0; }

.ismd-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.back-link { color: #888; text-decoration: none; font-size: 0.9em; display: flex; align-items: center; gap: 5px; transition: 0.2s; }
.back-link:hover { color: white; }

.search-box { display: flex; align-items: center; background: #121212; padding: 10px 15px; border-radius: 6px; border: 1px solid #333; margin-bottom: 20px; }
.search-box input { background: transparent; border: none; color: white; width: 100%; outline: none; margin-left: 10px; }

/* Categories Sidebar */
.categories-list { flex: 1; overflow-y: auto; margin-top: 10px; padding-right: 5px; }
.cat-item { padding: 12px; cursor: pointer; border-radius: 6px; margin-bottom: 5px; color: #aaa; transition: 0.2s; border: 1px solid transparent; }
.cat-item:hover { background: #2a2a2a; color: white; }
.cat-item.active { background: #2c2c2c; color: var(--accent); border-color: var(--accent); }
.cat-title-text { font-weight: 500; color: #eee; }
.cat-desc-text { font-size: 0.8em; color: #777; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-item.active .cat-title-text { color: var(--accent); }

/* Sidebar Buttons */
.sidebar-actions { display: flex; gap: 10px; margin-top: 15px; }
.sidebar-btn { flex: 1; padding: 10px; background: #2c2c2c; border: 1px solid #444; color: #ccc; cursor: pointer; border-radius: 6px; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.sidebar-btn:hover { border-color: var(--accent); color: white; background: #333; }

/* --- CATEGORY MANAGER MODAL --- */
.cat-manage-list { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; }
.cat-manage-item { display: flex; align-items: flex-start; gap: 10px; background: #1a1a1a; padding: 10px; border-radius: 6px; margin-bottom: 8px; border: 1px solid #333; }
.cat-manage-item.editing { border-color: var(--accent); background: #252525; }

.cat-info { flex: 1; }
.cat-name { font-weight: bold; color: white; font-size: 1rem; }
.cat-desc { font-size: 0.85em; color: #888; margin-top: 4px; }

.cat-edit-form { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cat-edit-form input { width: 100%; padding: 8px; background: #121212; border: 1px solid #444; color: white; border-radius: 4px; font-size: 0.9em; outline: none; }

.cat-actions { display: flex; gap: 5px; align-items: center; }
.cat-actions-col { display: flex; flex-direction: column; gap: 2px; }
.cat-btn { background: #333; border: none; color: #aaa; width: 30px; height: 30px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.cat-btn:hover { background: #444; color: white; }
.cat-btn.edit:hover { background: var(--accent); color: black; }
.cat-btn.del:hover { background: var(--danger); color: white; }
.cat-btn.save { background: var(--success); color: black; }

/* --- ARTICLES --- */
.articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.article-card { background: #1e1e1e; padding: 25px; border-radius: 8px; cursor: pointer; transition: 0.2s; border: 1px solid #333; position: relative; overflow: hidden; }
.article-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.article-card h3 { margin: 0 0 10px 0; color: var(--accent); font-size: 1.2em; }
.article-meta { font-size: 0.8em; color: #666; display: flex; justify-content: space-between; margin-bottom: 15px; border-bottom: 1px solid #2a2a2a; padding-bottom: 10px; }
.article-preview { font-size: 0.9em; color: #999; line-height: 1.5; height: 60px; overflow: hidden; opacity: 0.8; }

/* Article View */
.article-view { max-width: 1200px; margin: 0 auto; display: none; }
.article-meta-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; border-bottom: 1px solid #333; padding-bottom: 20px; }
.meta-info h1 { margin: 0 0 10px 0; color: white; }
.meta-info div { color: #666; font-size: 0.9em; }
.article-actions { display: flex; gap: 10px; }
.action-btn { background: #2c2c2c; border: 1px solid #444; color: white; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.action-btn:hover { background: var(--accent); color: black; border-color: var(--accent); }
.action-btn.danger:hover { background: var(--danger); color: white; border-color: var(--danger); }
.close-article-btn { background: transparent; border: 1px solid #444; color: #888; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; margin-right: 20px; }
.close-article-btn:hover { border-color: white; color: white; transform: rotate(90deg); }

/* Content Layout */
.article-layout { display: flex; gap: 50px; }
.article-body { flex: 1; min-width: 0; line-height: 1.8; font-size: 1.1em; color: #ddd; word-wrap: break-word; }
.article-body h1, .article-body h2 { color: white; border-bottom: 1px solid #333; padding-bottom: 10px; margin-top: 40px; }
.article-body a { color: var(--accent); }
.article-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 20px 0; display: block; }
.article-body code { background: #2a2a2a; padding: 2px 6px; border-radius: 4px; font-family: 'Consolas', monospace; color: #ff79c6; }
.article-body blockquote { border-left: 4px solid var(--accent); margin: 20px 0; padding-left: 20px; color: #999; font-style: italic; background: #1a1a1a; padding: 15px; border-radius: 0 8px 8px 0; }

/* COMPACT CODE BLOCKS */
.article-body pre { background: #1e1e1e; padding: 15px; border-radius: 8px; border: 1px solid #333; overflow: auto; margin: 20px 0; font-size: 0.9em; max-height: 500px; position: relative; }
.article-body pre code { background: transparent; padding: 0; color: #f8f8f2; white-space: pre; }
.copy-btn { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,0.1); border: none; color: #ccc; padding: 5px 8px; border-radius: 4px; cursor: pointer; font-size: 0.8em; z-index: 5; transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.copy-btn:hover { background: rgba(255,255,255,0.3); color: white; }

.article-toc { width: 250px; position: sticky; top: 20px; align-self: start; border-left: 1px solid #333; padding-left: 20px; font-size: 0.9em; max-height: 80vh; overflow-y: auto; flex-shrink: 0; }
.article-toc h4 { margin-top: 0; color: #666; text-transform: uppercase; letter-spacing: 1px; font-size: 0.8em; }
.article-toc a { display: block; color: #888; text-decoration: none; margin-bottom: 8px; transition: 0.2s; }
.article-toc a:hover { color: var(--accent); padding-left: 5px; }

/* Editor & Tabs */
.article-editor { display: none; flex-direction: column; height: 100%; max-width: 1200px; margin: 0 auto; }
.editor-title { background: transparent; border: none; font-size: 2.5em; color: white; border-bottom: 1px solid #333; margin-bottom: 20px; padding: 15px 0; outline: none; font-weight: bold; width: 100%; }
.editor-cat { background: #2c2c2c; color: white; border: 1px solid #444; padding: 10px; margin-bottom: 20px; border-radius: 6px; outline: none; width: 100%; }
.editor-tabs { display: flex; gap: 10px; margin-bottom: 10px; border-bottom: 1px solid #333; }
.editor-tabs button { background: transparent; border: none; color: #888; padding: 10px 20px; cursor: pointer; font-size: 1rem; border-bottom: 2px solid transparent; }
.editor-tabs button:hover { color: white; }
.editor-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 8px; margin-bottom: 15px; flex-wrap: wrap; background: #1e1e1e; padding: 10px; border-radius: 8px; border: 1px solid #333; }
.toolbar button { background: #2c2c2c; border: none; color: #bbb; padding: 8px 12px; cursor: pointer; border-radius: 4px; font-weight: bold; transition: 0.2s; }
.toolbar button:hover { background: #3d3d3d; color: white; }
.editor-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; min-height: 500px; }
#editContent { width: 100%; height: 100%; background: #1e1e1e; color: #ddd; border: 1px solid #333; padding: 30px; font-family: 'Consolas', monospace; font-size: 1.1em; line-height: 1.6; resize: none; outline: none; border-radius: 8px; box-sizing: border-box; }
#editorPreview { width: 100%; height: 100%; background: #121212; padding: 30px; overflow-y: auto; box-sizing: border-box; border: 1px solid #333; border-radius: 8px; }
#editorPreview img { max-width: 100%; display: block; margin: 10px auto; }
.editor-footer { margin-top: 20px; display: flex; gap: 15px; justify-content: flex-end; }
.fab-add { position: fixed; bottom: 40px; right: 40px; width: 60px; height: 60px; border-radius: 50%; background: var(--accent); border: none; font-size: 24px; color: black; cursor: pointer; box-shadow: 0 10px 20px rgba(0,0,0,0.4); transition: 0.3s; z-index: 10; display: flex; align-items: center; justify-content: center; }
.fab-add:hover { transform: scale(1.1) rotate(90deg); }
