/* ProperStation Admin Panel — Phase 2 */

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

:root {
  --sidebar-width: 240px;
  --header-height: 60px;
  --color-bg:          #0f172a;
  --color-sidebar:     #1e293b;
  --color-sidebar-hover: #334155;
  --color-sidebar-active: #3b82f6;
  --color-header:      #1e293b;
  --color-border:      #334155;
  --color-text:        #e2e8f0;
  --color-text-muted:  #94a3b8;
  --color-accent:      #3b82f6;
  --color-accent-dark: #2563eb;
  --color-danger:      #ef4444;
  --color-success:     #22c55e;
  --color-warning:     #f59e0b;
  --color-card:        #1e293b;
  --color-input:       #0f172a;
  --radius:            6px;
  --shadow:            0 1px 3px rgba(0,0,0,.4);
}

html, body {
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Admin Shell ─────────────────────────────────────────────────────────── */

.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}

.sidebar-brand:hover { text-decoration: none; color: var(--color-accent); }

.sidebar-brand-icon {
  width: 28px; height: 28px;
  background: var(--color-accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.sidebar-section {
  padding: .75rem 1rem .25rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.sidebar-nav { flex: 1; padding: .5rem 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1.25rem;
  color: var(--color-text-muted);
  font-size: .875rem;
  border-radius: 0;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.sidebar-link:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
  text-decoration: none;
}

.sidebar-link.active {
  background: rgba(59,130,246,.15);
  color: var(--color-accent);
  border-right: 3px solid var(--color-accent);
}

.sidebar-icon { width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.sidebar-avatar {
  width: 32px; height: 32px;
  background: var(--color-accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: .8rem; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .7rem; color: var(--color-text-muted); text-transform: capitalize; }

/* ── Main content ─────────────────────────────────────────────────────────── */

.main-wrap {
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  flex: 1;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.admin-header {
  height: var(--header-height);
  background: var(--color-header);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky; top: 0; z-index: 50;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--color-text-muted);
  flex: 1;
}

.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-accent); text-decoration: none; }
.breadcrumbs-sep { opacity: .4; }
.breadcrumbs-current { color: var(--color-text); }

.header-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.header-logout {
  font-size: .8rem;
  color: var(--color-text-muted);
  padding: .35rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: background .15s, color .15s;
  text-decoration: none;
}

.header-logout:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
  text-decoration: none;
}

/* ── Page content ────────────────────────────────────────────────────────── */

.page-content {
  padding: 1.5rem;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: .5rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Stat cards ──────────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
  margin-bottom: .25rem;
}

.stat-label {
  font-size: .75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
}

.alert-error   { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.alert-warning { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); color: #fcd34d; }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-control {
  width: 100%;
  padding: .55rem .75rem;
  background: var(--color-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: .875rem;
  transition: border-color .15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}

.form-control::placeholder { color: var(--color-text-muted); opacity: .7; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); text-decoration: none; color: #fff; }

.btn-secondary {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover { background: var(--color-sidebar-hover); color: var(--color-text); text-decoration: none; }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { opacity: .85; text-decoration: none; color: #fff; }

/* ── Login page ──────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  background: var(--color-accent);
  border-radius: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: .5rem;
}

.login-logo h1 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.login-logo p  { font-size: .8rem; color: var(--color-text-muted); }

/* ── Role badge ──────────────────────────────────────────────────────────── */

.role-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: rgba(59,130,246,.15);
  color: var(--color-accent);
}

/* ── Grid helpers ────────────────────────────────────────────────────────── */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); }
  .main-wrap { margin-left: 0; }
}

.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: .8rem; }
