/**
 * Zettai TrustOps — Cockpit Chrome & Navigation Stylesheet
 * Keeps the authenticated cockpit sidebar dark and visually consistent.
 */

@import url('./tokens.css');

/* Sidebar container */
.cockpit-sidebar,
aside#cockpitSidebar,
aside.cockpit-sidebar {
  background: #071220 !important;
  background-image: linear-gradient(180deg, #0b1a2b 0%, #071220 58%, #06101d 100%) !important;
  color: #d7e3f1 !important;
  border-right: 1px solid rgba(148, 163, 184, 0.16) !important;
  box-shadow: 10px 0 28px -24px rgba(2, 6, 23, 0.9);
}

.cockpit-sidebar-top,
.cockpit-sidebar .cockpit-sidebar-top {
  order: 2 !important;
  margin-top: auto !important;
  background: rgba(7, 18, 32, 0.72) !important;
  border-top: 1px solid rgba(148, 163, 184, 0.16) !important;
  border-bottom: none !important;
  padding: 12px 14px !important;
  box-shadow: 0 -12px 24px -24px rgba(2, 6, 23, 0.9) !important;
}

/* User block in sidebar */
.cockpit-sidebar .cockpit-sidebar-user-avatar {
  background: rgba(14, 116, 144, 0.2) !important;
  color: #bae6fd !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  font-weight: 700 !important;
  font-size: 12px !important;
}

.cockpit-sidebar .cockpit-sidebar-user-name {
  color: #f8fafc !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  letter-spacing: -0.01em;
}

.cockpit-sidebar .cockpit-sidebar-user-role {
  color: #94a3b8 !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}

.cockpit-sidebar .cockpit-sidebar-toggle {
  color: #b6c7d8 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  background: rgba(15, 32, 51, 0.8) !important;
  border-radius: 8px !important;
}
.cockpit-sidebar .cockpit-sidebar-toggle:hover {
  color: #f8fafc !important;
  background: rgba(56, 189, 248, 0.12) !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
}

/* Nav groups */
.cockpit-sidebar .cockpit-nav-group-toggle {
  color: #8fa6bb !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  opacity: 1 !important;
}
.cockpit-sidebar .cockpit-nav-group-toggle:hover {
  color: #f8fafc !important;
}

/* Nav links / buttons */
.cockpit-sidebar .cockpit-nav-item,
.cockpit-sidebar .cockpit-nav-item.text-slate-400,
.cockpit-sidebar a.cockpit-nav-item,
.cockpit-sidebar button.cockpit-nav-item {
  color: #b6c7d8 !important;
  background: transparent !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  border-radius: 10px !important;
  transition: all 0.15s ease !important;
  position: relative !important;
}

.cockpit-sidebar .cockpit-nav-item:hover,
.cockpit-sidebar .cockpit-nav-item.hover\:text-white:hover,
.cockpit-sidebar .cockpit-nav-item[class*="hover:bg-slate"]:hover {
  color: #f8fafc !important;
  background: rgba(56, 189, 248, 0.1) !important;
}

/* Active navigation item with razor-sharp aligned indicator */
.cockpit-sidebar .cockpit-nav-item.is-active,
.cockpit-sidebar .cockpit-nav-item.cockpit-workspace-active,
.cockpit-sidebar .cockpit-nav-item[class*="bg-blue-600"] {
  color: #e0f2fe !important;
  background: linear-gradient(90deg, rgba(14, 116, 144, 0.4), rgba(37, 99, 235, 0.26)) !important;
  font-weight: 600 !important;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.34), 0 8px 18px -14px rgba(56, 189, 248, 0.9) !important;
}

.cockpit-sidebar .cockpit-nav-item.is-active::before,
.cockpit-sidebar .cockpit-nav-item.cockpit-workspace-active::before {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  top: 8px !important;
  bottom: 8px !important;
  width: 3.5px !important;
  height: auto !important;
  transform: none !important;
  border-radius: 0 4px 4px 0 !important;
  background: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4) !important;
}

.cockpit-main-surface {
  min-width: 0;
  overflow-x: hidden;
}

.cockpit-main-surface > #contentArea {
  min-width: 0;
  width: 100%;
}

.cockpit-sidebar .cockpit-nav-item i,
.cockpit-sidebar .cockpit-nav-item svg {
  color: inherit !important;
}

/* Global topbar header */
.global-nav-header,
header.global-nav-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04) !important;
  height: 52px !important;
  padding: 0 20px !important;
}

/* Workspace selector pills */
.workspace-toggle-pill,
.cockpit-workspace-nav a,
.cockpit-workspace-nav button {
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  transition: all 0.15s ease !important;
}

.workspace-toggle-pill.is-active,
.cockpit-workspace-nav .is-active {
  background: #eff6ff !important;
  color: #0284c7 !important;
  border: 1px solid #bfdbfe !important;
  font-weight: 600 !important;
}

/* Searchable Tenant Combobox */
.cockpit-tenant-combobox-trigger {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  border-radius: 8px !important;
  padding: 5px 10px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.cockpit-tenant-combobox-trigger:hover {
  border-color: #94a3b8 !important;
  background: #f8fafc !important;
}

.cockpit-tenant-combobox-panel {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05) !important;
}

.cockpit-tenant-combobox-search {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  border-radius: 6px !important;
}

.cockpit-tenant-combobox-list li {
  color: #334155 !important;
  font-size: 12.5px !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
}

.cockpit-tenant-combobox-list li:hover,
.cockpit-tenant-combobox-list li.is-highlighted {
  background: #eff6ff !important;
  color: #0284c7 !important;
}

.cockpit-tenant-combobox-list li.is-selected {
  background: #f0fdf4 !important;
  color: #047857 !important;
  font-weight: 700 !important;
}

/* Notification bell & action buttons */
.cockpit-notif-bell {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
}
.cockpit-notif-bell:hover {
  background: #f8fafc !important;
  color: #0284c7 !important;
  border-color: #cbd5e1 !important;
}

/* Modals that previously used dark slate bars */
.shadow-modal .bg-slate-900,
[id$="Modal"] .bg-slate-900,
.modal .bg-slate-900 {
  background: #ffffff !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

/* Light code & pre surfaces */
pre.bg-slate-900,
.bg-slate-900.font-mono,
textarea.bg-slate-900,
input.bg-slate-900 {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
}

#cmpEmbedCode {
  background: #f8fafc !important;
  color: #0f766e !important;
}

/* Table Action Buttons and Last Column (Prevent wrapping and irregular heights) */
.admin-row-actions {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.375rem !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

.enterprise-table th:last-child,
.enterprise-table td:last-child {
  white-space: nowrap !important;
  min-width: 0 !important;
  text-align: right !important;
}

/* Keep the dashboard visual cards independent instead of stretching every card
 * to the height of the activity timeline. */
.dashboard-viz-grid {
  align-items: start;
}

.dashboard-viz-grid #vizActivityTimeline {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* The controls table has dense, multi-line content. Let text wrap within a
 * predictable column layout so the evidence action cannot push the table wide. */
.controls-table {
  table-layout: fixed;
}

.controls-table th:nth-child(1),
.controls-table td:nth-child(1) { width: 34%; }
.controls-table th:nth-child(2),
.controls-table td:nth-child(2) { width: 22%; }
.controls-table th:nth-child(3),
.controls-table td:nth-child(3) { width: 20%; }
.controls-table th:nth-child(4),
.controls-table td:nth-child(4) { width: 12%; }
.controls-table th:nth-child(5),
.controls-table td:nth-child(5) { width: 12%; }

.controls-table td:nth-child(1),
.controls-table td:nth-child(2),
.controls-table td:nth-child(3) {
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.controls-table td:nth-child(4),
.controls-table td:nth-child(5) {
  white-space: nowrap !important;
}

.controls-table .controls-upload-btn {
  max-width: 100%;
  white-space: nowrap;
}

/* Evidence vault and notification log: stay inside the card, keep status color. */
#tab-evidence .saas-table-wrap,
#tab-notifications .saas-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
}

#tab-evidence .saas-table,
#tab-notifications .saas-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

#tab-evidence .saas-table td,
#tab-notifications .saas-table td {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tab-evidence .saas-table th:nth-child(1),
#tab-evidence .saas-table td:nth-child(1) { width: 42%; white-space: normal; }
#tab-evidence .saas-table th:nth-child(2),
#tab-evidence .saas-table td:nth-child(2) { width: 12%; }
#tab-evidence .saas-table th:nth-child(3),
#tab-evidence .saas-table td:nth-child(3) { width: 14%; }
#tab-evidence .saas-table th:nth-child(4),
#tab-evidence .saas-table td:nth-child(4) { width: 14%; overflow: visible; }
#tab-evidence .saas-table th:nth-child(5),
#tab-evidence .saas-table td:nth-child(5) { width: 18%; overflow: visible; white-space: normal; }

#tab-notifications .saas-table th:nth-child(1),
#tab-notifications .saas-table td:nth-child(1) { width: 72px; }
#tab-notifications .saas-table th:nth-child(2),
#tab-notifications .saas-table td:nth-child(2) { width: 132px; }
#tab-notifications .saas-table th:nth-child(3),
#tab-notifications .saas-table td:nth-child(3) { width: 22%; white-space: normal; }
#tab-notifications .saas-table th:nth-child(4),
#tab-notifications .saas-table td:nth-child(4) { width: 108px; }
#tab-notifications .saas-table th:nth-child(5),
#tab-notifications .saas-table td:nth-child(5) { width: auto; }
#tab-notifications .saas-table th:nth-child(6),
#tab-notifications .saas-table td:nth-child(6) { width: 124px; overflow: visible; }
#tab-notifications .saas-table th:nth-child(7),
#tab-notifications .saas-table td:nth-child(7) { width: 96px; overflow: visible; text-align: right; }

.evidence-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  max-width: 100%;
}

#tab-evidence .evidence-view-btn,
#tab-evidence .evidence-dl-btn,
#tab-notifications .notif-preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

#tab-evidence .evidence-view-btn {
  color: #ffffff !important;
  background: #005498 !important;
  border: 1px solid #004075 !important;
}
#tab-evidence .evidence-view-btn:hover {
  background: #1c70ac !important;
  transform: translateY(-1px);
}

#tab-evidence .evidence-dl-btn,
#tab-notifications .notif-preview-btn {
  color: #0c1b33 !important;
  background: #ffffff !important;
  border: 1px solid #b7c9dc !important;
}
#tab-evidence .evidence-dl-btn:hover,
#tab-notifications .notif-preview-btn:hover {
  color: #005498 !important;
  border-color: #1c70ac !important;
  background: #f3f8fc !important;
}

#tab-evidence tbody span[class*="bg-emerald"],
#tab-notifications .notif-badge-sent {
  background: #e8f7ee !important;
  color: #047857 !important;
  border-color: #86efac !important;
}
#tab-evidence tbody span[class*="bg-amber"] {
  background: #fff7e8 !important;
  color: #b45309 !important;
  border-color: #fcd34d !important;
}
#tab-evidence tbody span[class*="bg-rose"],
#tab-notifications .notif-badge-failed {
  background: #fef2f2 !important;
  color: #be123c !important;
  border-color: #fda4af !important;
}
#tab-notifications .notif-badge-recorded,
#tab-notifications .notif-badge-mock {
  background: #e8f1fa !important;
  color: #0c4a7a !important;
  border-color: #9ec4e4 !important;
}
#tab-notifications .notif-badge-sent > span { background: #059669 !important; }
#tab-notifications .notif-badge-failed > span { background: #e11d48 !important; }
#tab-notifications .notif-badge-recorded > span,
#tab-notifications .notif-badge-mock > span { background: #1c70ac !important; }

@media (prefers-reduced-motion: no-preference) {
  #tab-evidence tbody tr,
  #tab-notifications tbody tr {
    animation: cockpit-row-in 460ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  #tab-evidence tbody tr:nth-child(2),
  #tab-notifications tbody tr:nth-child(2) { animation-delay: 40ms; }
  #tab-evidence tbody tr:nth-child(3),
  #tab-notifications tbody tr:nth-child(3) { animation-delay: 80ms; }
  #tab-evidence tbody tr:nth-child(4),
  #tab-notifications tbody tr:nth-child(4) { animation-delay: 120ms; }
  #tab-evidence tbody tr:nth-child(5),
  #tab-notifications tbody tr:nth-child(5) { animation-delay: 160ms; }
  #tab-evidence tbody tr:nth-child(n + 6),
  #tab-notifications tbody tr:nth-child(n + 6) { animation-delay: 200ms; }

  #tab-notifications .notif-badge-sent > span {
    animation: cockpit-live 2.2s ease-out infinite;
  }
  #tab-evidence tbody tr:hover td,
  #tab-notifications tbody tr:hover td {
    background: #f4f8fc;
  }
}

@keyframes cockpit-row-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes cockpit-live {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.45); }
  70% { box-shadow: 0 0 0 5px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

@media (prefers-reduced-motion: reduce) {
  #tab-evidence tbody tr,
  #tab-notifications tbody tr,
  #tab-notifications .notif-badge-sent > span,
  #tab-evidence .evidence-view-btn,
  #tab-evidence .evidence-dl-btn {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

/* Security controls filters, badges & N/A row utilities (beyond purged CSS subset) */
#tab-matrix .min-w-\[10\.5rem\] { min-width: 10.5rem; }
#tab-matrix .min-w-\[9\.5rem\] { min-width: 9.5rem; }
#tab-matrix .bg-slate-50\/40 { background-color: rgba(248, 250, 252, 0.45); }
#tab-matrix .border-sky-200 { border-color: #bae6fd; }
#tab-matrix .shadow-xs { box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04); }

/* Policies list stat cards 4-column single row layout */
.policy-stat-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 0.75rem !important;
}
@media (max-width: 640px) {
  .policy-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 420px) {
  .policy-stat-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Consent & CMP sub-tab navigation */
.cmp-tablist {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid #e2e8f0;
  padding-inline: 0.125rem;
}
.cmp-tablist::-webkit-scrollbar {
  display: none;
}
.cmp-tab {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  min-block-size: 40px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: 0;
  border-radius: 0.5rem 0.5rem 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.cmp-tab:hover {
  color: #0f172a;
  background: #f1f5f9;
}
.cmp-tab:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}
.cmp-tab[aria-selected="true"] {
  color: #1d4ed8;
}
.cmp-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 2.5px solid #2563eb;
}
.cmp-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 1.25rem;
  padding: 0.0625rem 0.375rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}
.cmp-tab[aria-selected="true"] .cmp-tab-count {
  background: #dbeafe;
  color: #1d4ed8;
}
