/* Privacy blur editor (js/blur-tool.js). Full-screen, dark like the tour editor.
   Sits above .ai-modal (99999) and below .upgrade-modal (100050). */

.blur-tool {
  position: fixed;
  inset: 0;
  z-index: 100040;
  display: flex;
  flex-direction: column;
  background: #0b0f17;
  color: #e6e9ef;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.blur-tool[hidden],
.blur-tool [hidden] {
  display: none !important;
}

.blur-tool button {
  font-family: inherit;
}

.blur-tool__spacer {
  flex: 1 1 auto;
  min-width: 0;
}

/* Header */
.blur-tool__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-height: 60px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.blur-tool__title {
  margin: 0 0 0 4px;
  overflow: hidden;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.blur-tool__icon,
.blur-tool__ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #cfd5e1;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.blur-tool__icon {
  width: 40px;
}

.blur-tool__ghost {
  padding: 0 12px;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.blur-tool__icon:hover,
.blur-tool__ghost:hover:not([disabled]),
.blur-tool__ghost.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.blur-tool__ghost[disabled] {
  opacity: 0.4;
  cursor: default;
}

.blur-tool .blur-tool__save {
  flex-shrink: 0;
  height: 40px;
  margin: 0 0 0 4px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 40px;
  text-transform: none;
}

.blur-tool .blur-tool__save.is-disabled {
  opacity: 0.45;
  cursor: default;
}

/* Toolbar */
.blur-tool__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 14px;
}

.blur-tool__find {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(56, 154, 240, 0.55);
  border-radius: 10px;
  background: rgba(56, 154, 240, 0.14);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease;
}

.blur-tool__find:hover:not([disabled]) {
  background: rgba(56, 154, 240, 0.26);
}

.blur-tool__find[disabled] {
  opacity: 0.55;
  cursor: progress;
}

.blur-tool__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.blur-tool__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: transparent;
  color: #8e96a6;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.blur-tool__chip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  opacity: 0.35;
}

.blur-tool__chip b {
  font-weight: 700;
}

.blur-tool__chip.is-on {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.blur-tool__chip.is-on i {
  opacity: 1;
}

.blur-tool__seg {
  display: inline-flex;
  flex-shrink: 0;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
}

.blur-tool__seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #cfd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.blur-tool__seg button:hover {
  color: #fff;
}

.blur-tool__seg button.is-active {
  background: #fff;
  color: #0b0f17;
}

.blur-tool button:focus-visible {
  outline: 2px solid #389af0;
  outline-offset: 2px;
}

/* Stage */
.blur-tool__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.blur-tool__canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.blur-tool__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #cfd5e1;
  pointer-events: none;
}

.blur-tool__progress {
  position: absolute;
  top: 12px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(420px, calc(100% - 24px));
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(11, 15, 23, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.blur-tool__progress-track {
  flex: 1;
  min-width: 40px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.blur-tool__progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #379af0, #898bff);
  transition: width 0.15s linear;
}

.blur-tool__progress button {
  border: none;
  background: transparent;
  color: #9fb4d6;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.blur-tool__hint {
  flex-shrink: 0;
  min-height: 20px;
  margin: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #aab2c2;
  font-size: 13px;
  line-height: 1.45;
}

/* Tight screens: icons carry the secondary actions, labels stay on the primary ones */
@media screen and (max-width: 767px) {
  .blur-tool__bar {
    min-height: 54px;
    padding: 7px 8px;
  }
  /* Long Save labels (German, Filipino) need the room; the dialog keeps its aria-label */
  .blur-tool__title {
    display: none;
  }
  .blur-tool__ghost {
    width: 40px;
    padding: 0;
  }
  .blur-tool__ghost span {
    display: none;
  }
  .blur-tool__tools {
    padding: 8px;
  }
  .blur-tool__find {
    flex: 1 1 100%;
    justify-content: center;
  }
  .blur-tool__chips {
    flex: 1 1 100%;
  }
  .blur-tool__chips:empty {
    display: none;
  }
  .blur-tool__seg span {
    display: none;
  }
  .blur-tool__tools > .blur-tool__spacer {
    flex: 0 0 auto;
  }
  .blur-tool__tools > .blur-tool__seg:last-child {
    margin-left: auto;
  }
}
