/* ===== Panopticore Admin Console Styles ===== */
/* Theme: Deep Navy + Gold (matches marketing site) */

:root {
  /* Palette */
  --c-bg: 10 22 40;
  --c-surface-1: 15 30 52;
  --c-surface-2: 20 38 64;
  --c-surface-3: 28 48 78;

  --c-border: 40 58 88;
  --c-border-strong: 60 82 116;

  --c-text: 240 238 232;
  --c-muted: 158 168 184;
  --c-faint: 118 132 152;

  --c-accent: 212 165 116;
  --c-accent-hover: 228 186 140;
  --c-on-accent: 20 14 8;

  /* Status colors */
  --c-success: 34 197 94;
  --c-warning: 234 179 8;
  --c-error: 239 68 68;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Shadows */
  --shadow-panel: 0 1px 0 rgb(var(--c-border) / 0.65), 0 18px 60px rgb(0 0 0 / 0.55);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
}

/* ===== Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: rgb(var(--c-text));
  background:
    radial-gradient(900px circle at 18% -10%, rgb(var(--c-accent) / 0.08), transparent 55%),
    radial-gradient(700px circle at 80% -20%, rgb(var(--c-accent) / 0.05), transparent 55%),
    linear-gradient(to bottom, rgb(var(--c-bg)), rgb(8 18 34));
  min-height: 100vh;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

::selection {
  background: rgb(var(--c-accent) / 0.30);
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  color: rgb(var(--c-text));
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem 0;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

p {
  color: rgb(var(--c-muted));
  margin: 0 0 1rem 0;
}

a {
  color: rgb(var(--c-accent));
  text-decoration: none;
  transition: color 0.2s ease-out;
}

a:hover {
  color: rgb(var(--c-accent-hover));
}

code, .mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  color: rgb(var(--c-text));
  background: rgb(var(--c-surface-1) / 0.65);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--c-border) / 0.7);
}

/* ===== Header ===== */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgb(var(--c-border));
}

header h1 {
  margin: 0;
}

header p {
  margin: 0.25rem 0 0 0;
  font-size: 0.875rem;
}

.session-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.session-actions form {
  margin: 0;
}

/* ===== Navigation ===== */
nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  margin-bottom: 1.5rem;
  background: rgb(var(--c-surface-1));
  border: 1px solid rgb(var(--c-border));
  border-radius: var(--radius-md);
}

nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  color: rgb(var(--c-muted));
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease-out;
}

nav a:hover {
  color: rgb(var(--c-text));
  background: rgb(var(--c-surface-2));
}

nav a.active {
  color: rgb(var(--c-on-accent));
  background: rgb(var(--c-accent));
}

/* ===== Panels / Cards ===== */
.panel {
  background: rgb(var(--c-surface-1));
  border: 1px solid rgb(var(--c-border));
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-panel);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgb(var(--c-border));
}

.panel-header h3 {
  margin: 0;
}

.panel-body {
  color: rgb(var(--c-muted));
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  position: sticky;
  top: 0;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: rgb(var(--c-surface-2));
  color: rgb(var(--c-text));
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgb(var(--c-border));
}

th:first-child {
  border-top-left-radius: var(--radius-sm);
}

th:last-child {
  border-top-right-radius: var(--radius-sm);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgb(var(--c-border) / 0.5);
  color: rgb(var(--c-muted));
}

tr:hover td {
  background: rgb(var(--c-surface-2) / 0.5);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Scrollable table container */
.table-container {
  overflow-x: auto;
  border: 1px solid rgb(var(--c-border));
  border-radius: var(--radius-md);
  background: rgb(var(--c-surface-1));
}

.table-container table {
  margin: 0;
}

/* ===== Buttons ===== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease-out;
}

/* Primary button (gold) */
button, .btn-primary {
  background: rgb(var(--c-accent));
  color: rgb(var(--c-on-accent));
}

button:hover, .btn-primary:hover {
  background: rgb(var(--c-accent-hover));
  transform: translateY(-1px);
}

button:active, .btn-primary:active {
  transform: translateY(0);
}

/* Secondary button (outline) */
.btn-secondary {
  background: transparent;
  color: rgb(var(--c-accent));
  border: 1px solid rgb(var(--c-accent));
}

.btn-secondary:hover {
  background: rgb(var(--c-accent) / 0.1);
}

/* Ghost button (subtle) */
.btn-ghost {
  background: transparent;
  color: rgb(var(--c-muted));
  border: 1px solid rgb(var(--c-border));
}

.btn-ghost:hover {
  color: rgb(var(--c-text));
  border-color: rgb(var(--c-border-strong));
  background: rgb(var(--c-surface-2));
}

/* Small button */
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
}

/* ===== Forms ===== */
label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(var(--c-text));
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: rgb(var(--c-text));
  background: rgb(var(--c-surface-2));
  border: 1px solid rgb(var(--c-border));
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgb(var(--c-accent));
  box-shadow: 0 0 0 3px rgb(var(--c-accent) / 0.15);
}

input::placeholder,
textarea::placeholder {
  color: rgb(var(--c-faint));
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239EA8B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Datetime-local picker styling */
input[type="datetime-local"] {
  cursor: pointer;
  color-scheme: dark;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(0.3) saturate(1.2) hue-rotate(10deg);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease-out;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
  background: rgb(var(--c-surface-3));
}

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

.form-inline {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-inline .form-row {
  margin-bottom: 0;
}

/* ===== Policy Effect Badges ===== */
.effect {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: var(--radius-sm);
}

.effect-allow {
  color: rgb(var(--c-success));
  background: rgb(var(--c-success) / 0.15);
}

.effect-block, .effect-deny {
  color: rgb(var(--c-error));
  background: rgb(var(--c-error) / 0.15);
}

.effect-warn {
  color: rgb(var(--c-warning));
  background: rgb(var(--c-warning) / 0.15);
}

.effect-require_approval, .effect-pending {
  color: rgb(var(--c-accent));
  background: rgb(var(--c-accent) / 0.15);
}

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.status-pending {
  color: rgb(var(--c-accent));
  background: rgb(var(--c-accent) / 0.15);
}

.status-approved {
  color: rgb(var(--c-success));
  background: rgb(var(--c-success) / 0.15);
}

.status-denied {
  color: rgb(var(--c-error));
  background: rgb(var(--c-error) / 0.15);
}

.status-expired {
  color: rgb(var(--c-faint));
  background: rgb(var(--c-surface-2));
}

/* ===== HTMX Loading States ===== */
.htmx-indicator {
  display: none;
  color: rgb(var(--c-muted));
  font-size: 0.875rem;
}

.htmx-request .htmx-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.htmx-request.htmx-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Pulse animation for loading */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Skeleton placeholder */
.skeleton {
  background: linear-gradient(90deg, rgb(var(--c-surface-2)) 25%, rgb(var(--c-surface-3)) 50%, rgb(var(--c-surface-2)) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Live Feed ===== */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: rgb(var(--c-success));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.live-indicator::before {
  content: "";
  width: 8px;
  height: 8px;
  background: rgb(var(--c-success));
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.feed-item {
  padding: 0.75rem;
  border-bottom: 1px solid rgb(var(--c-border) / 0.5);
  transition: background 0.15s ease-out;
}

.feed-item:hover {
  background: rgb(var(--c-surface-2) / 0.5);
}

.feed-item:last-child {
  border-bottom: none;
}

.feed-time {
  font-size: 0.75rem;
  color: rgb(var(--c-faint));
  font-family: "JetBrains Mono", monospace;
}

.feed-method {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  background: rgb(var(--c-surface-3));
  color: rgb(var(--c-text));
}

/* ===== Sections ===== */
section {
  margin-bottom: 2rem;
}

section > h2 {
  margin-bottom: 0.5rem;
}

section > p {
  margin-bottom: 1rem;
}

/* ===== Empty States ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: rgb(var(--c-muted));
}

.empty-state p {
  margin: 0;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: rgb(var(--c-surface-1));
  border: 1px solid rgb(var(--c-border));
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-panel);
}

.modal-header {
  margin-bottom: 1rem;
}

.modal-header h3 {
  margin: 0;
}

.modal-body {
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ===== Utilities ===== */
.text-muted { color: rgb(var(--c-muted)); }
.text-faint { color: rgb(var(--c-faint)); }
.text-accent { color: rgb(var(--c-accent)); }
.text-success { color: rgb(var(--c-success)); }
.text-warning { color: rgb(var(--c-warning)); }
.text-error { color: rgb(var(--c-error)); }

.font-mono { font-family: "JetBrains Mono", monospace; }
.font-semibold { font-weight: 600; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

/* ===== Custom Scrollbars ===== */
/* Minimal scrollbars - narrow and hidden until hover/scroll */

/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgb(var(--c-border) / 0);
  border-radius: 3px;
  transition: background 0.2s ease-out;
}

/* Show scrollbar on hover or when scrolling */
*:hover::-webkit-scrollbar-thumb,
*:focus::-webkit-scrollbar-thumb,
*:focus-within::-webkit-scrollbar-thumb {
  background: rgb(var(--c-border));
}

::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--c-border-strong));
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

*:hover,
*:focus,
*:focus-within {
  scrollbar-color: rgb(var(--c-border)) transparent;
}
