/**
 * styles/components/_directors-board.less
 *
 * Layout for the Director's Board ApplicationV2 window.
 * All selectors scoped under .scrying-pool.
 * Uses --sp-* tokens only — no Foundry --color-* / --font-* / --border-* tokens.
 */

// The ApplicationV2 window root already has .scrying-pool .directors-board applied
// via DEFAULT_OPTIONS.classes. The content section and footer live inside PARTS.

.scrying-pool.directors-board {
  background: var(--sp-dialog-bg);
  color: var(--sp-text-primary);
  border: var(--sp-dialog-border);
  border-top: 2px solid var(--sp-accent);
  border-radius: var(--sp-dialog-radius);
  box-shadow: var(--sp-dialog-shadow);

  /* Ensure Director's Board appears above the video strip */
  z-index: 100;

  // ── Hide Foundry's default window header ──────────────────────────────────
  header.window-header { display: none; }

  // The inner container is position:relative so the close btn can be absolute.
  .directors-board__inner {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  // ── Drag grip ─────────────────────────────────────────────────────────────
  .directors-board__grip {
    width: 100%;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--sp-text-muted);
    opacity: 0.35;
    font-size: 10px;
    flex-shrink: 0;
    transition: opacity 0.15s, background 0.15s;
    user-select: none;
    border-radius: var(--sp-dialog-radius) var(--sp-dialog-radius) 0 0;

    &:hover  { opacity: 0.8; background: rgba(255, 255, 255, 0.03); }
    &:active { cursor: grabbing; opacity: 1; }
  }

  // ── Custom close button ───────────────────────────────────────────────────
  .directors-board__close-btn {
    position: absolute;
    top: 2px;
    right: 6px;
    z-index: 10;
    width: 20px;
    height: 20px;
    padding: 0;
    line-height: 20px;
    font-size: 14px;
    font-weight: 400;
    background: transparent;
    color: var(--sp-text-muted);
    border: none;
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s, background 0.15s, color 0.15s;

    &:hover {
      opacity: 1;
      background: rgba(255, 255, 255, 0.08);
      color: var(--sp-text-primary);
    }
    &:active { opacity: 0.75; }
  }

  // ── Participant grid ──────────────────────────────────────────────────────
  .directors-board__content {
    display: grid;
    grid-template-columns: repeat(auto-fill, 68px);
    gap: 6px;
    padding: 8px;
    overflow-y: auto;
    flex: 1 1 auto;
    list-style: none;
    margin: 0;
  }

  // ── Empty state ────────────────────────────────────────────────────────────
  .directors-board__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--sp-text-muted);
    font-size: 12px;
    padding: 20px 0;
    margin: 0;
  }

  // ── Bulk-action bar ────────────────────────────────────────────────────────
  .directors-board__bulk-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.15);
  }

  .directors-board__bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-btn-gap, 6px);
    padding: var(--sp-btn-padding-sm, 4px 10px);
    font-size: var(--sp-btn-font-size-sm, 11px);
    font-weight: 600;
    border-radius: var(--sp-btn-radius, 5px);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.2;
    border: 1px solid transparent;

    i { font-size: 10px; pointer-events: none; }

    // Primary (show/hide) — green
    background: rgba(74, 158, 107, 0.75);
    color: #e8f0ea;
    border-color: rgba(74, 158, 107, 0.4);

    &:hover { background: rgba(74, 158, 107, 0.95); }
    &:active { opacity: 0.8; }

    // Undo — neutral
    &--undo {
      background: var(--sp-btn-secondary-bg, rgba(255,255,255,0.05));
      color: var(--sp-btn-secondary-text, var(--sp-text-secondary));
      border-color: var(--sp-btn-secondary-border, rgba(255,255,255,0.12));
      font-weight: 500;

      &:hover {
        background: var(--sp-btn-secondary-hover-bg, rgba(255,255,255,0.1));
        color: var(--sp-btn-secondary-hover-text, var(--sp-text-primary));
        border-color: rgba(255, 255, 255, 0.25);
      }
    }

    // Restore spotlight — purple (distinct semantic)
    &--restore {
      background: rgba(123, 79, 166, 0.75);
      border-color: rgba(123, 79, 166, 0.4);
      &:hover { background: rgba(123, 79, 166, 0.95); }
    }
  }

  // ── Help / shortcut-panel button ───────────────────────────────────────────
  .directors-board__help-btn {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--sp-text-muted);
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;

    &:hover {
      background: rgba(74, 158, 107, 0.8);
      color: #fff;
      border-color: transparent;
    }
  }

  // ── Footer (preset actions) ────────────────────────────────────────────────
  .directors-board__footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 var(--sp-dialog-radius) var(--sp-dialog-radius);
  }

  .directors-board__footer-group {
    display: flex;
    align-items: center;
    gap: 4px;

    &--presets { flex-wrap: wrap; }

    &--controls {
      padding-top: 4px;
      border-top: 1px solid rgba(255, 255, 255, 0.05);
    }
  }

  .directors-board__footer-sep {
    width: 1px;
    align-self: stretch;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 3px;
    flex-shrink: 0;
  }

  .directors-board__footer-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-btn-gap, 6px);
    padding: var(--sp-btn-padding-sm, 4px 10px);
    font-size: var(--sp-btn-font-size-sm, 11px);
    font-weight: 600;
    border-radius: var(--sp-btn-radius, 5px);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1.2;
    border: 1px solid transparent;

    i { font-size: 0.9em; pointer-events: none; }

    // Default — green primary
    background: rgba(74, 158, 107, 0.7);
    color: #e8f0ea;
    border-color: rgba(74, 158, 107, 0.35);

    &:hover { background: rgba(74, 158, 107, 0.9); color: #fff; }
    &:active { opacity: 0.8; }

    &[disabled] {
      cursor: not-allowed;
      opacity: 0.4;
      background: transparent;
      color: var(--sp-text-muted);
      border: 1px solid rgba(255, 255, 255, 0.08);
    }

    // Secondary — neutral
    &--secondary {
      background: var(--sp-btn-secondary-bg, rgba(255,255,255,0.05));
      color: var(--sp-btn-secondary-text, var(--sp-text-secondary));
      border-color: var(--sp-btn-secondary-border, rgba(255,255,255,0.12));
      font-weight: 500;

      &:hover {
        background: var(--sp-btn-secondary-hover-bg, rgba(255,255,255,0.1));
        color: var(--sp-btn-secondary-hover-text, var(--sp-text-primary));
      }
    }

    // Auto-apply toggle — neutral (same as secondary)
    &--auto-apply {
      background: var(--sp-btn-secondary-bg, rgba(255,255,255,0.05));
      color: var(--sp-btn-secondary-text, var(--sp-text-secondary));
      border-color: var(--sp-btn-secondary-border, rgba(255,255,255,0.12));
      font-weight: 500;

      &:hover {
        background: var(--sp-btn-secondary-hover-bg, rgba(255,255,255,0.1));
        color: var(--sp-btn-secondary-hover-text, var(--sp-text-primary));
      }
    }

    // AV mode — neutral-muted
    &--av {
      background: rgba(30, 35, 45, 0.8);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: var(--sp-text-muted);
      font-weight: 500;
      &:hover { background: rgba(50, 55, 70, 0.9); }
    }

    // AV mode active — red tone
    &--av-active {
      background: rgba(90, 42, 42, 0.85);
      border-color: rgba(160, 64, 64, 0.6);
      color: #f0a0a0;
      font-weight: 500;
      &:hover { background: rgba(110, 50, 50, 0.95); }
    }

    // AV config — icon-only
    &--av-config {
      background: rgba(30, 35, 45, 0.8);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: var(--sp-text-muted);
      flex: 0 0 auto;
      font-weight: 500;
      &:hover { background: rgba(50, 55, 70, 0.9); }
    }
  }

  // ── Dock layout selector bar ───────────────────────────────────────────────
  .directors-board__dock-layout-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.12);
  }

  .directors-board__dock-layout-label {
    font-size: 10px;
    color: var(--sp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 2px;
  }

  .directors-board__dock-layout-group {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
  }

  .directors-board__dock-layout-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 3px;
    flex-shrink: 0;
  }

  .directors-board__dock-layout-btn {
    width: 28px;
    height: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sp-btn-radius, 5px);
    cursor: pointer;
    color: var(--sp-text-muted);
    padding: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;

    i { font-size: 10px; pointer-events: none; }

    &:hover {
      background: rgba(255, 255, 255, 0.1);
      color: var(--sp-text-primary);
      border-color: rgba(255, 255, 255, 0.2);
    }

    &.is-active {
      background: rgba(74, 158, 107, 0.2);
      border-color: var(--sp-accent);
      color: var(--sp-accent);
    }
  }

  .directors-board__dock-layout-size {
    font-size: 8px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    pointer-events: none;
  }

  // ── Tile shape selector bar ──────────────────────────────────────────────
  .directors-board__tile-shape-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.12);
  }

  .directors-board__tile-shape-label {
    font-size: 10px;
    color: var(--sp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 2px;
  }

  .directors-board__tile-shape-group {
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .directors-board__tile-border-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.12);
  }

  .directors-board__tile-border-label {
    font-size: 10px;
    color: var(--sp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 2px;
  }

  .directors-board__tile-border-group {
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .directors-board__tile-border-btn {
    height: 24px;
    min-width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sp-btn-radius, 5px);
    cursor: pointer;
    color: var(--sp-text-secondary, #7a8390);
    font-size: 10px;
    padding: 0 6px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;

    &.is-active {
      background: hsla(200, 70%, 55%, 0.2);
      border-color: hsla(200, 70%, 55%, 0.6);
      color: var(--sp-text-primary, #dde2e8);
    }

    &:hover:not(.is-active) {
      background: rgba(255, 255, 255, 0.08);
      color: var(--sp-text-primary, #dde2e8);
    }
  }

  .directors-board__tile-border-color {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--sp-btn-radius, 5px);
    cursor: pointer;
    background: none;
    flex-shrink: 0;

    &::-webkit-color-swatch-wrapper {
      padding: 2px;
    }

    &::-webkit-color-swatch {
      border: none;
      border-radius: 3px;
    }
  }

  .directors-board__tile-shape-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sp-btn-radius, 5px);
    cursor: pointer;
    color: var(--sp-text-muted);
    padding: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;

    i { font-size: 11px; pointer-events: none; }

    &:hover {
      background: rgba(255, 255, 255, 0.1);
      color: var(--sp-text-primary);
      border-color: rgba(255, 255, 255, 0.2);
    }

    &.is-active {
      background: rgba(74, 158, 107, 0.2);
      border-color: var(--sp-accent);
      color: var(--sp-accent);
    }
  }
}
