/* ═══════════════════════════════════════════════════════════════════
   WoOOL — Modern Dark Navy Theme
   Premium SaaS admin dashboard — deep blue-navy design system
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────────── */
:root {
  /* Backgrounds — deep navy */
  --bg:            #0a0f1e;
  --bg-elevated:   #0e1529;
  --panel:         #111a2e;
  --panel-hover:   #162040;
  --surface:       #182344;

  /* Borders */
  --border:        #1c2a4a;
  --border-dim:    #151f38;
  --border-bright: #253660;

  /* Text */
  --text:          #e8ecf4;
  --text-secondary:#b0bdd0;
  --muted:         #6a7b96;

  /* Accent (blue) */
  --accent:        #3b82f6;
  --accent-hover:  #2563eb;
  --accent-dim:    rgba(59, 130, 246, 0.15);
  --accent-glow:   rgba(59, 130, 246, 0.20);
  --accent-solid:  #1d4ed8;

  /* Semantic */
  --success:       #22c55e;
  --success-dim:   rgba(34, 197, 94, 0.12);
  --danger:        #ef4444;
  --danger-dim:    rgba(239, 68, 68, 0.12);
  --ok:            #22c55e;
  --warn:          #f59e0b;
  --warn-dim:      rgba(245, 158, 11, 0.12);

  /* Radius */
  --radius-xs:     4px;
  --radius-sm:     6px;
  --radius-md:     8px;
  --radius-lg:     10px;
  --radius-pill:   100px;

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md:     0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg:     0 8px 30px rgba(0, 0, 0, 0.45);

  /* Transitions */
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --duration:      0.18s;
}

/* ── Reset & Base ───────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Monospace ──────────────────────────────────────────────────── */
.admin-log-view, .cfg-key, code {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 0.88em;
  color: var(--accent);
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e2e50; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2a3e65; }

/* ═══════════════════════════════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════════════════════════════ */
.mir-topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.mir-brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Layout ─────────────────────────────────────────────────────── */
.mir-layout {
  display: flex;
  min-height: calc(100vh - 48px);
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════ */
.mir-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 12px 0 0;
  overflow-y: auto;
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.mir-sidebar-nav {
  flex: 1;
}

.mir-sidebar-section {
  padding: 18px 16px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.mir-sidebar-section:first-child {
  padding-top: 6px;
}

.mir-sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 1px 8px;
  text-align: left;
  padding: 7px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 450;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
  border-left: none;
  line-height: 1.4;
}

.mir-sidebar-nav button:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.mir-sidebar-nav button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 550;
  border-left: none;
}

/* ── Sidebar Icons via CSS ──────────────────────────────────────── */
.mir-sidebar-nav button::before {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}
.mir-sidebar-nav button.active::before { opacity: 1; }

/* Server section */
.mir-sidebar-nav button[data-section="server"]::before        { content: "🖥"; }
.mir-sidebar-nav button[data-section="metrics"]::before       { content: "📊"; }
.mir-sidebar-nav button[data-section="security"]::before      { content: "🔒"; }
.mir-sidebar-nav button[data-section="server-config"]::before { content: "⚙️"; }
.mir-sidebar-nav button[data-section="system"]::before        { content: "💻"; }

/* Users section */
.mir-sidebar-nav button[data-section="accounts"]::before       { content: "👤"; }
.mir-sidebar-nav button[data-section="characters"]::before     { content: "⚔️"; }
.mir-sidebar-nav button[data-section="players-online"]::before { content: "🟢"; }
.mir-sidebar-nav button[data-section="guilds"]::before         { content: "🏰"; }
.mir-sidebar-nav button[data-section="market"]::before         { content: "🛒"; }

/* Database section */
.mir-sidebar-nav button[data-db-tab="items"]::before        { content: "📦"; }
.mir-sidebar-nav button[data-db-tab="monsters"]::before     { content: "🐉"; }
.mir-sidebar-nav button[data-section="magic"]::before       { content: "✨"; }
.mir-sidebar-nav button[data-section="map-editor"]::before  { content: "🗺️"; }
.mir-sidebar-nav button[data-section="npcs"]::before        { content: "🧑"; }
.mir-sidebar-nav button[data-db-tab="quests"]::before       { content: "📜"; }
.mir-sidebar-nav button[data-db-tab="drops"]::before        { content: "💧"; }
.mir-sidebar-nav button[data-db-tab="mapregions"]::before   { content: "📍"; }
.mir-sidebar-nav button[data-db-tab="movements"]::before    { content: "🔄"; }
.mir-sidebar-nav button[data-db-tab="npcpages"]::before     { content: "📄"; }
.mir-sidebar-nav button[data-section="warplan"]::before      { content: "⚔️"; }
.mir-sidebar-nav button[data-section="game-shop"]::before   { content: "🛍️"; }
.mir-sidebar-nav button[data-section="recipe"]::before      { content: "📋"; }

/* Assets section */
.mir-sidebar-nav button[data-section="library"]::before     { content: "📚"; }

/* QA section */
.mir-sidebar-nav button[data-section="data-files"]::before  { content: "📁"; }
.mir-sidebar-nav button[data-section="qa-maps"]::before     { content: "🗺️"; }

/* ── Sidebar Footer ─────────────────────────────────────────────── */
.mir-sidebar::after {
  content: "© 2026 WoOOL Admin";
  display: block;
  padding: 14px 16px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border-dim);
  flex-shrink: 0;
  margin-top: auto;
}

/* ═══════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════ */
.mir-main {
  flex: 1;
  padding: 24px 28px;
  overflow: auto;
  background: var(--bg);
}

/* ═══════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════ */
.mir-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.mir-card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 650;
  color: var(--text);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.mir-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

/* ── Section heading icons ──────────────────────────────────────── */
#section-server > .mir-card:first-child h2::before  { content: "🖥"; font-size: 18px; }
#section-server > .mir-card:nth-child(2) h3::before { content: "🔄"; font-size: 16px; }
#section-server > .mir-card:nth-child(3) h3::before { content: "📋"; font-size: 16px; }
#section-metrics h2::before      { content: "📊"; font-size: 18px; }
#section-security h2::before     { content: "🔒"; font-size: 18px; }
#section-server-config h2::before{ content: "⚙️"; font-size: 18px; }
#section-system h2::before       { content: "💻"; font-size: 18px; }
#section-accounts h2::before     { content: "👤"; font-size: 18px; }
#section-characters h2::before   { content: "⚔️"; font-size: 18px; }
#section-players-online h2::before { content: "🟢"; font-size: 18px; }
#section-guilds h2::before       { content: "🏰"; font-size: 18px; }
#section-market h2::before       { content: "🛒"; font-size: 18px; }
#section-database h2::before     { content: "📦"; font-size: 18px; }
#section-magic h2::before        { content: "✨"; font-size: 18px; }
#section-npcs h2::before         { content: "🧑"; font-size: 18px; }
#section-map-editor h2::before   { content: "🗺️"; font-size: 18px; }
#section-library h2::before      { content: "📚"; font-size: 18px; }
#section-game-shop h2::before    { content: "🛍️"; font-size: 18px; }
#section-recipe h2::before       { content: "📋"; font-size: 18px; }
#section-data-files h2::before   { content: "📁"; font-size: 18px; }
#section-qa-maps h2::before      { content: "🗺️"; font-size: 18px; }

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════ */
.mir-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
  margin-right: 0;
  margin-bottom: 0;
}

.mir-btn:hover {
  background: #1e3055;
  border-color: #354d78;
  color: var(--text);
}

.mir-btn:active {
  transform: scale(0.97);
}

.mir-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.mir-btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.mir-btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 600;
}

.mir-btn.danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* ── Colored action buttons with icons ──────────────────────────── */
#btnStartServer {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  font-weight: 600;
}
#btnStartServer::before { content: "▶"; margin-right: 2px; }
#btnStartServer:hover { background: #16a34a; border-color: #16a34a; }

#btnRebootServer::before { content: "↻"; font-size: 15px; margin-right: 2px; }
#btnStopServer {
  background: var(--danger);
  border-color: var(--danger);
}
#btnStopServer::before { content: "■"; margin-right: 2px; font-size: 10px; }

#btnRefreshServer::before { content: "↻"; font-size: 15px; margin-right: 2px; }

/* ── Stats Row ──────────────────────────────────────────────────── */
.mir-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  font-size: 13px;
}

.mir-stats span {
  background: transparent;
  padding: 10px 18px;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  border-radius: 0;
  margin-right: -1px;
  margin-bottom: -1px;
  text-align: center;
  min-width: 100px;
}

.mir-stats span:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.mir-stats span:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/* ── Muted Text ─────────────────────────────────────────────────── */
.mir-muted {
  color: var(--muted);
  font-size: 13px;
}

/* ── Section Visibility ─────────────────────────────────────────── */
.admin-section.hidden { display: none; }

/* ═══════════════════════════════════════════════════════════════════
   LOG VIEWER
   ═══════════════════════════════════════════════════════════════════ */
.admin-log-view {
  background: #060b18;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  height: 300px;
  overflow: auto;
  font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

/* ── Database Tabs ──────────────────────────────────────────────── */
.database-tabs button { margin-right: 6px; margin-bottom: 6px; }

/* ── Toolbar ────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
}

/* ── Grid Panel ─────────────────────────────────────────────────── */
.grid-panel {
  height: min(70vh, 640px);
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   MAP EDITOR
   ═══════════════════════════════════════════════════════════════════ */
.map-editor-layout {
  display: flex;
  gap: 20px;
  min-height: 400px;
}

.map-editor-sidebar {
  width: 220px;
  max-height: 60vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  background: var(--bg-elevated);
}

.map-editor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.map-editor-list li {
  padding: 6px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
  color: var(--text-secondary);
}

.map-editor-list li:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.map-editor-list li.selected {
  background: var(--accent-dim);
  color: var(--text);
}

/* ── Map Tab Panel ──────────────────────────────────────────────── */
.map-tab-panel { display: none; }
.map-tab-panel.active { display: block; }
.map-editor-tabs button { margin-right: 6px; margin-bottom: 8px; }

/* ═══════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════ */
.user-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.user-table th,
.user-table td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-dim);
}

.user-table th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.user-table th:first-child { border-top-left-radius: var(--radius-sm); }
.user-table th:last-child  { border-top-right-radius: var(--radius-sm); }

.user-table tbody tr {
  transition: background var(--duration) var(--ease);
}

.user-table tbody tr:hover {
  background: var(--panel-hover);
}

.user-table td { color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════════════════════════════ */
input[type="search"],
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  outline: none;
}

input[type="search"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

input[type="search"]::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

input[type="checkbox"] { accent-color: var(--accent); }

label { font-size: 13px; color: var(--text-secondary); }

/* ── Headings ───────────────────────────────────────────────────── */
h2 {
  font-size: 17px;
  font-weight: 650;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
}
