/**
 * Settings/Comparison Panel styles
 * Used by compression apps (imagecompressor, compressjpeg, compresspng, compressgif)
 */

/* ========== Settings Panel ========== */
.settings {
  display: none;
  width: 100%;
  max-width: 970px;
  margin: 0 auto 40px;
  background: #fff;
  border-radius: 0.75em;
  border: 1px solid #f2f2f2;
  box-shadow: 0 5px 16px -2px rgba(42, 115, 217, 0.2);
  font-size: 16px;
}

.settings_visible {
  display: block;
}

.page__settings {
  margin-top: 0;
}

.settings__title {
  padding: 0.3em 1em;
  border-bottom: 1px solid #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings__title-text {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.125em;
  text-align: center;
  width: 100%;
  line-height: 1.2;
  word-break: break-word;
}

.settings__content {
  display: flex;
  padding: 0 0.5em 1em 1em;
}

.settings__compare-outer {
  flex: 1;
  min-width: 0;
  margin-right: 0.5em;
  padding-top: 1.5em;
}

.settings__compare {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.settings__quality-outer {
  flex-shrink: 0;
  align-self: flex-start;
  width: 5em;
  height: calc(20em + 3.5em);
  padding: 0 0.5em;
  padding-top: 3.5em;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings__loader-outer {
  flex-shrink: 0;
  width: 2.5em;
  height: 2.5em;
  margin-right: 0.75em;
}

/* ========== Image Info ========== */
.image-info {
  display: flex;
  margin-bottom: 0.75em;
}

.image-info__text {
  width: 50%;
  text-align: center;
  letter-spacing: 0.02em;
  font-size: 1em;
}

.image-info__bold {
  font-weight: 600;
}

.image-info__savings {
  font-weight: 600;
  color: #2e7d32;
}

.image-info__savings_approximate {
  color: var(--color-text);
}

/* ========== Frame Counter (for animated images) ========== */
.frame-counter {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(0.4em, 1.5vw, 0.65em);
  margin-top: 0.75em;
}

.settings__frame-counter_hidden {
  display: none;
}

.frame-counter__label {
  cursor: text;
  font-size: clamp(0.8em, 2.5vw, 1em);
  letter-spacing: 0.04em;
  height: clamp(1.75em, 5vw, 2em);
  padding: 0 0.5em;
  border: 2px solid var(--color-dark);
  border-radius: 4px;
  font-weight: 600;
  margin: 0;
  flex-shrink: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 rgba(56, 64, 75, 0.75);
  transition: opacity 0.2s ease-out, box-shadow 0.2s ease-out;
  color: var(--color-dark);
}

.frame-counter__label:focus-within {
  box-shadow: inset 0 0 3px rgba(42, 115, 217, 0.75);
}

.frame-counter__label_disabled {
  opacity: 0.5;
  pointer-events: none;
}

.frame-counter__label-all {
  position: relative;
  z-index: 2;
}

.frame-counter__label-all::before {
  content: '/';
  margin: 0 0.25em;
}

.frame-counter__input {
  background: none;
  outline: none;
  border: none;
  cursor: text;
  text-align: right;
  font-size: inherit;
  letter-spacing: inherit;
  height: 100%;
  font-weight: inherit;
  color: var(--color-dark);
}

.frame-counter__input:disabled {
  opacity: 0.5;
  cursor: default;
}

.frame-counter__label:has(.frame-counter__input:disabled) {
  opacity: 0.5;
  pointer-events: none;
}

.frame-counter__button {
  min-width: 0;
  padding: 0;
  width: clamp(2.5em, 7vw, 3em);
  height: clamp(2em, 5.5vw, 2.25em);
}

.frame-counter__button .button__text {
  width: 100%;
  text-align: center;
}

@media screen and (max-width: 555px) {
  .settings__frame-counter {
    padding: 0 0.5em;
    margin-bottom: 0.75em;
  }
}

/* ========== Compare Canvas ========== */
.compare {
  position: relative;
  width: 100%;
  height: 20em;
  user-select: none;
  overflow: hidden;
}

.compare::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: inherit;
  pointer-events: none;
}

.compare__canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  outline: 1px solid #000;
  touch-action: none;
}

/* ========== Thumb / Divider ========== */
.thumb {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  height: 100%;
  width: 10px;
  margin-left: -5px;
  cursor: ew-resize;
  touch-action: none;
}

.thumb::before,
.thumb::after {
  content: '';
  position: absolute;
  width: 2px;
  margin-left: -1px;
  left: 50%;
  background-color: #fff;
}

.thumb::before {
  top: 0;
  bottom: 50%;
  margin-bottom: 1.125em;
  box-shadow: 1px 2px 0 0 rgba(0, 0, 0, 0.2), -1px 2px 0 0 rgba(0, 0, 0, 0.2);
}

.thumb::after {
  bottom: 0;
  top: 50%;
  margin-top: 1.125em;
  box-shadow: 1px -2px 0 0 rgba(0, 0, 0, 0.2), -1px -2px 0 0 rgba(0, 0, 0, 0.2);
}

.thumb__button {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.25em;
  height: 2.25em;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  color: var(--color-dark);
}

.thumb__icon_left {
  transform: translate(-130%, -50%);
}

.thumb__icon_right {
  transform: translate(30%, -50%);
}

.thumb_active .thumb__button {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ========== Zoom Indicator ========== */
.zoom-indicator {
  position: absolute;
  z-index: 3;
  bottom: 0.5em;
  right: 0.5em;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.75em;
  font-weight: 600;
  padding: 0.3em 0.5em;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  opacity: 1;
  display: flex;
  align-items: center;
  gap: 0.4em;
  transition: opacity 0.2s ease-out, background-color 0.15s ease-out;
}

.zoom-indicator:hover {
  background: rgba(0, 0, 0, 0.85);
}

.zoom-indicator__text {
  line-height: 1;
}

.zoom-indicator__icon {
  opacity: 0.7;
  transition: opacity 0.15s ease-out;
}

.zoom-indicator:hover .zoom-indicator__icon {
  opacity: 1;
}

.zoom-indicator_hidden {
  opacity: 0;
  pointer-events: none;
}

/* ========== Quality Panel ========== */
.quality {
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: visible;
}

.quality__field {
  flex-shrink: 0;
}

.quality__title {
  text-align: center;
  font-size: 1em;
  font-weight: 600;
  line-height: 1;
  margin: 0 -0.5em 0.625em;
  white-space: nowrap;
  width: calc(100% + 1em);
}

.quality__input {
  background: none;
  outline: none;
  border: none;
  cursor: text;
  width: 100%;
  font-size: 1em;
  letter-spacing: 0.04em;
  height: 1.875em;
  border: 2px solid var(--color-dark);
  border-radius: 4px;
  font-weight: 600;
  text-align: center;
  box-shadow: inset 0 0 0 rgba(56, 64, 75, 0.75);
  transition: opacity 0.2s ease-out, box-shadow 0.2s ease-out;
  flex-shrink: 0;
  margin-bottom: 0.625em;
  color: var(--color-dark);
}

.quality__input:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.quality__input:focus {
  box-shadow: inset 0 0 3px rgba(42, 115, 217, 0.75);
}

.quality__range-outer {
  position: relative;
  height: 100%;
  margin-bottom: 0.625em;
  touch-action: none;
}

.quality__range-input {
  position: absolute;
  width: 100%;
  height: 20px;
  transform-origin: right top;
  transform: translateX(-100%) rotate(-90deg);
  transform: translate3d(-100%, 0, 0) rotate(-90deg);
  margin-left: -10px;
  transition: opacity 0.2s ease-out;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  touch-action: none;
}

.quality__range-input:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.quality__range-input::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  box-shadow: inset -1px 1px 2px rgba(42, 115, 217, 0.15);
  background: #f2f7fd;
  border-radius: 4px;
  border: 1px solid #e3edfa;
}

.quality__range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--color-dark);
  border-radius: 50%;
  cursor: pointer;
  margin-top: -7px;
  box-shadow: -4px 0 6px -4px rgba(22, 46, 90, 0.7);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M3.46.89c.21.17.24.49.06.7l-2 2.42 1.99 2.4a.5.5 0 01-.77.64L.2 4 2.75.95a.5.5 0 01.7-.06zM8.54.89a.5.5 0 00-.06.7l2 2.42-1.99 2.4a.5.5 0 10.77.64L11.8 4 9.25.95a.5.5 0 00-.7-.06z' fill='%23fff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center center;
}

.quality__range-input::-moz-range-track {
  width: calc(100% - 2px);
  height: 6px;
  box-shadow: inset -1px 1px 2px rgba(42, 115, 217, 0.15);
  background: #f2f7fd;
  border-radius: 4px;
  border: 1px solid #e3edfa;
  cursor: pointer;
}

.quality__range-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--color-dark);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: -4px 0 6px -4px rgba(22, 46, 90, 0.7);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M3.46.89c.21.17.24.49.06.7l-2 2.42 1.99 2.4a.5.5 0 01-.77.64L.2 4 2.75.95a.5.5 0 01.7-.06zM8.54.89a.5.5 0 00-.06.7l2 2.42-1.99 2.4a.5.5 0 10.77.64L11.8 4 9.25.95a.5.5 0 00-.7-.06z' fill='%23fff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center center;
}

.quality__button {
  width: 100%;
  min-width: 0;
  padding: 0 0.25em;
  background-color: var(--color-dark);
  border-color: var(--color-dark);
}

.quality__button:hover {
  color: var(--color-dark);
}

/* ========== Responsive Settings ========== */
@media (max-width: 555px) {
  .settings__content {
    flex-direction: column-reverse;
    padding: 0 1em 1em;
  }

  .settings__title {
    position: relative;
    padding: 0.5em 2.5em;
  }

  .settings__quality-outer {
    flex: none;
    width: calc(100% + 2em);
    height: auto;
    margin: 0 -1em 0.5em;
    padding: 0 1em 1em;
    border-bottom: 1px solid #f2f2f2;
  }

  .settings__compare-outer {
    flex: none;
    width: 100%;
    margin-right: 0;
    padding-top: 0.5em;
  }

  .settings__loader {
    position: absolute;
  }

  .settings__loader-outer {
    position: absolute;
    right: 0.5em;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    margin: 0;
  }

  .loader {
    width: 20px;
    height: 20px;
  }

  .loader i {
    transform-origin: 10px 10px;
  }

  .loader i::after {
    top: 1px;
    left: 9.5px;
    width: 1px;
    height: 5px;
  }

  .quality {
    position: relative;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    padding-top: 1em;
    padding-bottom: 1.8em;
    gap: 2%;
  }

  .quality__field {
    flex: 0 0 auto;
    font-size: clamp(0.75em, 2.5vw, 1em);
  }

  .quality__title {
    margin: 0;
    width: auto;
  }

  .quality__input {
    position: absolute;
    top: 1em;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    height: clamp(1.625rem, 6.25vw, 2.1875rem);
    width: clamp(2.5rem, 9vw, 3.5rem);
  }

  .quality__button {
    flex: 0 0 auto;
    width: auto;
    padding: 0 1em;
  }

  .quality__range-outer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    height: 20px;
  }

  .quality__range-input {
    transform: translateX(0) rotate(0deg);
    transform: translate3d(0, 0, 0) rotate(0deg);
    margin: 0;
  }

  .quality__range-input::-webkit-slider-runnable-track {
    box-shadow: inset 1px 1px 2px rgba(42, 115, 217, 0.15);
  }

  .quality__range-input::-webkit-slider-thumb {
    box-shadow: 0 4px 6px -4px rgba(22, 46, 90, 0.7);
  }

  .quality__range-input::-moz-range-track {
    box-shadow: inset 1px 1px 2px rgba(42, 115, 217, 0.15);
  }

  .quality__range-input::-moz-range-thumb {
    box-shadow: 0 4px 6px -4px rgba(22, 46, 90, 0.7);
  }

  .image-info__title {
    display: block;
    text-align: center;
  }
}
