/* PTS Central Audio - design system
   Navy sidebar + diagonal blue/hex topbar, matching the PTS Central platform look. */

:root {
  --navy-950: #071427;
  --navy-900: #0a1c33;
  --navy-800: #12294a;
  --navy-700: #1b3a63;
  --blue-700: #144f9e;
  --blue-600: #1a68d1;
  --blue-500: #2f8cf0;
  --blue-400: #5aa8f5;
  --blue-100: #e8f2fe;
  --ink: #16233a;
  --muted: #64748b;
  --bg: #eef2f8;
  --card-bg: #ffffff;
  --border: #e3e8f0;
  --success: #17a673;
  --danger: #e5484d;
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); }

/* ---------- Shell layout ---------- */

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

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 55%, var(--navy-800) 100%);
  color: #cfe0f7;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 2px 0 18px rgba(4, 12, 26, 0.25);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.4rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-brand:hover { color: #fff; }

.brand-mark {
  display: inline-flex;
  color: var(--blue-400);
  filter: drop-shadow(0 0 6px rgba(90, 168, 245, 0.45));
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #eaf3ff;
}

.brand-name b {
  font-weight: 800;
  background: linear-gradient(90deg, #7fc0ff, #3a86f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: #7f97b8;
  margin-top: 0.15rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.9rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: #a9c0dd;
  font-weight: 500;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item .nav-icon {
  display: inline-flex;
  flex: none;
  width: 20px;
  height: 20px;
}

.nav-item .nav-icon svg { width: 100%; height: 100%; }

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(47, 140, 240, 0.22), rgba(47, 140, 240, 0.06));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--blue-400);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  color: #6d84a3;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 1100;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--navy-900);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.sidebar-toggle span {
  width: 18px;
  height: 2px;
  background: #cfe0f7;
  border-radius: 2px;
}

/* ---------- Topbar ---------- */

.topbar {
  position: relative;
  overflow: hidden;
  background: #fff;
  border-bottom: 1px solid var(--border);
  min-height: 96px;
}

.topbar-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 62%, var(--blue-600) 62.5%, var(--blue-500) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-opacity='0.16' d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15z'/%3E%3C/svg%3E");
  background-size: cover, 28px 49px;
}

.topbar-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  min-height: 96px;
}

.topbar-title h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem 0.35rem 0.35rem;
  box-shadow: 0 2px 10px rgba(15, 35, 65, 0.06);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  flex: none;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ink);
}

.user-role {
  font-size: 0.72rem;
  color: var(--muted);
}

.logout-form { display: inline-flex; }

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.logout-btn svg { width: 18px; height: 18px; }
.logout-btn:hover { color: var(--danger); border-color: #f3c6c8; background: #fff5f5; }

/* ---------- Content ---------- */

.content {
  flex: 1;
  padding: 1.75rem 2rem 2.5rem;
}

.app-footer {
  padding: 1rem 2rem;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

.content h1, .content h2 {
  color: var(--ink);
}

.page-subtitle {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1rem;
}

.page-lead {
  color: var(--muted);
  margin-top: -0.5rem;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 14px rgba(15, 35, 65, 0.05);
}

.card .card-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.card .display-4 {
  font-weight: 700;
  color: var(--ink);
}

/* ---------- Buttons ---------- */

.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: 0.86rem; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  border-color: var(--blue-700);
}

.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, var(--blue-600), var(--navy-800));
  border-color: var(--navy-800);
}

.btn-outline-primary {
  color: var(--blue-600);
  border-color: var(--blue-500);
}

.btn-outline-primary:hover {
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(47, 140, 240, 0.25);
}

/* ---------- Tables ---------- */

.table {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
}

.table thead th {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 2px solid var(--border);
  background: #f7f9fc;
}

.table td, .table th { vertical-align: middle; }

/* ---------- Badges ---------- */

.badge { border-radius: 999px; font-weight: 600; padding: 0.35em 0.75em; }
.bg-success { background-color: var(--success) !important; }
.bg-danger { background-color: var(--danger) !important; }

/* ---------- Forms ---------- */

.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
}

.form-control:focus, .form-select:focus {
  border-color: var(--blue-500);
}

.form-floating > label {
  color: var(--muted);
}

.form-check-input:checked {
  background-color: var(--blue-600);
  border-color: var(--blue-600);
}

/* ---------- Auth pages ---------- */

.auth-card {
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(15, 35, 65, 0.08);
  padding: 2rem;
  margin-top: 1.5rem;
}

.auth-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.auth-card .page-lead {
  font-size: 0.88rem;
  margin-top: 0;
  margin-bottom: 1.25rem;
}

/* ---------- Nav tabs ---------- */

.nav-tabs {
  border-bottom: 1px solid var(--border);
  gap: 0.25rem;
}

.nav-tabs .nav-link {
  border: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.6rem 1rem;
}

.nav-tabs .nav-link:hover {
  color: var(--blue-600);
  border-color: transparent;
  background: var(--blue-100);
}

.nav-tabs .nav-link.active {
  color: var(--blue-700);
  background: var(--blue-100);
  box-shadow: inset 0 -2px 0 var(--blue-600);
}

/* ---------- Alerts (bootstrap message boxes) ---------- */

.alert {
  border: none;
  border-left: 4px solid transparent;
  border-radius: var(--radius-sm);
}

.alert-danger {
  background: #fdecec;
  border-left-color: var(--danger);
  color: #9c2b2f;
}

.alert-info {
  background: var(--blue-100);
  border-left-color: var(--blue-500);
  color: var(--blue-700);
}

.alert-warning {
  background: #fef6e0;
  border-left-color: #e0a521;
  color: #8a600f;
}

/* ---------- Pagination ---------- */

.pagination { gap: 0.25rem; }

.page-link {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--blue-600);
  font-weight: 600;
  font-size: 0.85rem;
}

.page-link:hover {
  background: var(--blue-100);
  color: var(--blue-700);
}

.page-item.disabled .page-link {
  color: var(--muted);
  background: #f7f9fc;
}

/* ---------- List groups ---------- */

.list-group-item {
  border-color: var(--border);
  padding: 0.75rem 1rem;
}

.list-group-item:first-child { border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm); }
.list-group-item:last-child { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }

/* ---------- Detail (dl/dt/dd) views ---------- */

dl.row {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 0 0 1.5rem;
}

dl.row dt {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

dl.row dd {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0;
}

dl.row dt, dl.row dd {
  border-bottom: 1px solid var(--border);
}

dl.row dt:last-of-type, dl.row dd:last-of-type {
  border-bottom: none;
}

/* ---------- Code / raw blocks ---------- */

code {
  color: var(--blue-700);
  background: var(--blue-100);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
}

pre {
  background: #f7f9fc !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--ink);
}

pre code { background: none; padding: 0; }

h5 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 1.5rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .topbar-content {
    padding: 1.25rem 1.25rem 1.25rem 4.25rem;
  }

  .content {
    padding: 1.25rem;
  }
}
