* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #161b22;
    border-right: 1px solid #21262d;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.logo {
    padding: 0 20px 30px;
    border-bottom: 1px solid #21262d;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.logo img {
    background: #0d1117;
    border-radius: 8px;
    object-fit: contain;
}

.logo h2 {
    color: #58a6ff;
    font-size: 1.3em;
    font-weight: 700;
}

.nav-menu {
    flex: 1;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin: 5px 0;
    border-radius: 8px;
    color: #8b949e;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background: #21262d;
    color: #c9d1d9;
}

.nav-item.active {
    background: #1f6feb;
    color: white;
}

.nav-icon {
    font-size: 1.3em;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-weight: 500;
    font-size: 0.95em;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    margin: 20px 10px 0;
    background: #0d1117;
    border-radius: 8px;
    border: 1px solid #21262d;
    font-weight: 600;
    font-size: 0.9em;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6e7681;
    animation: pulse 2s infinite;
}

.status-badge.online .status-dot {
    background: #3fb950;
    box-shadow: 0 0 10px #3fb950;
}

.status-badge.running .status-dot {
    background: #3fb950;
    box-shadow: 0 0 10px #3fb950;
}

.status-badge.offline .status-dot {
    background: #f85149;
    box-shadow: 0 0 10px #f85149;
}

.status-badge.starting .status-dot {
    background: #d29922;
    box-shadow: 0 0 10px #d29922;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    background: #161b22;
    border-bottom: 1px solid #21262d;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.topbar h1 {
    color: #c9d1d9;
    font-size: 1.5em;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #8b949e;
    font-size: 0.9em;
    position: relative;
}

.user-menu {
    position: relative;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
    font-weight: 500;
}

.user-menu-button:hover {
    background: #21262d;
    border-color: #58a6ff;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.user-menu-dropdown.active {
    display: block;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #c9d1d9;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border-bottom: 1px solid #21262d;
}

.user-menu-item:last-child {
    border-bottom: none;
}

.user-menu-item:hover {
    background: #21262d;
    color: #58a6ff;
}

.user-menu-item.danger:hover {
    background: #da3633;
    color: white;
}

.topbar-actions #logoutBtn {
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
    font-weight: 500;
}

.topbar-actions #logoutBtn:hover {
    background: #da3633;
    border-color: #da3633;
    color: white;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Pages */
.page {
    display: none;
    overflow-y: auto;
    height: 100%;
}

.page.active {
    display: flex;
    flex-direction: column;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: #30363d;
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2em;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d1117;
    border-radius: 10px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: #8b949e;
    font-size: 0.85em;
    margin-bottom: 5px;
}

.stat-value {
    color: #c9d1d9;
    font-size: 1.3em;
    font-weight: 700;
}

/* Card */
.card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.card.full-height {
    height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid #21262d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    color: #c9d1d9;
    font-size: 1.1em;
    font-weight: 600;
}

/* Buttons */
.button-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 25px;
}

.control-btn {
    padding: 20px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #0d1117;
}

.control-btn:hover {
    transform: translateY(-2px);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.start-btn {
    border-color: #3fb950;
    color: #3fb950;
}

.start-btn:hover {
    background: rgba(63, 185, 80, 0.1);
    box-shadow: 0 4px 15px rgba(63, 185, 80, 0.3);
}

.restart-btn {
    border-color: #1f6feb;
    color: #1f6feb;
}

.restart-btn:hover {
    background: rgba(31, 111, 235, 0.1);
    box-shadow: 0 4px 15px rgba(31, 111, 235, 0.3);
}

.stop-btn {
    border-color: #d29922;
    color: #d29922;
}

.stop-btn:hover {
    background: rgba(210, 153, 34, 0.1);
    box-shadow: 0 4px 15px rgba(210, 153, 34, 0.3);
}

.kill-btn {
    border-color: #f85149;
    color: #f85149;
}

.kill-btn:hover {
    background: rgba(248, 81, 73, 0.1);
    box-shadow: 0 4px 15px rgba(248, 81, 73, 0.3);
}

.btn-primary {
    padding: 10px 20px;
    background: #1f6feb;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #1a5cd7;
}

.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    color: #58a6ff;
    border: 1px solid #21262d;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #21262d;
    border-color: #30363d;
}

.icon {
    font-size: 1.8em;
}

/* Console */
.console-output {
    background: #0d1117;
    padding: 20px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    overflow-y: auto;
    flex: 1;
    border-bottom: 1px solid #21262d;
}

.console-line {
    color: #79c0ff;
    margin: 3px 0;
    line-height: 1.6;
}

.console-line.error {
    color: #ff7b72;
}

.console-line.warning {
    color: #d29922;
}

.console-line.info {
    color: #58a6ff;
}

.console-input {
    display: flex;
    gap: 10px;
    padding: 20px 25px;
    background: #161b22;
}

.console-input input {
    flex: 1;
    padding: 12px 15px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #79c0ff;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.console-input input:focus {
    outline: none;
    border-color: #58a6ff;
}

/* File Browser */
.breadcrumb {
    background: #0d1117;
    padding: 12px 25px;
    border-bottom: 1px solid #21262d;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    color: #8b949e;
}

.file-list {
    overflow-y: auto;
    flex: 1;
    position: relative;
}

.drag-drop-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(48, 54, 61, 0.95);
    border: 3px dashed #58a6ff;
    border-radius: 8px;
    z-index: 100;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drag-drop-content {
    text-align: center;
    color: #58a6ff;
}

.drag-drop-content p {
    font-size: 1.2em;
    margin-top: 10px;
    font-weight: 500;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    border-bottom: 1px solid #21262d;
    cursor: pointer;
    transition: background 0.2s;
}

.file-item:hover {
    background: #0d1117;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item.loading {
    justify-content: center;
    color: #8b949e;
    cursor: default;
}

.file-item.loading:hover {
    background: transparent;
}

.file-icon {
    margin-right: 12px;
    font-size: 1.1em;
}

.file-name {
    flex: 1;
    font-weight: 500;
}

.file-size {
    color: #8b949e;
    font-size: 0.85em;
    margin-left: 10px;
}

.file-item.directory .file-name {
    color: #58a6ff;
    font-weight: 600;
}

.file-actions {
    display: flex;
    gap: 8px;
    margin-left: 15px;
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #21262d;
}

/* Logs */
.log-output {
    max-height: 200px;
    overflow-y: auto;
    padding: 15px;
    background: #0d1117;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    padding: 25px;
}

@media (max-width: 1200px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

.chart-wrapper {
    background: #0d1117;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #30363d;
    min-height: 250px;
}

.chart-wrapper h4 {
    color: #58a6ff;
    margin: 0 0 15px 0;
    font-size: 0.95em;
    text-align: center;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 200px !important;
}

.log-output-full {
    overflow-y: auto;
    flex: 1;
    padding: 20px 25px;
}

.log-entry {
    padding: 12px 15px;
    margin: 8px 0;
    border-left: 3px solid #58a6ff;
    background: #0d1117;
    border-radius: 6px;
    font-size: 0.9em;
}

.log-entry .timestamp {
    color: #8b949e;
    font-size: 0.85em;
    margin-right: 10px;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.log-entry.success {
    border-left-color: #3fb950;
    background: rgba(63, 185, 80, 0.05);
}

.log-entry.error {
    border-left-color: #f85149;
    background: rgba(248, 81, 73, 0.05);
}

.log-entry.info {
    border-left-color: #1f6feb;
    background: rgba(31, 111, 235, 0.05);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0d1117;
}

::-webkit-scrollbar-thumb {
    background: #21262d;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #30363d;
}

/* File Editor */
.editor-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    margin: 0 25px 25px 25px;
}

.CodeMirror {
    height: 100% !important;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 14px;
}

.cm-s-monokai.CodeMirror {
    background: #0d1117 !important;
    color: #c9d1d9 !important;
}

.cm-s-monokai .CodeMirror-gutters {
    background: #161b22 !important;
    border-right: 1px solid #30363d !important;
}

.cm-s-monokai .CodeMirror-linenumber {
    color: #6e7681 !important;
}

.cm-s-monokai .CodeMirror-cursor {
    border-left: 1px solid #c9d1d9 !important;
}

.cm-s-monokai .CodeMirror-selected {
    background: #1f6feb44 !important;
}

.cm-s-monokai .CodeMirror-activeline-background {
    background: #161b2244 !important;
}

/* Mobile */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        padding: 15px 0;
    }
    
    .nav-menu {
        display: flex;
        overflow-x: auto;
        padding: 0 10px;
    }
    
    .nav-item {
        flex-direction: column;
        min-width: 80px;
        text-align: center;
        padding: 10px;
    }
    
    .nav-icon {
        margin: 0 0 5px 0;
    }
    
    .nav-text {
        font-size: 0.75em;
    }
    
    .button-group {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* Servers Page */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding: 20px;
}

.server-card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.server-card:hover {
    border-color: #58a6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.1);
}

.server-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #21262d;
}

.server-card-header h3 {
    color: #c9d1d9;
    font-size: 1.2em;
    margin: 0;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(248, 81, 73, 0.1);
}

.server-card-body {
    margin-bottom: 15px;
}

.server-info {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.9em;
}

.server-label {
    color: #8b949e;
}

.server-value {
    color: #c9d1d9;
    font-family: 'Courier New', monospace;
}

.server-card-footer {
    display: flex;
    justify-content: flex-end;
}

.loading-message, .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #8b949e;
    font-size: 1.1em;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    margin: 50px auto;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #21262d;
}

.modal-header h2 {
    margin: 0;
    color: #c9d1d9;
    font-size: 1.3em;
}

.modal-close {
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    color: #8b949e;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.form-group input {
    width: 100%;
    padding: 10px;
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 0.95em;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #58a6ff;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #21262d;
}