/* Popup styles, scoped under the brand root class to avoid leakage. */

.wls-extension-main {
  --color-surface: oklch(98% 0.005 250);
  --color-elevated: oklch(100% 0 0);
  --color-text: oklch(22% 0.02 260);
  --color-muted: oklch(55% 0.02 260);
  --color-border: oklch(91% 0.01 260);

  --color-good: oklch(62% 0.16 150);
  --color-bad: oklch(60% 0.2 25);
  --color-warn: oklch(72% 0.15 75);
  --color-accent: oklch(58% 0.18 255);

  --radius: 12px;
  --radius-sm: 8px;
  --space: 16px;
  --duration: 200ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  color: var(--color-text);
  background: var(--color-surface);
  margin: 0;
}

.wls-app {
  width: 340px;
  display: flex;
  flex-direction: column;
}

.wls-app[data-busy='true'] {
  cursor: progress;
}

.wls-app__header {
  padding: var(--space) var(--space) 10px;
}

.wls-app__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  text-transform: uppercase;
}

.wls-app__main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 var(--space) var(--space);
}

/* Master shield toggle. */
.wls-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-elevated);
  cursor: pointer;
  text-align: left;
  color: var(--color-text);
  transition:
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
  box-shadow: 0 1px 2px oklch(0% 0 0 / 6%);
}

.wls-toggle:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px oklch(0% 0 0 / 10%);
}

.wls-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.wls-toggle:disabled {
  cursor: progress;
  opacity: 0.65;
}

.wls-toggle__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
  background: var(--color-bad);
  box-shadow: 0 0 0 4px oklch(60% 0.2 25 / 18%);
  transition: background var(--duration) var(--ease);
}

.wls-toggle[data-on='true'] .wls-toggle__dot {
  background: var(--color-good);
  box-shadow: 0 0 0 4px oklch(62% 0.16 150 / 18%);
}

.wls-toggle__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  font-size: 14px;
}

.wls-toggle__hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-muted);
}

.wls-toggle__switch {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  flex: none;
  background: oklch(85% 0.01 260);
  position: relative;
  transition: background var(--duration) var(--ease);
}

.wls-toggle__switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-elevated);
  box-shadow: 0 1px 2px oklch(0% 0 0 / 25%);
  transition: transform var(--duration) var(--ease);
}

.wls-toggle__switch[data-on='true'] {
  background: var(--color-good);
}

.wls-toggle__switch[data-on='true']::after {
  transform: translateX(16px);
}

/* Watch Tool toggle row. */
.wls-watch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-elevated);
  cursor: pointer;
  text-align: left;
  color: var(--color-text);
  transition: box-shadow var(--duration) var(--ease);
}

.wls-watch:hover:not(:disabled) {
  box-shadow: 0 4px 14px oklch(0% 0 0 / 8%);
}

.wls-watch:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.wls-watch:disabled {
  cursor: progress;
  opacity: 0.65;
}

.wls-watch__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  font-size: 13px;
}

.wls-watch__hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-muted);
}

/* Sections. */
.wls-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-elevated);
  padding: 12px 14px;
}

/* Current site. */
.wls-current__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.wls-current__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.wls-current__host {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.wls-current__host--muted {
  color: var(--color-muted);
  font-weight: 400;
}

.wls-current__note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--color-muted);
}

.wls-chip {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-accent);
  background: color-mix(in oklch, var(--color-accent) 8%, transparent);
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.wls-chip:hover:not(:disabled) {
  background: color-mix(in oklch, var(--color-accent) 16%, transparent);
}

.wls-chip:disabled {
  cursor: progress;
  opacity: 0.6;
}

.wls-chip[data-allowed='true'] {
  border-color: var(--color-good);
  color: var(--color-good);
  background: color-mix(in oklch, var(--color-good) 8%, transparent);
}

.wls-chip[data-allowed='true']:hover:not(:disabled) {
  background: color-mix(in oklch, var(--color-good) 16%, transparent);
}

/* Whitelist. */
.wls-list__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  font-weight: 600;
}

.wls-list__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: oklch(93% 0.01 260);
  color: var(--color-muted);
  font-size: 10px;
}

.wls-list__empty {
  margin: 0;
  font-size: 12px;
  color: var(--color-muted);
}

.wls-list__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: 132px;
  overflow-y: auto;
}

.wls-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
}

.wls-list__item:first-child {
  border-top: none;
}

.wls-list__host {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wls-list__remove {
  flex: none;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.wls-list__remove:hover:not(:disabled) {
  background: color-mix(in oklch, var(--color-bad) 14%, transparent);
  color: var(--color-bad);
}

.wls-list__remove:disabled {
  cursor: progress;
  opacity: 0.5;
}

/* External-test actions — prominent buttons. */
.wls-tests {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wls-test {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-elevated);
  color: var(--color-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 1px 2px oklch(0% 0 0 / 5%);
  transition:
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}

.wls-test:hover {
  transform: translateY(-1px);
  border-color: var(--color-accent);
  box-shadow: 0 6px 16px oklch(58% 0.18 255 / 18%);
}

.wls-test:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.wls-test__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  background: color-mix(in oklch, var(--color-accent) 12%, transparent);
  font-size: 14px;
}

.wls-test__label {
  flex: 1;
}

.wls-test__go {
  flex: none;
  color: var(--color-accent);
  font-size: 15px;
  font-weight: 700;
}

/* Footer status. */
.wls-app__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px var(--space);
  border-top: 1px solid var(--color-border);
  background: var(--color-elevated);
}

.wls-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  min-width: 0;
}

.wls-status__indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.wls-status__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wls-status[data-tone='good'] .wls-status__indicator {
  background: var(--color-good);
}
.wls-status[data-tone='bad'] .wls-status__indicator {
  background: var(--color-bad);
}
.wls-status[data-tone='warn'] .wls-status__indicator {
  background: var(--color-warn);
}

.wls-status[data-tone='good'] .wls-status__text {
  color: var(--color-good);
}
.wls-status[data-tone='bad'] .wls-status__text {
  color: var(--color-bad);
}
.wls-status[data-tone='warn'] .wls-status__text {
  color: var(--color-warn);
}

.wls-app__version {
  font-size: 10px;
  color: var(--color-muted);
  flex: none;
}

@media (prefers-reduced-motion: reduce) {
  .wls-extension-main * {
    transition: none !important;
  }
}

