@import url("theme.css");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  padding: clamp(1rem, 3vw, 2rem);
  max-width: 800px;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;

  h1 {
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
    color: #3b82f6;
    margin: 0;
  }
}

textarea {
  width: 100%;
  padding: 0.6rem;
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 1rem;
  resize: vertical;
  height: 6rlh;
  word-break: break-all;

  &:focus {
    outline: none;
    border-color: #3b82f6;
  }
}

fieldset legend {
  margin-left: auto;
  padding: 0 0.5rem;
}

.url-box {
  background: #1e293b;
  padding: 0.5rem;
  border-radius: 8px;
  margin: 10px 0;
  border: 1px solid #334155;
}

.cleaned {
  min-height: 6rem;
  height: max-content;
  font-size: 14px;
  word-break: break-all;
  cursor: pointer;
  padding: 8px;
  background: #0f172a;
  border-radius: 4px;
  transition: background 0.2s;

  &::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  &:hover::after {
    opacity: 1;
  }
}

.toggles {
  display: flex;
  gap: clamp(12px, 3vw, 20px);
  margin: 15px 0;
  justify-content: space-between;
  flex-wrap: wrap;
  min-width: fit-content;
}

@media (max-width: 400px) {
  .toggles {
    flex-direction: column;
    gap: 12px;
  }
}

.toggle-wrapper {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;

  input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #334155;
    border-radius: 24px;
    transition: 0.3s;

    &:before {
      position: absolute;
      content: "";
      height: 18px;
      width: 18px;
      left: 3px;
      bottom: 3px;
      background: white;
      border-radius: 50%;
      transition: 0.3s;
    }
  }

  input:checked+.slider {
    background: #3b82f6;
  }

  input:checked+.slider:before {
    transform: translateX(24px);
  }
}

.params {
  margin-top: 15px;
}

.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 13px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
  transition: background 0.2s;

  &:hover {
    background: #1e293b;
  }

  .collapsible-icon {
    font-size: 10px;
    transition: transform 0.2s;
  }
}

.param {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #0f172a;
  border-radius: 4px;
  margin: 5px 0;

  input {
    cursor: pointer;
    width: 18px;
    height: 18px;
  }

  label {
    flex: 1;
    cursor: pointer;
    word-break: break-all;
    font-size: 13px;
  }

  &.group {
    background: #1e293b;
  }

  &.group label {
    color: #94a3b8;
  }
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #22c55e;
  color: #0f172a;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;

  &.show {
    opacity: 1;
  }
}

.url-section {
  margin-bottom: 10px;
}

.url-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.url-label {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 4px 8px;
  font-size: 16px;
  border-radius: 4px;
  background: #334155;
  color: #e2e8f0;
  border: none;
  cursor: pointer;
  transition: background 0.2s;

  &:hover {
    background: #3b82f6;
  }
}

.url-box.output {
  background: #020617;
  border-style: dashed;
}

#copyBtn {
  padding: 8px 14px;
  font-weight: 600;
  border-radius: 6px;
  background: #3b82f6;
  color: #fff;
  border: none;
  cursor: pointer;

  &:hover {
    background: #2563eb;
  }
}

.config-btn {
  padding: 4px 8px;
  font-size: 1.5rem;
  background: transparent;
  color: #3b82f6;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;

  &:hover {
    background: #1e293b;
  }
}

.config-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;

  &[data-visible="true"] {
    display: flex;
  }

  .config-content {
    background: #1e293b;
    padding: 1.5rem;
    border-radius: 12px;
    min-width: 300px;
    max-width: 90vw;
  }

  .config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;

    h2 {
      font-size: 1.3rem;
      color: #3b82f6;
    }
  }

  .close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;

    &:hover {
      background: #334155;
      color: #fff;
    }
  }

  .config-toggles {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
}