@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Dark Theme Palette */
  --bg-main: #020617;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --sidebar-hover: #1e293b;
  
  --card-bg: #1e293b;
  --panel-bg: #0f172a;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  
  --primary: #f97316;
  --primary-hover: #fb923c;
  --primary-dark: #ea580c;
  --primary-light: rgba(249, 115, 22, 0.15);
  
  --success: #10b981;
  --error: #ef4444;
  
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden; /* Prevent horizontal jitter */
}

/* Auth Pages & News Shell */
.shell {
  max-width: 500px;
  margin: 5rem auto;
  padding: 0 1.5rem;
}

.card {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  text-align: center;
  color: #fff;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card p {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.card a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* Base Dashboard Layout */
.dashboard-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: absolute; /* Ensures it locks to the viewport and doesn't "misscenter" */
  top: 0;
  left: 0;
}

/* Sidebar Styling */
.dashboard-sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 1.5rem 0;
  border-right: 1px solid var(--border);
}

.brand {
  padding: 0 1.5rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.125rem;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav-menu {
  flex: 1;
  padding: 0 0.75rem;
}

.nav-menu a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
  margin-bottom: 0.25rem;
  transition: all 0.2s;
}

.nav-menu a:hover {
  background-color: var(--sidebar-hover);
  color: #fff;
}

.nav-menu a.active {
  background-color: var(--primary);
  color: #fff;
}

.sidebar-footer {
  padding: 1.5rem 0.75rem 0.5rem;
  border-top: 1px solid var(--border);
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* Main Content Area */
.dashboard-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-header {
  height: 72px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  flex-shrink: 0;
}

.header-left h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
}

.header-left .muted {
  font-size: 0.8125rem;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-main);
  padding: 0.375rem 0.5rem 0.375rem 1rem;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.user-name {
  font-weight: 600;
  font-size: 0.8125rem;
  color: #fff;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 100px;
  background: #000;
  image-rendering: pixelated;
  border: 1px solid var(--border);
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  background-color: var(--bg-main);
}

/* Stats Widgets */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-widget {
  background: var(--card-bg);
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.stat-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.stat-body {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
}

.uuid-text code {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

.stat-action {
  margin-top: 0.5rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  width: fit-content;
}

.stat-action:hover {
  background: var(--sidebar-hover);
  border-color: var(--text-muted);
}

/* Content Grid */
.grid-layout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.full-width {
  grid-column: span 2;
}

.widget {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.widget-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.1);
}

.widget-header h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
}

/* Skin Preview */
.skin-display {
  padding: 1.5rem;
  display: flex;
  gap: 2rem;
  align-items: center;
}

.skin-card {
  background: var(--panel-bg);
  padding: 1rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.skin-img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

.skin-card .label {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile-actions {
  flex: 1;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-with-btn {
  display: flex;
  gap: 0.5rem;
}

input, select {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  color: #fff;
  outline: none;
  transition: all 0.2s;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: var(--primary-dark);
}

.divider {
  text-align: center;
  font-size: 0.625rem;
  font-weight: 800;
  color: var(--text-muted);
  margin: 1.25rem 0;
  position: relative;
}

.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}

.divider::before { left: 0; }
.divider::after { right: 0; }

.inline-form {
  padding: 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flex-grow { flex: 1; }

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

/* Alerts */
.notice {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.notice.ok { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.notice.error { background: rgba(239, 68, 68, 0.1); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Responsive */
@media (max-width: 1024px) {
  .grid-layout { grid-template-columns: 1fr; }
  .full-width { grid-column: span 1; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .dashboard-sidebar { width: 72px; }
  .brand span, .nav-menu a span, .logout-btn span { display: none; }
  .brand { padding: 0 0 2.5rem; justify-content: center; }
  .nav-menu { padding: 0 0.5rem; }
  .nav-menu a { justify-content: center; padding: 0.75rem; }
  .sidebar-footer { padding: 1rem 0.5rem; }
  .logout-btn { justify-content: center; padding: 0.75rem; }
  .stats-row { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .skin-display { flex-direction: column; }
}
