/* arcscan-ux.css — UX polish batch (v2.00.147)
 *
 * Ships:
 *   - Command palette modal (Cmd+K / Ctrl+K)
 *   - Toast notification container + Django-message compat
 *   - Skeleton loader shimmer
 *   - Keyboard shortcut help modal
 *   - Drag-and-drop upload highlight
 *
 * Styled to match the existing ArcScan dark "cyber" aesthetic
 * (--accent, --surface, --border, Barlow Condensed, Share Tech Mono).
 */

/* ═══════════════════════════════════════════════════════════════
 *  Command Palette
 * ═══════════════════════════════════════════════════════════════ */
.arc-palette-backdrop {
  position: fixed; inset: 0; z-index: 10050;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.arc-palette-backdrop.open { display: flex; animation: arcFadeIn .15s ease; }
@keyframes arcFadeIn { from { opacity: 0 } to { opacity: 1 } }

.arc-palette {
  width: min(640px, 92vw);
  background: var(--surface, #0f172a);
  border: 1px solid var(--accent, #00d4ff);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 24px var(--accent-soft-strong);
  animation: arcPopIn .18s ease;
}
@keyframes arcPopIn {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.arc-palette-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.arc-palette-input-wrap i { color: var(--accent, #00d4ff); font-size: .85rem; }
.arc-palette-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-bright, #fff);
  font-family: 'Barlow', 'Share Tech Mono', monospace;
  font-size: 1rem;
}
.arc-palette-input::placeholder { color: var(--text-dim, #64748b); }
.arc-palette-kbd {
  font-family: 'Share Tech Mono', monospace;
  font-size: .6rem;
  padding: 2px 6px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 4px;
  color: var(--text-dim, #64748b);
}

.arc-palette-list {
  max-height: 54vh;
  overflow-y: auto;
  padding: 6px 0;
}
.arc-palette-list:empty::after {
  content: 'No matches. Try "scan", "dashboard", "policies"…';
  display: block; text-align: center;
  padding: 28px 12px;
  color: var(--text-dim, #64748b);
  font-family: 'Share Tech Mono', monospace;
  font-size: .72rem;
}
.arc-palette-group {
  font-family: 'Share Tech Mono', monospace;
  font-size: .58rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-dim, #64748b);
  padding: 10px 18px 4px; margin: 0;
}
.arc-palette-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 18px;
  cursor: pointer;
  color: var(--text-bright, #fff);
  text-decoration: none;
  font-size: .88rem;
  border-left: 2px solid transparent;
}
.arc-palette-item:hover,
.arc-palette-item.active {
  background: var(--accent-soft);
  border-left-color: var(--accent, #00d4ff);
  color: var(--text-bright, #fff);
  text-decoration: none;
}
.arc-palette-item .arc-palette-icon {
  width: 22px; text-align: center;
  color: var(--accent, #00d4ff);
  font-size: .85rem;
}
.arc-palette-item .arc-palette-label { flex: 1; }
.arc-palette-item .arc-palette-hint {
  font-family: 'Share Tech Mono', monospace;
  font-size: .6rem;
  color: var(--text-dim, #64748b);
}

/* ═══════════════════════════════════════════════════════════════
 *  Toast Notifications
 * ═══════════════════════════════════════════════════════════════ */
.arc-toast-container {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 9998;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 360px;
  pointer-events: none;
}
.arc-toast {
  pointer-events: auto;
  background: var(--surface, #0f172a);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-left: 3px solid var(--accent, #00d4ff);
  border-radius: 8px;
  padding: 12px 16px 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 280px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: .82rem;
  color: var(--text-bright, #fff);
  animation: arcToastIn .28s cubic-bezier(.2,.8,.2,1);
}
.arc-toast.leaving { animation: arcToastOut .22s ease forwards; }
@keyframes arcToastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes arcToastOut {
  to { opacity: 0; transform: translateX(24px); }
}
.arc-toast.kind-success { border-left-color: var(--accent2, #00ff88); }
.arc-toast.kind-warn, .arc-toast.kind-warning { border-left-color: var(--warn, #ffaa00); }
.arc-toast.kind-error, .arc-toast.kind-danger { border-left-color: var(--danger, #ff3b5c); }
.arc-toast .arc-toast-icon { color: var(--accent, #00d4ff); flex-shrink: 0; margin-top: 1px; }
.arc-toast.kind-success .arc-toast-icon { color: var(--accent2, #00ff88); }
.arc-toast.kind-warn .arc-toast-icon,
.arc-toast.kind-warning .arc-toast-icon { color: var(--warn, #ffaa00); }
.arc-toast.kind-error .arc-toast-icon,
.arc-toast.kind-danger .arc-toast-icon { color: var(--danger, #ff3b5c); }
.arc-toast-body { flex: 1; line-height: 1.45; }
.arc-toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim, #64748b);
  font-size: .9rem; padding: 0; margin-left: 4px;
}
.arc-toast-close:hover { color: var(--text-bright, #fff); }

/* ═══════════════════════════════════════════════════════════════
 *  Skeleton Loader (for perceived performance)
 * ═══════════════════════════════════════════════════════════════ */
.skeleton {
  display: block;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.09) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: arcShimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
  min-height: 12px;
}
@keyframes arcShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-line { height: 10px; margin: 6px 0; }
.skeleton-line.w-sm { width: 30%; }
.skeleton-line.w-md { width: 60%; }
.skeleton-line.w-lg { width: 85%; }
.skeleton-row {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.05));
}
.skeleton-badge { width: 28px; height: 28px; border-radius: 6px; }

/* ═══════════════════════════════════════════════════════════════
 *  Keyboard Shortcut Help Modal
 * ═══════════════════════════════════════════════════════════════ */
.arc-kbd-help-backdrop {
  position: fixed; inset: 0; z-index: 10040;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
}
.arc-kbd-help-backdrop.open { display: flex; }
.arc-kbd-help {
  width: min(520px, 92vw);
  background: var(--surface, #0f172a);
  border: 1px solid var(--accent, #00d4ff);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.arc-kbd-help h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-bright, #fff);
  margin: 0 0 16px;
}
.arc-kbd-help-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border, rgba(255, 255, 255, 0.06));
  font-size: .82rem;
  color: var(--text-bright, #fff);
}
.arc-kbd-help-row:last-child { border-bottom: none; }
.arc-kbd-help-row .arc-kbd-keys { font-family: 'Share Tech Mono', monospace; }
.arc-kbd-help-row .arc-kbd-keys kbd {
  display: inline-block;
  padding: 2px 7px;
  margin: 0 2px;
  background: var(--surface2, #1a2436);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: .68rem;
  color: var(--accent, #00d4ff);
}

/* ═══════════════════════════════════════════════════════════════
 *  Drag-and-Drop Upload Zone (for scan.html)
 * ═══════════════════════════════════════════════════════════════ */
.arc-dropzone {
  position: relative;
  transition: background .18s ease, border-color .18s ease;
}
.arc-dropzone.arc-dragover {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent, #00d4ff);
  outline-offset: -4px;
}
.arc-dropzone.arc-dragover::after {
  content: '⤓ Drop to upload';
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent, #00d4ff);
  background: rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 10;
  border-radius: 8px;
}

/* ═══════════════════════════════════════════════════════════════
 *  KPI Info Tooltip (? badge)
 * ═══════════════════════════════════════════════════════════════ */
.arc-info {
  display: inline-flex;
  width: 14px; height: 14px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  color: var(--text-dim, #64748b);
  font-size: .58rem;
  font-family: 'Share Tech Mono', monospace;
  margin-left: 6px;
  cursor: help;
  transition: color .15s, border-color .15s;
  vertical-align: middle;
}
.arc-info:hover {
  color: var(--accent, #00d4ff);
  border-color: var(--accent, #00d4ff);
}

/* ═══════════════════════════════════════════════════════════════
 *  Light Theme (Batch 12/13)
 *
 *  Overrides the dark "cyber" palette when data-theme="light".
 *  The toggle is server-rendered via UserProfile.ui_theme so
 *  there's no FOUC — the <html> tag arrives with the right
 *  data-theme attribute on first paint.
 * ═══════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg:         #f5f7fa;
  --surface:    #ffffff;
  --surface2:   #f0f2f5;
  --border:     rgba(0, 0, 0, 0.08);
  --text-bright:#1a1a2e;
  --text:       #334155;
  --text-dim:   #64748b;
  --accent:     #1a73e8;
  --accent2:    #16a34a;
  --warn:       #d97706;
  --danger:     #dc2626;
  --green:      #16a34a;
  --green-dim:  rgba(22, 163, 74, 0.08);
  --mono:       'Share Tech Mono', monospace;
}
[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}
[data-theme="light"] nav.navbar {
  background: #ffffff;
  border-bottom-color: var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .nav-dropdown,
[data-theme="light"] .arc-palette,
[data-theme="light"] .arc-kbd-help,
[data-theme="light"] .arc-toast {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .stat-tile,
[data-theme="light"] .panel,
[data-theme="light"] .lp-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .stat-tile:hover,
[data-theme="light"] .lp-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.08);
}
[data-theme="light"] pre,
[data-theme="light"] code {
  background: #f8f9fc;
  color: #1a1a2e;
}
[data-theme="light"] .rtable th,
[data-theme="light"] .panel-hdr {
  background: #f5f7fa;
}
[data-theme="light"] .key-warning {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.25);
}
/* Ensure text contrast in the light palette search input */
[data-theme="light"] .arc-palette-input {
  color: #1a1a2e;
}
[data-theme="light"] .arc-palette-item:hover,
[data-theme="light"] .arc-palette-item.active {
  background: rgba(26, 115, 232, 0.06);
}
/* Skeleton shimmer — lighter gradient for light backgrounds */
[data-theme="light"] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.04) 100%
  );
  background-size: 200% 100%;
}
