@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #0a0a0a;
  --surface: rgba(23, 23, 23, 0.8);
  --surface-solid: #171717;
  --border: #262626;
  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-border: rgba(37, 99, 235, 0.2);
  --radius: 12px;
}

.light {
  --bg: #f8fafc;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-solid: #ffffff;
  --border: #e2e8f0;
  --text-1: #0f172a;
  --text-2: #64748b;
  --text-3: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

.hidden { display: none !important; }

/* ── Login ── */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.login-card {
  width: min(400px, 92vw);
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.login-card .logo { width: 140px; display: block; margin: 0 auto 24px; }

.login-card input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
}

.login-card input:focus { border-color: var(--accent); }

.login-card input::placeholder { color: var(--text-3); }

.login-card form { display: flex; flex-direction: column; gap: 12px; }

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
}

.btn-secondary:hover { border-color: var(--accent-border); color: var(--accent); }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 8px;
}

.btn-ghost:hover { color: var(--text-1); }

/* ── App Shell ── */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

/* ── Sidebar ── */

.sidebar {
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.3s, border 0.3s;
}

.sidebar .logo { width: 140px; display: block; margin: 0 auto 14px; }

.sidebar-section { padding: 10px 0; border-bottom: 1px solid var(--border); }

.user-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-block .info { flex: 1; min-width: 0; }
.user-block .name { font-size: 14px; font-weight: 600; color: var(--text-1); }
.user-block .role { font-size: 12px; color: var(--text-3); }

.user-block .logout-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: color 0.15s;
}

.user-block .logout-btn:hover { color: #ef4444; }

.user-block .logout-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ── Theme Toggle ── */

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.theme-row span { font-size: 14px; color: var(--text-2); }

.theme-switch {
  width: 56px; height: 28px;
  border-radius: 999px;
  background: var(--border);
  border: none;
  padding: 2px;
  cursor: pointer;
  position: relative;
  transition: background 0.3s;
}

.theme-switch .thumb {
  width: 24px; height: 24px;
  border-radius: 999px;
  background: var(--surface-solid);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(0);
}

.dark .theme-switch .thumb { transform: translateX(28px); color: var(--accent); }

/* ── Nav ── */

.nav-list { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--accent-soft);
  color: var(--text-1);
}

.nav-item.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Status bar ── */

.status-bar {
  margin-top: auto;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}

.status-row { display: flex; align-items: center; gap: 6px; }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--text-3);
}

.status-dot.online {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.status-text { font-size: 12px; color: var(--text-3); }

/* ── Content ── */

.content-area { padding: 28px 32px; overflow-y: auto; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h1 { font-size: 24px; font-weight: 700; }

/* ── Cards ── */

.card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: background 0.3s, border 0.3s;
}

.card h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.card .big-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-1);
}

.cards-row { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }

.section-gap { display: flex; flex-direction: column; gap: 20px; }

/* ── Form ── */

.form-block { display: flex; flex-direction: column; gap: 14px; }
.form-block label { font-size: 13px; font-weight: 500; color: var(--text-2); }

.form-block input,
.form-block textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
}

.form-block input:focus,
.form-block textarea:focus { border-color: var(--accent); }

input[type="file"] {
  font-family: inherit;
  font-size: 14px;
  color: var(--text-2);
}

input[type="file"]::file-selector-button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  margin-right: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}

/* ── Pre ── */

pre {
  white-space: pre-wrap;
  max-height: 400px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Badge ── */

.badge {
  display: inline-block;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

/* ── Lists ── */

ul { padding-left: 18px; }
ul li { font-size: 14px; color: var(--text-2); padding: 3px 0; }

/* ── Modal ── */

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 900;
  animation: fadeIn 0.15s;
}

.modal-box {
  width: min(420px, 92vw);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  animation: slideUp 0.2s;
}

.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-box p { font-size: 14px; color: var(--text-2); margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Toast ── */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: slideIn 0.25s, fadeOut 0.3s 2s forwards;
  pointer-events: auto;
}

.toast-item.success { border-left: 3px solid #22c55e; }
.toast-item.error { border-left: 3px solid #ef4444; }
.toast-item.info { border-left: 3px solid var(--accent); }

@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(20px); } }

/* ── Responsive ── */

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -280px; z-index: 800; }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
}
