/* 
 * pls-modal.css
 * Shared modal styling patterns for Pulse modals
 * 
 * Purpose: Centralized reusable styles for all modal layouts
 * 
 * Design Pattern: Single Source of Truth for Modal UI
 * Benefits: DRY principle, consistent styling across all modals, easy maintenance
/* =============================================================================

/* -----------------------------------------------------------------------------
Modal Design Tokens
----------------------------------------------------------------------------- */
:root {
  --pls-modal-max-height: 340px;
  --pls-modal-item-height: 40px;
}

/* -----------------------------------------------------------------------------
MODAL BASE (layout only)
----------------------------------------------------------------------------- */
.pls-modal .ant-modal-content {
  border-radius: 4px;
  background-color: var(--pl-neutral-bg-color-bg-container);
}

/* AntD's header/footer paint their own backgrounds with AntD's default radius,
   squaring off the content's rounded corners — keep their radii in sync. */
.pls-modal .ant-modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--pl-neutral-border-color-border-secondary);
  border-radius: 4px 4px 0 0;
}

/* .pls-modal .ant-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
} */

.pls-modal .ant-modal-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--pl-neutral-border-color-border-secondary);
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  border-radius: 0 0 4px 4px;
}

/* Uniform 4px radius policy (design review 27.07.26): AntD controls inside
   Pulse modals keep the AntD default (~2px) otherwise. */
.pls-modal .ant-btn,
.pls-modal .ant-input,
.pls-modal .ant-input-affix-wrapper,
.pls-modal .ant-select-selector,
.pls-modal .ant-picker {
  border-radius: 4px;
}


/* -----------------------------------------------------------------------------
MODAL DIALOG (semantic content wrapper)
----------------------------------------------------------------------------- */
.pls-modal__dialog {
  display: flex;
  flex-direction: column;
}

.pls-modal .ant-modal-body > .pls-modal__dialog {
  display: flex;
  flex-direction: column;
}


/* -----------------------------------------------------------------------------
MODAL TITLE
----------------------------------------------------------------------------- */
.pls-modal .ant-modal-title {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  color: var(--pl-neutral-text-color-text);
}

/* =============================================================================
MODAL HEADER BAR – Search + Primary Action
============================================================================= */

.pls-modal .pls-modal__header-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pls-modal .pls-modal__header-bar > .ant-btn,
.pls-modal .pls-modal__header-bar > button {
  flex: none;
  white-space: nowrap;
}

/* -----------------------------------------------------------------------------
SECTION HEADERS / LABELS
----------------------------------------------------------------------------- */
.pls-modal__section-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--pl-neutral-text-color-text-secondary);
  /* 8px horizontal to line the heading's left edge up with the list rows: every modal that
     uses this heading now indents its rows by 8px (global .pls-modal__list-item and .member-item). */
  padding: 4px 8px;
  margin: 0 0 4px;
}

/* Groups inside a modal list (assignable / project-wide, members-on-card / -task, …). */
.pls-modal__section {
  display: flex;
  flex-direction: column;
}

.pls-modal__section + .pls-modal__section {
  margin-top: 8px;
}

.pls-modal__section-divider {
  height: 1px;
  margin: 8px 12px;
  background-color: var(--pl-neutral-border-color-border-secondary);
}

/* Explanatory note under a section heading (e.g. the project-wide custom-fields note).
   Matches the classic PLANTA data-field description style (Globale Einstellungen): muted
   grey text, no icon, no box — description tier token. Aligns with the heading + rows
   (12px from the list edge). */
.pls-modal__section-hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--pl-neutral-text-color-text-tertiary);
  padding: 0 8px;
  margin: 0 0 8px;
}

.pls-modal__section-hint-link {
  color: var(--pl-semantic-link-color-link, #0070B5);
  text-decoration: none;
}

.pls-modal__section-hint-link:hover {
  color: var(--pl-semantic-link-color-link-hover, #009ADB);
  text-decoration: underline;
}

.pls-modal .ant-form-item-label > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pl-neutral-text-color-text-secondary);
  height: auto;
}

/* required marker */
.pls-modal
  .ant-form-item-label
  > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
  display: none;
}

.pls-modal
  .ant-form-item-label
  > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::after {
  content: " *";
  font-weight: 600;
  color: var(--pl-neutral-text-color-text-secondary);
  margin: 0 0 0 1px;
}

/* -----------------------------------------------------------------------------
FORM SPACING
----------------------------------------------------------------------------- */
.pls-modal .ant-form-item {
  margin-bottom: 16px;
}

.pls-modal .ant-form-item:last-child {
  margin-bottom: 0;
}

/* -----------------------------------------------------------------------------
FORM LAYOUT
----------------------------------------------------------------------------- */

/* Form container */
.pls-modal__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Individual form field */
.pls-modal__form-field {
  display: flex;
  flex-direction: column;
  gap: 6px; /* space between label and control */
}

/* Form labels */
.pls-modal__form-field > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pl-neutral-text-color-text-secondary);
  margin: 0;
}


/* -----------------------------------------------------------------------------
SEARCH
----------------------------------------------------------------------------- */
.pls-modal__search {
  margin-bottom: 14px;
}

/* only flexible if used in header bar */
.pls-modal__header-bar .pls-modal__search {
  flex: 1;
  min-width: 0;
}

.pls-modal .ant-input-affix-wrapper {
  height: 32px;
  border-radius: 4px;
}

/* Inside AntDesign Form the selector needs higher specificity */
.pls-modal .ant-form .ant-input-affix-wrapper,
.pls-modal .ant-form-item .ant-input-affix-wrapper {
  height: 32px;
  border-radius: 4px;
}

.pls-modal .ant-input {
  font-size: 14px;
}

/* -----------------------------------------------------------------------------
FORM CONTROLS 
----------------------------------------------------------------------------- */
.pls-modal__input,
.pls-modal__textarea,
.pls-modal__select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 14px;
  background-color: var(--pl-neutral-bg-color-bg-container);
  border: 1px solid var(--pl-neutral-border-color-border);
}


/* =============================================================================
Modal input placeholder styling
============================================================================= */

.pls-modal .ant-input::placeholder,
.pls-modal .ant-input-affix-wrapper input::placeholder,
.pls-modal .pls-modal__textarea::placeholder {
  font-size: 14px;
  color: var(--pl-neutral-text-color-text-secondary);
}
/* hover */
.pls-modal .pls-modal__input:hover:not(:disabled),
.pls-modal .pls-modal__select:hover:not(:disabled),
.pls-modal .pls-modal__textarea:hover:not(:disabled) {
  border-color: var(--pl-semantic-info-color-info-border-hover);
}

/* focus */
.pls-modal .pls-modal__input:focus,
.pls-modal .pls-modal__select:focus,
.pls-modal .pls-modal__textarea:focus {
  outline: none;
  border-color: var(--pl-semantic-info-color-info-border-hover);
  box-shadow: 0 0 0 1px var(--pl-semantic-info-color-info-border-hover);
}

/* disabled */
.pls-modal__input:disabled,
.pls-modal__select:disabled {
  background-color: var(--pl-neutral-fill-color-fill-quaternary);
  color: var(--pl-neutral-text-color-text-tertiary);
}

/* textarea */
.pls-modal__textarea {
  resize: vertical;
  min-height: 88px;
}

/* -----------------------------------------------------------------------------
HELPER TEXTS
----------------------------------------------------------------------------- */
/* Modal helper / hint text */
.pls-modal__helper-text {
  font-size: 14px;
  font-weight: 400;
  color: var(--pl-neutral-text-color-text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pls-modal__helper-text .anticon {
  color: var(--pl-neutral-text-color-text-tertiary);
}


/* -----------------------------------------------------------------------------
ERROR / WARNING
----------------------------------------------------------------------------- */
.pls-modal__error {
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  background-color: var(--pl-semantic-warning-color-warning-bg);
  color: var(--pl-semantic-warning-color-warning);
}

.pls-modal__error-alert {
  margin-bottom: 8px;
}

.pls-modal__error-alert .ant-alert-message {
  color: var(--pl-neutral-text-color-text);
}

.pls-modal__warning {
  font-size: 13px;
  padding: 8px;
  border-radius: 4px;
  background-color: var(--pl-semantic-warning-color-warning-bg);
  color: var(--pl-semantic-warning-color-warning);
}

/* -----------------------------------------------------------------------------
LIST CONTAINER
----------------------------------------------------------------------------- */
.pls-modal__list {
  min-height: calc(var(--pls-modal-item-height) * 3);
  max-height: var(--pls-modal-max-height);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* -----------------------------------------------------------------------------
LIST ITEMS (Base)
Neutral base – alignment handled by explicit variants
----------------------------------------------------------------------------- */
.pls-modal__list-item {
  display: flex;
  gap: 12px;
  padding: 8px;
  cursor: pointer;
  border-radius: 4px;
}

/* Hover & focus stay on base */
.pls-modal__list-item:hover {
  background-color: var(--pl-neutral-fill-color-fill-tertiary);
}

.pls-modal__list-item:focus-visible {
  outline: 2px solid var(--pl-semantic-info-color-info);
  outline-offset: -2px;
}

/* -----------------------------------------------------------------------------
LIST ITEM ALIGNMENT VARIANTS
----------------------------------------------------------------------------- */

/* Variant: center alignment (e.g. Labels modal – single-line items) */
.pls-modal__list-item--align-center {
  align-items: center;
}

/* Variant for two-line rows (name + type). Currently only the card custom-field assign modal
   uses this class; its row spacing/alignment is set in the .card-customfields-modal rule below.
   flex-start is the safe default for any future consumer that adopts the class. */
.pls-modal__list-item--align-start {
  align-items: flex-start;
}

/* Two-line rows (name + type): the checkbox is centred on the NAME line (the first line),
   not on the whole two-line block. The row is flex-start (anchored to the top); the checkbox
   cell is exactly the name's line-box height and centres the box within it, so the checkbox
   lines up with the field name while the type label stays on its own line below. */
.pls-modal__list-item--align-start > :first-child {
  display: flex;
  align-items: center;
  height: calc(13px * 1.4);
}

/* Cancel AntDesign's baseline nudge (position:relative; top:~2.8px) and its 22px wrapper
   line-height, both of which would otherwise push the box below the name line. */
.pls-modal__list-item--align-start > :first-child .ant-checkbox {
  top: 0;
}

.pls-modal__list-item--align-start > :first-child .ant-checkbox-wrapper {
  line-height: 1;
  align-items: center;
}

/* Checkbox box: fixed 16×16 per the approved design, a touch larger than the AntDesign
   default so it reads properly against the 13px field name. */
.card-customfields-modal .pls-modal__checkbox .ant-checkbox,
.card-customfields-modal .pls-modal__checkbox .ant-checkbox-inner {
  width: 16px;
  height: 16px;
}

/* CF assign modal — scoped to .card-customfields-modal so row spacing stays contained to this
   modal even if another modal later adopts .pls-modal__list-item--align-start. flex-start so the
   checkbox aligns to the NAME line (not the middle of the two-line block); gap:10px per the design. */
.card-customfields-modal .pls-modal__list-item--align-start {
  align-items: flex-start;
  gap: 10px;
}

.card-customfields-modal .pls-modal__item-content {
  gap: 1px;
}

/* Locked (project-wide) rows: present for context, not interactive. Such rows also carry the
   semantic marker .pls-modal__list-item--project-wide (a selector/test hook, no style of its
   own) to tell them apart from a user-assigned row, which carries only --selected. */
.pls-modal__list-item--locked {
  cursor: default;
  opacity: 0.7;
}

.pls-modal__list-item--locked:hover {
  background-color: transparent;
}

/* Unified hover for AntDesign checkboxes across the agile modals + embedded management panels,
   matching the primary-hover accent used by the on-card and filter checkboxes. Scoped to Pulse
   containers so it never leaks onto AntDesign checkboxes elsewhere in the host. The :not(-checked)
   guard leaves a ticked box on its solid primary fill; only the unticked box border reacts. */
.pls-modal .ant-checkbox-wrapper:hover .ant-checkbox:not(.ant-checkbox-checked) .ant-checkbox-inner,
.pls-cf-management .ant-checkbox-wrapper:hover .ant-checkbox:not(.ant-checkbox-checked) .ant-checkbox-inner,
.pls-status-management .ant-checkbox-wrapper:hover .ant-checkbox:not(.ant-checkbox-checked) .ant-checkbox-inner {
  border-color: var(--pl-semantic-primary-color-primary-hover, #009ADB);
}

/* Checked fill: AntDesign paints its own default blue (#1677ff); pin it to the design-system
   primary so a ticked modal checkbox reads in the same blue as the board / filter checkboxes. */
.pls-modal .ant-checkbox-checked .ant-checkbox-inner,
.pls-cf-management .ant-checkbox-checked .ant-checkbox-inner,
.pls-status-management .ant-checkbox-checked .ant-checkbox-inner {
  background-color: var(--pl-semantic-primary-color-primary, #0070B5);
  border-color: var(--pl-semantic-primary-color-primary, #0070B5);
}

/* -----------------------------------------------------------------------------
ITEM CONTENT (Name + Type)
----------------------------------------------------------------------------- */
.pls-modal__item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Primary item name */
.pls-modal__item-name {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--pl-neutral-text-color-text);
}

/* Secondary meta type */
.pls-modal__item-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--pl-neutral-text-color-text-tertiary);
}


/* -----------------------------------------------------------------------------
EMPTY STATE
----------------------------------------------------------------------------- */
.pls-modal__empty-state {
  padding: 24px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--pl-neutral-text-color-text-tertiary);
}

.pls-modal__empty-state .ant-empty-description {
  color: var(--pl-neutral-text-color-text-secondary);
}

/* -----------------------------------------------------------------------------
FOOTER
----------------------------------------------------------------------------- */
.pls-modal__footer {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.pls-modal__footer--actions-center { justify-content: center; }
.pls-modal__footer--actions-left   { justify-content: flex-start; }
.pls-modal__footer--actions-right  { justify-content: flex-end; }
.pls-modal__footer--actions-spread { justify-content: space-between; }

/* -----------------------------------------------------------------------------
TOGGLES / CHECKBOX GROUP
----------------------------------------------------------------------------- */

.pls-modal__toggles-group {
  display: flex;
  flex-direction: column;
  gap: 8px; /* space between checkboxes */
  margin-top: 4px; /* space below label */
}

/* Normalize checkbox alignment */
.pls-modal__toggles-group .ant-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}