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

:root {
  --bg: #07070d;
  --bg-card: rgba(15, 15, 25, 0.85);
  --bg-input: rgba(20, 20, 40, 0.9);
  --accent: #8ba4d4;
  --accent-green: #4ade80;
  --accent-yellow: #fbbf24;
  --accent-red: #f87171;
  --text: #e2e8f0;
  --text-dim: #64748b;
  --border: rgba(255, 255, 255, 0.08);
  --glow: rgba(139, 164, 212, 0.15);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  background-image: linear-gradient(rgba(7, 7, 13, 0.92), rgba(7, 7, 13, 0.92)), url('bg.png');
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

/* LOGIN */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--bg-card); backdrop-filter: blur(20px); padding: 2.5rem; border-radius: 16px; width: 360px; text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,.6); border: 1px solid var(--border); }
.login-box h1 { margin-bottom: 0.5rem; font-size: 1.5rem; }
.login-box p { color: var(--text-dim); margin-bottom: 1.5rem; font-size: 0.9rem; }
.login-box input { width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,0.05); color: var(--text); font-size: 1rem; margin-bottom: 1rem; outline: none; }
.login-box input:focus { border-color: var(--accent); box-shadow: 0 0 12px var(--glow); }
.login-box button { width: 100%; padding: 0.75rem; border: none; border-radius: 8px; background: var(--accent); color: #0a0a15; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all .2s; }
.login-box button:hover { box-shadow: 0 0 20px var(--glow); opacity: 0.9; }
.login-error { color: var(--accent-red); font-size: 0.85rem; margin-top: 0.5rem; display: none; }

/* HEADER */
header { background: var(--bg-card); backdrop-filter: blur(20px); padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
header h1 { font-size: 1.2rem; }
header button { background: none; border: 1px solid var(--border); color: var(--text-dim); padding: 0.4rem 1rem; border-radius: 6px; cursor: pointer; font-size: 0.8rem; }
header button:hover { color: var(--text); border-color: var(--text-dim); }

/* MAIN */
main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* SECTIONS */
.section { margin-bottom: 2rem; }
.section-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); margin-bottom: 1rem; }

/* SERVER & PANEL ROW */
.server-panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .server-panel-row { grid-template-columns: 1fr; } }
.server-panel-left, .server-panel-right { min-width: 0; }

/* SERVER STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; }
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card { background: var(--bg-card); backdrop-filter: blur(12px); border-radius: 10px; padding: 1.2rem; text-align: center; border: 1px solid var(--border); }
.stat-card .stat-icon { font-size: 0.75rem; font-weight: 700; color: var(--text-dim); letter-spacing: 1px; margin-bottom: 0.3rem; }
.stat-card .stat-value { font-size: 1.4rem; font-weight: 700; }
.stat-card .stat-sub { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.3rem; }
.stat-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 0.5rem; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 2px; transition: width .5s; }

/* PANEL CARD */
.panel-card { background: var(--bg-card); backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; }
.panel-status { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; }
.panel-status-text { font-weight: 600; font-size: 0.95rem; }
.panel-stats-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.panel-stat { text-align: center; flex: 1; min-width: 50px; }
.panel-stat-val { display: block; font-size: 0.95rem; font-weight: 700; }
.panel-stat-lbl { display: block; font-size: 0.6rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.panel-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }
.panel-logs { display: none; margin-top: 0.8rem; }
.panel-logs.active { display: block; }
.panel-logs .log-output { max-height: 200px; }

/* HEALTH CHECKS */
.health-grid { display: flex; gap: 1rem; flex-wrap: wrap; }
.health-item { background: var(--bg-card); backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 1.2rem; display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; }
.health-dot.ok { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green), 0 0 16px rgba(74, 222, 128, 0.2); }
.health-dot.error, .health-dot.offline { background: var(--accent-red); }
.health-name { font-weight: 500; }
.health-latency { color: var(--text-dim); font-size: 0.8rem; }

/* BOT CARDS */
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1.5rem; }

.bot-card { background: var(--bg-card); backdrop-filter: blur(12px); border-radius: 12px; padding: 1.5rem; box-shadow: 0 4px 24px rgba(0,0,0,.4); border: 1px solid var(--border); border-left: 4px solid var(--border); transition: box-shadow .3s; }
.bot-card:hover { box-shadow: 0 4px 30px rgba(139, 164, 212, 0.1); }
.bot-card.online { border-left-color: var(--accent-green); }
.bot-card.stopped { border-left-color: var(--accent-red); }
.bot-card.errored { border-left-color: var(--accent-yellow); }

.bot-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.bot-header h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; }
.bot-pid { color: var(--text-dim); font-size: 0.75rem; }

.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--accent-green); box-shadow: 0 0 10px var(--accent-green), 0 0 20px rgba(74, 222, 128, 0.2); }
.status-dot.stopped { background: var(--accent-red); }
.status-dot.errored { background: var(--accent-yellow); }

.bot-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 1rem; }
.bot-stats .stat { text-align: center; padding: 0.4rem; background: rgba(255,255,255,0.03); border-radius: 6px; }
.bot-stats .stat-value { font-size: 0.95rem; font-weight: 700; }
.bot-stats .stat-label { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

.bot-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.btn { padding: 0.45rem 0.9rem; border: none; border-radius: 6px; cursor: pointer; font-size: 0.8rem; font-weight: 500; transition: opacity .2s; }
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-green { background: var(--accent-green); color: #0a0a15; }
.btn-red { background: var(--accent-red); color: #0a0a15; }
.btn-yellow { background: var(--accent-yellow); color: #0a0a15; }
.btn-blue { background: rgba(139, 164, 212, 0.12); color: var(--accent); border: 1px solid rgba(139, 164, 212, 0.2); }
.btn-blue:hover { background: rgba(139, 164, 212, 0.2); }

/* DISCORD INFO */
.discord-info { margin-bottom: 1rem; padding: 0.8rem; background: rgba(88,101,242,0.08); border-radius: 8px; font-size: 0.85rem; }
.discord-user { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-weight: 600; }
.bot-avatar { width: 28px; height: 28px; border-radius: 50%; }
.bot-avatar-placeholder { width: 28px; height: 28px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: var(--text-dim); }
.discord-username { font-size: 0.95rem; }
.discord-guilds, .discord-commands { margin-top: 0.4rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.discord-label { font-size: 0.75rem; color: var(--text-dim); font-weight: 500; }
.guild-tag { display: inline-flex; align-items: center; gap: 0.3rem; background: rgba(255,255,255,0.06); padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.8rem; }
.guild-icon { width: 16px; height: 16px; border-radius: 50%; }
.cmd-tag { background: rgba(88,101,242,0.15); color: #7289da; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-family: 'Consolas', monospace; }

/* CARD NAME EDIT */
.card-name { cursor: default; }
.rename-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.85rem; padding: 0 0.3rem; opacity: 0.4; transition: opacity .2s; }
.rename-btn:hover { opacity: 1; color: var(--text); }
.card-name-input { background: var(--bg-input); border: 1px solid var(--accent); color: var(--text); padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 1rem; font-weight: 700; width: 200px; outline: none; }

/* LOGS & UPTIME */
.logs-section, .uptime-section { background: rgba(0,0,0,.2); border-radius: 8px; padding: 1rem; margin-top: 1rem; display: none; }
.logs-section.active, .uptime-section.active { display: block; }
.logs-section h3, .uptime-section h3 { margin-bottom: 0.8rem; font-size: 0.9rem; }

.log-output { background: rgba(5, 5, 12, 0.8); border: 1px solid var(--border); border-radius: 6px; padding: 0.8rem; font-family: 'Consolas', 'Monaco', monospace; font-size: 0.75rem; line-height: 1.5; max-height: 350px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; color: #94a3b8; }

/* UPTIME CHART */
.uptime-bars { display: flex; height: 30px; gap: 1px; border-radius: 4px; overflow: hidden; }
.uptime-bar { flex: 1; min-width: 1px; }
.uptime-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-dim); margin-top: 0.3rem; }

/* MODALS */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-overlay.active { display: flex; }
.modal { background: rgba(12, 12, 22, 0.95); backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; width: 500px; max-width: 95vw; max-height: 80vh; overflow-y: auto; box-shadow: 0 16px 64px rgba(0,0,0,.7); }
.modal h2 { margin-bottom: 1.5rem; font-size: 1.1rem; }

.form-group { margin-bottom: 0.8rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.2rem; }
.form-group input { width: 100%; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-input); color: var(--text); font-size: 0.85rem; outline: none; }
.form-group input:focus { border-color: var(--accent); }

.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }

/* LOG TABLE */
.log-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.log-table th { text-align: left; padding: 0.5rem; color: var(--text-dim); font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.log-table td { padding: 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); }

/* GUIDE */
.guide-content h3 { font-size: 0.95rem; color: var(--accent); margin-bottom: 0.5rem; }
.guide-content code { background: var(--bg-input); padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.8rem; }
.guide-steps, .guide-list { padding-left: 1.2rem; font-size: 0.85rem; line-height: 2; color: var(--text); }
.guide-steps li, .guide-list li { margin-bottom: 0.2rem; }

/* TOAST */
.toast { position: fixed; bottom: 2rem; right: 2rem; padding: 0.8rem 1.5rem; border-radius: 8px; font-size: 0.85rem; z-index: 200; transition: opacity .3s; opacity: 0; }
.toast.show { opacity: 1; }
.toast.success { background: var(--accent-green); color: #0a0a15; box-shadow: 0 0 20px rgba(74, 222, 128, 0.3); }
.toast.error { background: var(--accent-red); color: #0a0a15; box-shadow: 0 0 20px rgba(248, 113, 113, 0.3); }
