:root {
    --bg: #1a1a2e;
    --bg-light: #16213e;
    --bg-card: #1f2940;
    --text: #e0e0e0;
    --text-muted: #8892a0;
    --accent: #4ecca3;
    --accent-hover: #3db88f;
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #2ecc71;
    --border: #2a3a5c;
    --sidebar-width: 220px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-light);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

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

.sidebar-header h2 {
    color: var(--accent);
    font-size: 1.2rem;
}

.nav-links {
    list-style: none;
    flex: 1;
    padding: 10px 0;
}

.nav-links a {
    display: block;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background: rgba(78, 204, 163, 0.1);
    border-right: 3px solid var(--accent);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
}

.logout-link:hover {
    color: var(--danger);
}

/* Main content */
.content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
}

/* Login page */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.login-container h1 {
    color: var(--accent);
    margin-bottom: 24px;
    font-size: 1.4rem;
    text-align: center;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    background: var(--border);
    color: var(--text);
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-success { background: var(--success); color: #000; }
.btn-full { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.card h3 {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
}

/* Flash messages */
.flash {
    padding: 10px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.flash.error { background: rgba(231, 76, 60, 0.2); border: 1px solid var(--danger); }
.flash.success { background: rgba(46, 204, 113, 0.2); border: 1px solid var(--success); }

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Status indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.dot.offline { background: var(--danger); }

.server-controls {
    display: flex;
    gap: 8px;
}

/* Stat bars */
.stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.stat-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Console */
.console-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
}

.console-output {
    flex: 1;
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    padding: 12px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

.console-line { white-space: pre-wrap; word-break: break-all; }
.console-line.command { color: var(--accent); }
.console-line.response { color: var(--warning); }

.console-input-form {
    display: flex;
    gap: 0;
}

.console-input-form input {
    flex: 1;
    border-radius: 0 0 0 8px;
    border-top: none;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.console-input-form .btn {
    border-radius: 0 0 8px 0;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
}

.tab:first-child { border-radius: 6px 0 0 6px; }
.tab:last-child { border-radius: 0 6px 6px 0; }
.tab.active { background: var(--accent); color: #000; border-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Player list */
.player-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.player-entry:last-child { border-bottom: none; }

.inline-form {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.inline-form input {
    flex: 1;
}

/* File browser */
.breadcrumb {
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.file-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.file-entry:last-child { border-bottom: none; }
.file-entry.dir { cursor: pointer; }
.file-entry.dir:hover { background: rgba(78, 204, 163, 0.05); }
.file-meta { margin-left: auto; color: var(--text-muted); font-size: 0.8rem; margin-right: 8px; }

/* Editor */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.editor-header span {
    font-family: monospace;
    color: var(--accent);
}

.editor-textarea {
    width: 100%;
    min-height: 500px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
    tab-size: 4;
}

/* Settings */
.setting-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-child { border-bottom: none; }

.setting-row label {
    min-width: 250px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.setting-row input,
.setting-row select {
    max-width: 300px;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* World cards */
.world-card { margin-bottom: 16px; }
.world-card.world-active { border-color: var(--success); }

.world-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.world-header h3 {
    margin-bottom: 0;
    font-size: 1rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
}

.world-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.world-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.world-meta-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.world-meta-value {
    font-size: 0.9rem;
    font-family: monospace;
    word-break: break-all;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 1000;
    animation: fadeIn 0.2s, fadeOut 0.3s 2.7s;
    max-width: 400px;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-header h2,
    .nav-links a span,
    .sidebar-footer { display: none; }
    .nav-links a { text-align: center; padding: 12px; font-size: 0.8rem; }
    .content { margin-left: 60px; padding: 15px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .setting-row { flex-direction: column; align-items: stretch; gap: 4px; }
    .setting-row label { min-width: 0; }
    .setting-row input, .setting-row select { max-width: 100%; }
}
