/* ════════════════════════════════════════════════════════════
   Capix MC — Panel de Control Minecraft
   v2.0 — Diseño Premium
   ════════════════════════════════════════════════════════════ */

:root {
  --bg: #07080a;
  --bg-elevated: #0d0f13;
  --bg-card: #111318;
  --bg-hover: #191b22;
  --bg-input: #0a0c10;
  --border: rgba(255,255,255,0.05);
  --border-light: rgba(255,255,255,0.1);
  --border-accent: rgba(204,0,0,0.25);
  --text: #e8e8ed;
  --text-secondary: rgba(255,255,255,0.55);
  --text-tertiary: rgba(255,255,255,0.25);
  --accent: #cc0000;
  --accent-hover: #e60000;
  --accent-glow: rgba(204,0,0,0.2);
  --accent-gradient: linear-gradient(135deg, #cc0000, #ff4600);
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.08);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245,158,11,0.08);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.08);
  --blue: #3b82f6;
  --blue-bg: rgba(59,130,246,0.08);
  --purple: #8b5cf6;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow: 0 4px 40px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.2);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --sidebar-width: 240px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.1); }

::selection { background: rgba(204,0,0,0.3); color: #fff; }

/* ════════════════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 100;
}
.login-screen::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(204,0,0,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.login-container {
  text-align: center; padding: 48px 40px; max-width: 380px; width: 100%;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.login-logo { 
  width: 72px; height: 72px; margin: 0 auto 20px; 
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-container h1 { 
  font-size: 24px; font-weight: 700; margin-bottom: 4px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-container p { color: var(--text-tertiary); font-size: 13px; margin-bottom: 28px; }
.login-input {
  width: 100%; padding: 14px 16px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
  font-size: 15px; outline: none; transition: var(--transition); text-align: center;
  font-family: var(--mono);
}
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.login-input::placeholder { color: var(--text-tertiary); }
.login-btn {
  display: block; width: 100%; padding: 14px; margin-top: 12px;
  background: var(--accent-gradient); color: #fff; border: none;
  border-radius: var(--radius); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  position: relative; overflow: hidden;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(204,0,0,0.3); }
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; display: none; }

/* ════════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════════ */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-width); background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden;
}
.sidebar-header {
  padding: 20px 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo { width: 32px; height: 32px; border-radius: 8px; }
.sidebar-title { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; }
.sidebar-sub { font-size: 9px; color: var(--text-tertiary); letter-spacing: 2px; text-transform: uppercase; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 18px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
  transition: var(--transition); border-left: 2px solid transparent;
  position: relative;
}
.nav-item:hover { color: var(--text); background: var(--bg-hover); }
.nav-item.active {
  color: #fff; background: rgba(204,0,0,0.06);
  border-left-color: var(--accent);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .5; }
.nav-item.active svg { opacity: 1; }
.nav-item:hover svg { opacity: .8; }
.nav-group-title {
  font-size: 9px; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 16px 16px 6px 18px;
  font-family: var(--mono);
}
.nav-item-mc {
  background: linear-gradient(90deg, rgba(204,0,0,0.04), transparent);
  border-left: 2px solid var(--accent); color: #fff !important; font-weight: 600;
}

.main-content {
  flex: 1; overflow-y: auto; padding: 24px 32px; position: relative;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.008) 0%, transparent 70%);
}

/* ════════════════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════════════════ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.topbar h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-status { 
  display: flex; align-items: center; gap: 6px; font-size: 11px; 
  color: var(--text-tertiary); padding: 6px 12px;
  background: var(--bg-elevated); border-radius: 20px;
  border: 1px solid var(--border);
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,0.3); }
.status-dot.offline { background: var(--red); }

.topbar-btn {
  padding: 7px 14px; font-size: 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition); font-weight: 500;
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }
.topbar-btn.logout { color: var(--red); }
.topbar-btn.logout:hover { background: var(--red-bg); border-color: rgba(239,68,68,0.2); }

/* ════════════════════════════════════════════════════════════
   SECTION
   ════════════════════════════════════════════════════════════ */
.section { display: none; }
.section.active { display: block; }
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.3px; }
.section-sub { color: var(--text-tertiary); font-size: 13px; margin-bottom: 20px; }

/* ════════════════════════════════════════════════════════════
   NETWORKS GRID
   ════════════════════════════════════════════════════════════ */
.networks-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.network-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; cursor: pointer;
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.network-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  opacity: 0; transition: var(--transition);
}
.network-card.online::before { background: var(--green); opacity: 1; }
.network-card.offline::before { background: var(--red); opacity: 1; }
.network-card:hover { 
  border-color: var(--border-light); transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.network-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.network-card h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.2px; }
.network-badge {
  font-size: 9px; padding: 3px 10px; border-radius: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
}
.network-badge.online { background: var(--green-bg); color: var(--green); }
.network-badge.offline { background: var(--red-bg); color: var(--red); }

.network-stats { display: flex; gap: 24px; }
.network-stat { text-align: center; }
.network-stat-value { font-size: 24px; font-weight: 700; letter-spacing: -1px; }
.network-stat-label { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

.network-servers { margin-top: 14px; }
.network-server-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; font-size: 12px; border-top: 1px solid var(--border);
}
.network-server-item:first-child { border-top: none; }
.server-indicator { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 8px; }

/* ════════════════════════════════════════════════════════════
   SERVER GRID
   ════════════════════════════════════════════════════════════ */
.server-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px;
}
.server-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; cursor: pointer;
  transition: var(--transition);
}
.server-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.server-card.online { border-top: 2px solid var(--green); }
.server-card.offline { border-top: 2px solid var(--red); }
.server-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.server-meta { font-size: 11px; color: var(--text-tertiary); margin-bottom: 12px; }
.server-stats { display: flex; gap: 20px; margin-bottom: 12px; }
.server-stat { text-align: center; }
.server-stat-value { font-size: 20px; font-weight: 700; }
.server-stat-label { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.server-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.server-action-btn {
  padding: 6px 12px; font-size: 11px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-secondary); cursor: pointer;
  transition: var(--transition); font-weight: 500;
}
.server-action-btn:hover { background: var(--bg-hover); color: var(--text); }
.server-action-btn.danger { color: var(--red); border-color: rgba(239,68,68,0.15); }
.server-action-btn.danger:hover { background: var(--red-bg); }

/* ════════════════════════════════════════════════════════════
   CHAT
   ════════════════════════════════════════════════════════════ */
.chat-container {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column; height: calc(100vh - 200px);
}
.chat-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-header h3 { font-size: 14px; font-weight: 600; }
.chat-messages { 
  flex: 1; overflow-y: auto; padding: 16px 20px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.005) 0%, transparent 70%);
}
.chat-msg {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 3px 0; font-size: 13px; animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg.staff { background: rgba(204,0,0,0.03); margin: 2px -20px; padding: 3px 20px; }
.chat-server { 
  font-size: 10px; color: var(--text-tertiary); padding: 1px 6px;
  border-radius: 4px; background: var(--bg-elevated); flex-shrink: 0; margin-top: 2px;
  border: 1px solid var(--border);
}
.chat-player { font-weight: 600; color: var(--text-secondary); flex-shrink: 0; }
.chat-player.staff { color: var(--accent); }
.chat-text { color: var(--text); word-break: break-word; }
.chat-time { font-size: 10px; color: var(--text-tertiary); margin-left: auto; flex-shrink: 0; font-family: var(--mono); }

.chat-input-wrap {
  display: flex; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--border); background: var(--bg-elevated);
}
.chat-input {
  flex: 1; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; outline: none;
  font-family: var(--mono); transition: var(--transition);
}
.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.chat-input::placeholder { color: var(--text-tertiary); }
.chat-send {
  padding: 10px 24px; background: var(--accent-gradient); color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.chat-send:hover { box-shadow: 0 4px 16px rgba(204,0,0,0.25); transform: translateY(-1px); }

/* ════════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════════ */
.players-table { width: 100%; border-collapse: collapse; }
.players-table th {
  text-align: left; padding: 10px 14px; font-size: 10px; font-weight: 700;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}
.players-table td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
.players-table tr:hover td { background: rgba(255,255,255,0.015); }
.search-bar {
  width: 100%; padding: 10px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 13px; outline: none; margin-bottom: 16px; transition: var(--transition);
}
.search-bar:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ════════════════════════════════════════════════════════════
   SANCTIONS
   ════════════════════════════════════════════════════════════ */
.sanctions-toolbar {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.add-sanction-btn {
  padding: 10px 20px; background: var(--accent-gradient); color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.add-sanction-btn:hover { box-shadow: 0 4px 16px rgba(204,0,0,0.25); }
.sanction-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.sanction-badge.ban { background: var(--red-bg); color: var(--red); }
.sanction-badge.mute { background: var(--yellow-bg); color: var(--yellow); }
.sanction-badge.warn { background: var(--blue-bg); color: var(--blue); }
.sanction-badge.kick { background: var(--purple-bg, rgba(139,92,246,0.1)); color: var(--purple); }

/* ════════════════════════════════════════════════════════════
   METRICS
   ════════════════════════════════════════════════════════════ */
.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; text-align: center;
  transition: var(--transition);
}
.metric-card:hover { border-color: var(--border-light); }
.metric-card h4 { 
  font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; 
  letter-spacing: 1px; margin-bottom: 6px; font-weight: 700;
}
.metric-value { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.metric-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* ════════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-xl); padding: 28px;
  width: 90%; max-width: 480px; box-shadow: var(--shadow);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.modal input, .modal select {
  width: 100%; padding: 12px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 13px; outline: none; margin-bottom: 16px; transition: var(--transition);
}
.modal input:focus, .modal select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ════════════════════════════════════════════════════════════
   EMPTY / LOADING
   ════════════════════════════════════════════════════════════ */
.loading { text-align: center; padding: 60px 20px; color: var(--text-tertiary); font-size: 13px; }
.empty-state { 
  text-align: center; padding: 60px 20px; color: var(--text-tertiary); 
  font-size: 14px; line-height: 1.7;
}
.empty-state strong { color: var(--text); }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 200px; }
  .main-content { padding: 20px; }
}
@media (max-width: 768px) {
  .sidebar { width: 180px; }
  .main-content { padding: 16px; }
  .networks-grid { grid-template-columns: 1fr; }
  .server-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr; }
  .topbar h2 { font-size: 16px; }
  .network-stat-value { font-size: 20px; }
}
