/**
 * Player Privacy Panel styles.
 *
 * Uses SP (Scrying Pool) semantic token system.
 * All colors and spacing come from SP tokens, not Foundry tokens directly.
 */

// Import SP tokens
@import "../tokens/_base.less";

.scrying-pool {
  // Dialog root element
  &.player-privacy-panel {
    background: var(--sp-dialog-bg);
    color: var(--sp-text-primary);
    font-family: var(--font-primary, inherit);
    border: var(--sp-dialog-border);
    border-top: 2px solid var(--sp-accent);
    border-radius: var(--sp-dialog-radius);
    box-shadow: var(--sp-dialog-shadow);
  }

  // Container
  .player-privacy-panel__container {
    display: flex;
    flex-direction: column;
    min-width: 300px;
    max-width: 400px;
  }

  // Body
  .player-privacy-panel__body {
    padding: 12px;
    background: var(--sp-surface);
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  // Notice (read-only)
  .player-privacy-panel__notice {
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
  }

  .player-privacy-panel__notice--readonly {
    background: var(--sp-color-yellow-subtle);
    color: var(--sp-color-yellow);
    border: 1px solid var(--sp-color-yellow-subtle);
  }

  // Section
  .player-privacy-panel__section {
    margin-bottom: 12px;
  }

  // Section header — force UI font, no fantasy
  .player-privacy-panel__section-header {
    margin: 0 0 4px 0;
    font-family: var(--font-primary, ui-sans-serif, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 700;
    color: var(--sp-text-primary);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.85;
  }

  .player-privacy-panel__section-description {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: var(--sp-text-secondary);
    line-height: 1.4;
  }

  // Effects list
  .player-privacy-panel__effects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  // Individual effect card
  .player-privacy-panel__effect {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sp-btn-radius, 5px);
    background: rgba(0, 0, 0, 0.15);
    transition: border-color 120ms ease;

    &:hover {
      border-color: rgba(255, 255, 255, 0.2);
    }
  }

  .player-privacy-panel__effect-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 8px;
  }

  // Effect label — force clean UI font
  .player-privacy-panel__effect-label {
    margin: 0;
    font-family: var(--font-primary, ui-sans-serif, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-text-primary);
    letter-spacing: 0;
  }

  .player-privacy-panel__effect-description {
    margin: 0;
    font-size: 11px;
    color: var(--sp-text-secondary);
    line-height: 1.4;
    opacity: 0.8;
  }

  // Toggle container
  .player-privacy-panel__toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .player-privacy-panel__toggle-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
  }

  // Toggle input — visually hidden
  .player-privacy-panel__toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;

    &:focus-visible + .player-privacy-panel__toggle-text {
      outline: 2px solid var(--sp-focus);
      outline-offset: 2px;
    }

    &:disabled + .player-privacy-panel__toggle-text {
      opacity: 0.45;
      cursor: not-allowed;
      pointer-events: none;
    }
  }

  // Toggle badge — clearly different ON vs OFF
  .player-privacy-panel__toggle-text {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border: 1px solid var(--sp-border);
    border-radius: 20px;
    font-family: var(--font-primary, ui-sans-serif, system-ui, sans-serif);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--sp-text-secondary);
    background: rgba(255,255,255,0.04);
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
    cursor: pointer;

    i { font-size: 9px; opacity: 0.7; }

    // Enabled state — using accent green from SP tokens
    .player-privacy-panel__toggle-input:checked + & {
      background: var(--sp-color-green-subtle);
      color: var(--sp-color-green);
      border-color: color-mix(in srgb, var(--sp-accent) 40%, transparent);

      i { opacity: 1; }
    }

    // Hover (when not disabled)
    .player-privacy-panel__toggle-label:hover & {
      border-color: var(--sp-accent);
    }
    .player-privacy-panel__toggle-input:checked + &:hover,
    .player-privacy-panel__toggle-label:hover .player-privacy-panel__toggle-input:checked + & {
      background: color-mix(in srgb, var(--sp-accent) 25%, transparent);
    }
  }

  // Portrait section
  .player-privacy-panel__portrait-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }

  .player-privacy-panel__portrait-preview {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .player-privacy-panel__portrait-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
  }

  .player-privacy-panel__portrait-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
  }

  .player-privacy-panel__portrait-choose,
  .player-privacy-panel__portrait-remove {
    font-size: var(--sp-btn-font-size, 12px);
    padding: var(--sp-btn-padding-sm, 5px 10px);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-btn-gap, 6px);
    border: 1px solid transparent;
    border-radius: var(--sp-btn-radius, 5px);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.2;
  }

  .player-privacy-panel__portrait-choose {
    background: var(--sp-btn-primary-bg, var(--sp-accent));
    color: var(--sp-btn-primary-text, #fff);

    &:hover { background: var(--sp-btn-primary-hover, var(--sp-accent-hover)); }
  }

  .player-privacy-panel__portrait-remove {
    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));
    }
  }

  // GM Privacy Selector dialog
  &.gm-privacy-selector-dialog {
    background: var(--sp-dialog-bg);
    border: var(--sp-dialog-border);
    border-top: 2px solid var(--sp-accent);
    border-radius: var(--sp-dialog-radius);
    box-shadow: var(--sp-dialog-shadow);
    min-width: 320px;
    max-width: 480px;
    overflow: hidden;
  }

  .sp-gm-privacy-selector {
    display: flex;
    flex-direction: column;
  }

  .sp-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);

    h2 {
      margin: 0;
      font-family: var(--font-primary, ui-sans-serif, system-ui, sans-serif);
      font-size: 13px;
      font-weight: 700;
      color: var(--sp-text-primary);
      text-transform: uppercase;
      letter-spacing: 0.02em;
      opacity: 0.85;
    }
  }

  .sp-close-button {
    background: transparent;
    border: none;
    color: var(--sp-text-secondary);
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 120ms ease, background 120ms ease;

    &:hover {
      color: var(--sp-text-primary);
      background: var(--sp-surface-interactive);
    }
  }

  .sp-gm-privacy-selector > p {
    padding: 7px 14px;
    margin: 0;
    font-size: 12px;
    color: var(--sp-text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .sp-user-list {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
  }

  .sp-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sp-btn-radius, 5px);
    background: rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;

    &:hover {
      background: rgba(0, 0, 0, 0.25);
      border-color: var(--sp-accent);
    }
  }

  .sp-user-name {
    font-family: var(--font-primary, ui-sans-serif, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-text-primary);
  }

  .sp-user-role {
    font-size: 11px;
    color: var(--sp-text-secondary);
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.04);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
}

