/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

.network-monitor .tabpanel-summary-container:is(.http-custom-section, .http-custom-method-and-url, .http-custom-input) {
  padding-inline-start: 0;
  margin: 0;
}

.network-monitor .tabpanel-summary-container.http-custom-method-and-url {
  display: grid;
  grid-template-columns: auto 1fr;
  width: 100%;
}

.network-monitor .http-custom-method-and-url .http-custom-method-value {
  grid-column: 1 / 1;
  grid-row: 1 / 1;
  align-self: start;
  margin-inline-start: 10px;
  padding-top: 4px;
  font-size: 11px;
  line-height: 13px;
}

.auto-growing-textarea {
  display: grid;
  width: 100%;
}

.auto-growing-textarea:focus-within::after {
  content: attr(data-replicated-value) " ";
  white-space: pre-wrap;
  visibility: hidden;
  word-wrap: break-word;
}

.auto-growing-textarea > textarea {
  resize: none;
  overflow: hidden;
  /* Force the content in a single line */
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* When editing a textarea, restore the multiline display */
.auto-growing-textarea > textarea:focus {
  text-overflow: unset;
  white-space: unset;
}

.auto-growing-textarea > textarea,
.auto-growing-textarea:focus-within::after {
  grid-area: 1 / 1 / 2 / 2;
  border: 0;
  font-weight: normal;
  min-width: 9ch;
  padding: 4px;
  padding-inline-start: 7px;
  /* Adding this to have maximo 5 lines */
  max-height: 70px;
  overflow-y: auto;
}

.network-monitor .http-custom-method-and-url .http-custom-method-value,
.tabpanel-summary-container.http-custom-section .tabpanel-summary-input {
  border: 0;
}

.tabpanel-summary-container .http-custom-section .tabpanel-summary-input-value {
  font-weight: normal;
  min-width: 9ch;
  padding: 4px;
  padding-inline-start: 7px;
}

.network-monitor .http-custom-method-and-url input ::placeholder {
  color: var(--grey-50);
  font-size: 11px;
  line-height: 13px;
  margin-inline-end: 8px;
}

.network-monitor .tabpanel-summary-container .http-custom-request-label {
  padding: 6px 13px;
  font-size: 12px;
  line-height: 14px;
}

.network-monitor .http-custom-request-panel textarea {
  color: var(--grey-50);
  font-weight: normal;
  font-size: 11px;
  line-height: 13px;
  direction: ltr;
}

.network-monitor .http-custom-request-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.network-monitor .http-custom-request-panel .http-custom-request-panel-content {
  flex: 1 1 auto;
  height: auto;
  overflow: auto;
}

.network-monitor .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  width: 100%;
  overflow: hidden;
  padding: 0 13px;
  padding-inline-end: 0;
}

.network-monitor .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) .tabpanel-summary-input-name {
  width: 25%;
  align-self: stretch;
  min-width: min-content;
}

.network-monitor .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) .tabpanel-summary-input-value {
  width: 75%;
  align-self: stretch;
}

.map-add-new-inputs {
  padding-bottom: 2px;
}

#http-custom-postdata-value.tabpanel-summary-input {
  padding-inline-start: 14px;
}

.http-custom-delete-button {
  opacity: 0;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 2px;
  border: none;
  outline: none;
  background-color: transparent;
  position: absolute;
  right: 0;
}

.tabpanel-summary-container.http-custom-input:hover .http-custom-delete-button {
  opacity: 1;
}

.tabpanel-summary-container.http-custom-input .http-custom-delete-button::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: url("chrome://devtools/skin/images/close.svg") no-repeat center;
  background-size: 12px;
  -moz-context-properties: fill;
  fill: var(--theme-icon-color);
}

.tabpanel-summary-container.http-custom-input .http-custom-delete-button:hover::before {
  fill: var(--theme-selection-color);
  background-color: var(--theme-selection-background);
}

.network-monitor .http-custom-request-button-container {
  display: flex;
  justify-content: end;
  flex-wrap: wrap-reverse;
  gap: 8px;
  padding: 10px 16px;
  border-block-start: 1px solid var(--theme-splitter-color);
}

.network-monitor .http-custom-request-panel .http-custom-request-label {
  font-weight: 400;
  white-space: nowrap;
}

.network-monitor .http-custom-request-button-container button {
  height: 24px;
  padding-inline: 8px;
  width: auto;
}

.network-monitor .http-custom-request-button-container button:focus {
  box-shadow:
    0 0 0 1px #0a84ff inset,
    0 0 0 1px #0a84ff,
    0 0 0 4px rgba(10, 132, 255, 0.3);
}

.network-monitor .http-custom-request-button-container #http-custom-request-send-button {
  background-color: var(--blue-60);
  color: white;
}

.network-monitor .http-custom-request-button-container #http-custom-request-send-button:active {
  background-color: var(--blue-80);
}

.network-monitor .http-custom-request-button-container #http-custom-request-send-button:hover {
  background-color: var(--blue-70);
}

.network-monitor .http-custom-header {
  border-style: solid;
  border-width: 0;
  flex: none;
  height: calc(var(--theme-toolbar-height) + 1px);
  padding: 4px 16px;
}

/* Dark theme */
:root.theme-dark .network-details-bar .http-custom-request-panel {
  background-color: var(--grey-85);
}

:root.theme-dark .network-monitor .tabpanel-summary-container:is(.http-custom-method-and-url, .http-custom-section),
:root.theme-dark .network-monitor .tabpanel-summary-container .http-custom-request-label {
  border-bottom: 1px solid var(--grey-60);
}

:root.theme-dark .network-monitor .http-custom-method-and-url :is(.http-custom-method-value, .http-custom-url-value),
:root.theme-dark .network-monitor .tabpanel-summary-container .tabpanel-summary-input,
:root.theme-dark .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) .http-custom-input-name,
:root.theme-dark .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) .http-custom-input-value {
  background-color: var(--grey-85);
  color: white;
}

:root.theme-dark .network-monitor .http-custom-method-and-url .http-custom-url-value,
:root.theme-dark .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) #http-custom-input-value {
  border-inline-start: 1px solid var(--grey-60);
}

:root.theme-dark .network-monitor .http-custom-method-and-url .http-custom-url-value:focus {
  outline: 2px solid var(--blue-50);
  width: calc(100% - 8px);
}

:root.theme-dark .network-monitor .tabpanel-summary-container .tabpanel-summary-input:focus {
  outline: 2px solid var(--blue-50);
  margin-inline-start: 2px;
  width: calc(100% - 5px);
}

:root.theme-dark .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) .http-custom-input-name:focus {
  outline: 2px solid var(--blue-50);
  margin-inline-end: 1px;
}

:root.theme-dark .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) .http-custom-input-value:focus {
  outline: 2px solid var(--blue-50);
  width: calc(100% - 20px);
}

:root.theme-dark .http-custom-input-and-map-form .map-add-new-inputs .tabpanel-summary-input-value,
:root.theme-dark #http-custom-query .http-custom-input-and-map-form .tabpanel-summary-input-value:focus {
  margin-inline-end: 1px;
}

:root.theme-dark .network-monitor #http-custom-request-clear-button {
  background-color: var(--toolbarbutton-background);
  border: 1px solid var(--theme-splitter-color);
}

:root.theme-dark .network-monitor #http-custom-request-clear-button:hover:active {
  background-color: var(--theme-selection-background-hover);
}

:root.theme-dark .network-monitor #http-custom-request-clear-button:focus {
  background-color: var(--theme-selection-focus-background);
}

:root.theme-dark .network-monitor .http-custom-request-label.http-custom-header {
  background-color: var(--grey-80);
  border-bottom: 1px solid var(--theme-splitter-color);
}

:root.theme-dark .network-details-bar .http-custom-request-panel input,
:root.theme-dark .network-details-bar .http-custom-request-panel textarea {
  background-color: var(--grey-70);
  border: 1px solid var(--grey-85);
  color: white;
}

:root.theme-dark .network-monitor .http-custom-request-label {
  color: var(--grey-40);
}

/* Light theme */
:root.theme-light .network-monitor .tabpanel-summary-container:is(.http-custom-method-and-url, .http-custom-section),
:root.theme-light .network-monitor .tabpanel-summary-container .http-custom-request-label {
  border-bottom: 1px solid var(--grey-30);
}

:root.theme-light .network-monitor .http-custom-method-and-url .http-custom-method-value {
  background-color: white;
}

:root.theme-light .network-monitor .http-custom-method-and-url .http-custom-url-value,
:root.theme-light .tabpanel-summary-container .tabpanel-summary-input-value {
  border-inline-start: 1px solid var(--grey-30);
}

:root.theme-light .network-monitor .http-custom-method-and-url .http-custom-url-value:focus {
  outline: 2px solid var(--blue-50);
  width: calc(100% - 8px);
}

:root.theme-light .network-monitor .tabpanel-summary-container .tabpanel-summary-input:focus {
  outline: 2px solid var(--blue-50);
  margin-inline-start: 2px;
  width: calc(100% - 5px);
}

:root.theme-light .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) .http-custom-input-name:focus {
  outline: 2px solid var(--blue-50);
  margin-inline-end: 1px;
}

:root.theme-light .http-custom-input-and-map-form :is(.http-custom-input, .map-add-new-inputs) .http-custom-input-value:focus {
  outline: 2px solid var(--blue-50);
  width: calc(100% - 20px);
}

:root.theme-light .http-custom-input-and-map-form .map-add-new-inputs .tabpanel-summary-input-value:focus,
:root.theme-light #http-custom-query .http-custom-input-and-map-form .tabpanel-summary-input-value:focus {
  margin-inline-end: 3px;
}

:root.theme-light .network-monitor .tabpanel-summary-container .http-custom-request-label {
  background-color: var(--grey-10);
  color: var(--grey-90);
}

:root.theme-light .network-details-bar .http-custom-request-label.http-custom-header {
  background-color: var(--grey-10);
  border-bottom: 1px solid var(--grey-25);
}

:root.theme-light .network-monitor #http-custom-request-clear-button {
  background-color: var(--grey-25);
  border: var(--theme-splitter-color);
}

:root.theme-light .network-monitor #http-custom-request-clear-button:hover:active {
  background-color: var(--theme-selection-background-hover);
}

:root.theme-light .network-monitor #http-custom-request-clear-button:focus {
  outline: 2px solid var(--blue-50);
  outline-offset: -2px;
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.3);
  border-radius: 2px;
}

:root.theme-light .network-details-bar .http-custom-request-panel input,
:root.theme-light .network-details-bar .http-custom-request-panel textarea {
  background-color: white;
  border: 1px solid var(--grey-25);
  color: var(--grey-90);
}

:root.theme-light .network-monitor .http-custom-request-label {
  color: var(--grey-60);
}
