/*
 * APLAID Trust — Vanta-inspired Theme
 *
 * Design principles (matched to Vanta dashboard reference):
 *   - Warm off-white page background
 *   - Flat white cards with very subtle borders, large radius, no shadows
 *   - Narrow dark charcoal sidebar (icon-only)
 *   - Clean minimal topbar with barely-visible border
 *   - Generous spacing and breathing room
 */

/* ==========================================================================
   1. Page Background — warm off-white
   ========================================================================== */

:root,
[data-bs-theme=light] {
  --vz-body-bg: #fff;
  --vz-body-bg-rgb: 255, 255, 255;
  --vz-light: #F5F5F5;
  --vz-light-rgb: 245, 245, 245;
  --vz-tertiary-bg: #F5F5F5;
  --vz-tertiary-bg-rgb: 245, 245, 245;
}


/* ==========================================================================
   2. Cards — flat, very subtle border, large radius, generous padding
   ========================================================================== */

.card {
  --vz-card-border-width: 1px;
  --vz-card-border-color: #EAEAE8;
  --vz-card-box-shadow: none;
  --vz-card-border-radius: 0.75rem;
  --vz-card-inner-border-radius: calc(0.75rem - 1px);
  --vz-card-spacer-y: 1.25rem;
  --vz-card-spacer-x: 1.25rem;
}

.card-header {
  background-color: transparent;
  border-bottom-color: #F2F0EE;
  padding: 1.25rem 1.25rem 0.75rem;
}

.card-footer {
  background-color: transparent;
  border-top-color: #F2F0EE;
}


/* ==========================================================================
   3. Sidebar — narrow, dark charcoal
   ========================================================================== */

:root {
  --vz-vertical-menu-width-sm: 56px;
}

/* Dark sidebar kept for reference / toggling */
:root[data-sidebar=dark] {
  --vz-vertical-menu-bg: #1B1B2A;
  --vz-vertical-menu-border: #1B1B2A;
  --vz-vertical-menu-item-color: rgba(255, 255, 255, 0.45);
  --vz-vertical-menu-item-hover-color: rgba(255, 255, 255, 0.85);
  --vz-vertical-menu-item-active-color: #fff;
  --vz-vertical-menu-item-bg: rgba(255, 255, 255, 0.06);
  --vz-vertical-menu-item-active-bg: rgba(255, 255, 255, 0.06);
  --vz-vertical-menu-sub-item-color: rgba(255, 255, 255, 0.35);
  --vz-vertical-menu-sub-item-hover-color: rgba(255, 255, 255, 0.85);
  --vz-vertical-menu-sub-item-active-color: #fff;
  --vz-vertical-menu-title-color: rgba(255, 255, 255, 0.20);
  --vz-vertical-menu-box-shadow: none;
  --vz-vertical-menu-dropdown-box-shadow: 0 4px 16px rgba(0, 0, 0, 0.20);
  --vz-twocolumn-menu-iconview-bg: #141422;
}

/* Light sidebar — clean, muted */
:root,
:root[data-sidebar=light] {
  --vz-vertical-menu-bg: #F7F7F7;
  --vz-vertical-menu-border: #ECECEC;
  --vz-vertical-menu-item-color: #6B6B7B;
  --vz-vertical-menu-item-hover-color: #1A1A2E;
  --vz-vertical-menu-item-active-color: #1A1A2E;
  --vz-vertical-menu-item-bg: transparent;
  --vz-vertical-menu-item-active-bg: rgba(0, 0, 0, 0.04);
  --vz-vertical-menu-sub-item-color: #8B8B9B;
  --vz-vertical-menu-sub-item-hover-color: #1A1A2E;
  --vz-vertical-menu-sub-item-active-color: #1A1A2E;
  --vz-vertical-menu-title-color: #ACACB8;
  --vz-vertical-menu-box-shadow: none;
  --vz-vertical-menu-dropdown-box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Sidebar border — thin right edge */
.navbar-menu {
  border-right: 1px solid #ECECEC !important;
}

/* Sidebar logo area — subtle separator */
.navbar-brand-box {
  border-bottom: 1px solid #ECECEC;
}

/* Sidebar sub-menu — remove dash prefix */
.navbar-menu .navbar-nav .nav-sm .nav-link:before {
  display: none;
}

/* Sidebar icons — thinner, lighter appearance */
.navbar-nav .menu-link > i,
.navbar-nav .nav-sm .nav-link > i {
  -webkit-text-stroke: 0px;
  font-weight: 100;
  opacity: 0.7;
}

.navbar-nav .menu-link:hover > i,
.navbar-nav .nav-sm .nav-link:hover > i,
.navbar-nav .menu-link.active > i,
.navbar-nav .nav-sm .nav-link.active > i {
  opacity: 1;
}


/* ==========================================================================
   4. Topbar — clean, barely-visible border
   ========================================================================== */

:root {
  --vz-header-bg: #fff;
  --vz-header-border: #EEECEA;
  --vz-header-item-color: #3D3D4E;
  --vz-header-item-sub-color: #9B9BA8;
  --vz-page-title-box-shadow: none;
  --vz-page-title-border: none;
}

#page-topbar {
  box-shadow: none !important;
  border-bottom: 1px solid #EEECEA;
}


/* ==========================================================================
   5. Typography
   ========================================================================== */

:root,
[data-bs-theme=light] {
  --vz-heading-color: #1A1A2E;
  --vz-body-color: #3D3D4E;
  --vz-body-color-rgb: 61, 61, 78;
}

/* Page title — larger, bolder like Vanta's "Dashboard" heading */
.page-title-box h4 {
  font-size: 1.35rem;
  font-weight: 600;
  color: #1A1A2E;
}

/* Card titles — medium weight */
.card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1A1A2E;
}


/* ==========================================================================
   6. Borders & Separators — neutral, very subtle
   ========================================================================== */

:root,
[data-bs-theme=light] {
  --vz-border-color: #EAEAE8;
  --vz-border-color-translucent: #DDDBD8;
}


/* ==========================================================================
   7. Spacing — generous gaps between cards (Vanta has airy layout)
   ========================================================================== */

.row {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 1.5rem;
}

/* Content area — extra breathing room */
.page-content .container-fluid {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (min-width: 1200px) {
  .page-content .container-fluid {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}


/* ==========================================================================
   8. Footer
   ========================================================================== */

:root {
  --vz-footer-bg: #fff;
  --vz-footer-color: #9B9BA8;
}


/* ==========================================================================
   9. Components — rounder, softer
   ========================================================================== */

:root {
  --vz-border-radius: 0.375rem;
  --vz-border-radius-sm: 0.25rem;
  --vz-border-radius-lg: 0.5rem;
}

.btn {
  border-radius: 0.5rem;
}

.btn-sm {
  border-radius: 0.375rem;
}

.badge {
  font-weight: 500;
  border-radius: 0.375rem;
}

.alert {
  border-radius: 0.75rem;
  border-width: 1px;
}

.progress {
  border-radius: 0.5rem;
}

.avatar-title {
  border-radius: 0.5rem;
}

.avatar-title.rounded-circle {
  border-radius: 50% !important;
}

.dropdown-menu {
  border-radius: 0.625rem;
  border-color: #EAEAE8;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.modal-content {
  border-radius: 0.75rem;
  border: 1px solid #EAEAE8;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
}

.form-control,
.form-select {
  border-radius: 0.5rem;
  border-color: #DDDBD8;
}

.form-control:focus,
.form-select:focus {
  border-color: #405189;
  box-shadow: 0 0 0 0.2rem rgba(64, 81, 137, 0.10);
}


/* ==========================================================================
   10. Tables — softer, cleaner
   ========================================================================== */

.table-light {
  --vz-table-bg: #FAFAF8;
  --vz-table-border-color: #EAEAE8;
}

.table > :not(caption) > * > * {
  border-bottom-color: #F2F0EE;
}

/* Table rows — slightly taller for breathing room */
.table > :not(caption) > * > * {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}


/* ==========================================================================
   11. Page Title — cleaner
   ========================================================================== */

.page-title-box {
  padding-bottom: 0.75rem;
  border-bottom: none;
}


/* ==========================================================================
   12. Soft buttons — borderless
   ========================================================================== */

.btn-soft-primary,
.btn-soft-secondary,
.btn-soft-success,
.btn-soft-info,
.btn-soft-warning,
.btn-soft-danger,
.btn-soft-dark {
  border: none;
}

/* Outline buttons — softer border */
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-info,
.btn-outline-warning,
.btn-outline-danger {
  border-width: 1px;
}


/* ==========================================================================
   13. Card hover — very subtle
   ========================================================================== */

.card-animate:hover {
  border-color: #D8D6D2;
  transform: translateY(-1px);
  transition: all 0.15s ease;
}


/* ==========================================================================
   14. Scrollbar — minimal
   ========================================================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.22);
}


/* ==========================================================================
   15. Notifications badge — match Vanta's pink/red style
   ========================================================================== */

.topbar-badge {
  border-radius: 0.375rem;
}


/* ==========================================================================
   16. Breadcrumb — lighter
   ========================================================================== */

.breadcrumb-item,
.breadcrumb-item.active {
  font-size: 0.8125rem;
  color: #9B9BA8;
}


/* ==========================================================================
   17. Auth pages — clean, white, minimal
   ========================================================================== */

/* Remove default coloured background and particles */
.auth-page-clean {
  background: #fff;
  padding-top: 2rem;
}

.auth-page-clean .auth-one-bg,
.auth-page-clean .auth-one-bg-position {
  display: none;
}

.auth-page-clean .auth-page-content {
  padding-top: 2rem;
}

/* Auth card — match Vanta card style */
.auth-page-clean .card {
  border: 1px solid #EAEAE8;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border-radius: 0.75rem;
}

/* Auth footer — blend with white bg */
.auth-page-clean .footer {
  background: transparent;
}


/* ==========================================================================
   18. Modals — clean, consistent with Vanta aesthetic
   ========================================================================== */

.modal-header {
  background-color: transparent;
  border-bottom: 1px solid #EAEAE8;
  padding: 1.25rem 1.25rem 1rem;
}

.modal-header .modal-title {
  font-weight: 600;
  font-size: 1rem;
  color: #1A1A2E;
}

.modal-footer {
  background-color: transparent;
  border-top: 1px solid #EAEAE8;
  padding: 1rem 1.25rem;
}

.modal-body {
  padding: 1.25rem;
}

/* Modal backdrop — slightly lighter */
.modal-backdrop.show {
  opacity: 0.4;
}


/* ==========================================================================
   19. Dashboard — KPI strip, chart cards, module stats, pipeline strip
   ========================================================================== */

/* KPI strip: column layout with separators */
.kpi-col {
  padding: 0.5rem 1rem;
}

.kpi-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9B9BA8;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1A1A2E;
}

/* Chart cards: borderless header, uppercase small title */
.chart-card-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9B9BA8;
  margin-bottom: 0;
}

/* Module stat labels: tiny uppercase muted */
.module-stat-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9B9BA8;
  margin-bottom: 0.25rem;
}

/* Dashboard alerts: compact single-line */
.dashboard-alert {
  font-size: 0.8125rem;
}

/* Pipeline strip: subtle background */
.pipeline-strip {
  background-color: #FAFAF8;
  border-color: #EAEAE8;
}

/* KPI strip responsive: stack on small screens */
@media (max-width: 767.98px) {
  .kpi-col {
    border-left: none !important;
    border-bottom: 1px solid #EAEAE8;
    padding: 0.75rem 1rem;
  }

  .kpi-col:last-child {
    border-bottom: none;
  }
}


/* ==========================================================================
   Empty state — shared partial templates/includes/_empty_state.html
   ========================================================================== */

.empty-state {
  padding: 3rem 1rem;
}

.empty-state-icon {
  font-size: 3rem;
  line-height: 1;
  display: inline-block;
  opacity: 0.8;
}

.empty-state h5 {
  color: #1A1A2E;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.875rem;
}


/* ==========================================================================
   Hero KPI card — used on CEO dashboard (templates/core/ceo_dashboard.html)
   ========================================================================== */

.hero-kpi {
  background: linear-gradient(135deg, #FFFFFF 0%, #FAFBFD 100%);
  border-color: #E0E5EE;
}

.hero-kpi .card-body {
  padding: 1.5rem;
}

.hero-kpi h3,
.hero-kpi h4 {
  color: #1A1A2E;
}

@media (max-width: 1199.98px) {
  .hero-kpi {
    margin-bottom: 1rem;
  }
}


/* ==========================================================================
   DPIA risk-factor table — grouped by Norma (P6 density tier)
   ========================================================================== */

#riskFactorsTable .risk-norma-header td {
  border-top: 1px solid #E0E5EE;
  border-bottom: 1px solid #E0E5EE;
  background-color: #FAFBFD !important;
}

#riskFactorsTable .risk-factor-row td {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

#riskFactorsTable .risk-factor-row:last-child td {
  border-bottom: none;
}


/* ==========================================================================
   APLAID type scale (P11)
   --------------------------------------------------------------------------
   Six tiers. Pick one per usage — no ad-hoc fs-XX in new code.

   Tier        Usage                       Size       fs-utility (reference)
   ─────────────────────────────────────────────────────────────────────────
   .text-h1    page titles, hero numbers   1.75rem    fs-4
   .text-h2    section headers, modal titles 1.375rem fs-3
   .text-h3    card titles, h5/h6 surfaces 1.125rem   fs-18
   .text-body  default body text           0.9375rem  fs-15
   .text-body-sm secondary text, descriptions 0.8125rem fs-13
   .text-caption labels, microcopy, meta   0.75rem    fs-12

   Line-heights are tuned per tier — don't override on individual elements.
   Weight comes from the surrounding component, not the type utility.

   Velzon's fs-XX utilities still work; the scale above is the *guidance*
   for new components. Existing pages can migrate incrementally.
   ========================================================================== */

.text-h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.text-h2 {
  font-size: 1.375rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

.text-h3 {
  font-size: 1.125rem;
  line-height: 1.35;
}

.text-body {
  font-size: 0.9375rem;
  line-height: 1.5;
}

.text-body-sm {
  font-size: 0.8125rem;
  line-height: 1.45;
}

.text-caption {
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.text-caption-upper {
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9B9BA8;
  font-weight: 500;
}


/* ==========================================================================
   Sidebar nav — visual separator between legacy stepper and v6 modules (P12)
   ========================================================================== */

#navbar-nav .nav-divider {
  list-style: none;
  margin: 0.75rem 1rem 0.5rem;
  border-top: 1px solid rgba(154, 156, 162, 0.18);
  padding: 0;
  height: 0;
}

/* Make the v6 section header read as distinct from the legacy section
   above it — a touch more breathing room and a subtle treatment. */
#navbar-nav .menu-title-v6 {
  padding-top: 0.25rem;
}

#navbar-nav .menu-title-v6 span {
  font-weight: 600;
}

/* Collapsed (icon-only) sidebar: hide the divider, which would clip
   against the icon column. */
[data-sidebar-size="sm"] #navbar-nav .nav-divider,
[data-sidebar-size="md"] #navbar-nav .nav-divider {
  display: none;
}


/* ==========================================================================
   Sidebar / nav inline-style → utility classes (P9 sweep, base.html)
   ========================================================================== */

/* Left-align logo lockup in the brand box (was `style="justify-content:
   flex-start; padding-left: 1.5rem;"` on .logo-dark / .logo-light). */
.aplaid-sidebar-logo {
  justify-content: flex-start;
  padding-left: 1.5rem;
}

/* Nested menu-title used for "Atajos M1 + M2" — smaller and indented than
   the top-level menu-titles. Was: style="font-size: 11px; padding-left: 30px;" */
#navbar-nav .menu-submenu-title {
  font-size: 11px;
  padding-left: 30px;
}

/* Locked nav links — block the click visually rather than via inline style.
   Was: style="pointer-events: none;" on individual <span class="nav-link">. */
.nav-link.is-locked {
  pointer-events: none;
  cursor: default;
}

/* Topbar search icon — Velzon's rule is `.app-search span.search-widget-icon`,
   but P10 (PR #49) switched the markup to <i> for the Remixicon-only invariant.
   The <i> no longer matched the span-restricted selector, so the absolute
   positioning was lost and the magnifier dropped below the input. Mirror the
   Velzon rule for <i> elements. */
.app-search i.search-widget-icon {
  position: absolute;
  z-index: 10;
  font-size: 18px;
  line-height: 38px;
  left: 13px;
  top: 0;
  color: var(--vz-header-item-sub-color);
}

/* RAT controller_role badges — paired with custom.min.css (SP-0b) */
.rat-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.4;
  vertical-align: middle;
}
.rat-role-controller { background-color: #1d4e6f; color: #ffffff; }
.rat-role-processor { background-color: #b45309; color: #ffffff; }
.rat-role-joint_controller { background-color: #6b21a8; color: #ffffff; }
.rat-role-pending { background-color: #e5e7eb; color: #4b5563; font-style: italic; }
.rat-role-justification {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
  max-width: 540px;
  line-height: 1.4;
}

/* === v6 modular sidebar + progress strip (paired with custom.min.css) === */
.module-nav-item .module-nav-link {
  font-weight: 500;
}
.module-nav-item.module-status-completed .module-nav-link {
  color: #2e7d32;
}
.module-nav-item.module-status-locked .module-nav-link {
  opacity: 0.7;
}
.module-nav-item .module-substeps {
  border-left: 2px solid #e5e7eb;
  margin-left: 14px;
  padding-left: 4px;
}
.module-nav-item.module-status-current .module-substeps {
  border-left-color: #1d4e6f;
}
.substep-link {
  display: block;
  padding: 3px 4px;
  border-radius: 3px;
  transition: background-color 0.12s ease;
}
.substep-link.substep-status-current {
  background-color: rgba(29, 78, 111, 0.06);
}
a.substep-link:hover {
  background-color: rgba(29, 78, 111, 0.1);
  text-decoration: none;
  color: #1d4e6f;
}
a.substep-link.substep-active {
  background-color: rgba(29, 78, 111, 0.14);
  font-weight: 600;
}
span.substep-link {
  cursor: default;
}
.module-landing-link {
  font-style: italic;
}

/* Progress strip — horizontal 5-segment bar at top of workflow pages */
.progress-strip {
  margin-bottom: 18px;
  padding: 6px 0;
  border-bottom: 1px solid #e5e7eb;
}
.progress-strip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.progress-strip-item {
  position: relative;
}
.progress-strip-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #4b5563;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.2;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.progress-strip-link:hover {
  border-color: #1d4e6f;
  color: #1d4e6f;
  text-decoration: none;
}
.progress-strip-icon {
  font-size: 16px;
  line-height: 1;
}
.progress-strip-label {
  font-weight: 600;
  flex: 1 1 auto;
}
.progress-strip-sub {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  color: #6b7280;
  margin-top: 2px;
}
.progress-strip-completed .progress-strip-link {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}
.progress-strip-completed .progress-strip-icon { color: #16a34a; }
.progress-strip-current .progress-strip-link {
  background: #eff6ff;
  border-color: #1d4e6f;
  color: #1d4e6f;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(29, 78, 111, 0.08);
}
.progress-strip-current .progress-strip-icon { color: #1d4e6f; }
.progress-strip-locked .progress-strip-link {
  color: #9ca3af;
}
.progress-strip-locked .progress-strip-icon { color: #d1d5db; }
@media (max-width: 768px) {
  .progress-strip-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .progress-strip-sub { display: none; }
}

/* Consultant context bar — banner sits between <header> and the layout
   wrapper, so by default it spans full viewport width and overlaps the
   sidebar. Indent it so it starts where .main-content starts, mirroring
   Velzon's vertical-layout sidebar size variants. */
.consultant-context-bar {
  margin-left: var(--vz-vertical-menu-width);
  transition: margin-left 0.1s ease-out;
}
[data-sidebar-size="md"] .consultant-context-bar {
  margin-left: var(--vz-vertical-menu-width-md);
}
[data-sidebar-size="sm"] .consultant-context-bar,
[data-sidebar-size="sm-hover"] .consultant-context-bar {
  margin-left: var(--vz-vertical-menu-width-sm);
}
@media (max-width: 767.98px) {
  .consultant-context-bar {
    margin-left: 0;
  }
}
