/* TODO: May break up into component local CSS.  Pending future discussions by
 * React component group on how to best handle CSS. */

/**
 * CSS Variables specific to the responsive design mode
 */

.theme-light {
  --rdm-box-shadow: 0 4px 4px 0 rgba(155, 155, 155, 0.26);
  --submit-button-active-background-color: rgba(0,0,0,0.12);
  --submit-button-active-color: var(--theme-body-color);
  --viewport-color: #999797;
  --viewport-hover-color: var(--theme-body-color);
  --viewport-active-color: #3b3b3b;
  --viewport-selection-arrow: url("./images/select-arrow.svg#light");
  --viewport-selection-arrow-hovered:
    url("./images/select-arrow.svg#light-hovered");
  --viewport-selection-arrow-selected:
    url("./images/select-arrow.svg#light-selected");
}

.theme-dark {
  --rdm-box-shadow: 0 4px 4px 0 rgba(105, 105, 105, 0.26);
  --submit-button-active-background-color: var(--toolbar-tab-hover-active);
  --submit-button-active-color: var(--theme-selection-color);
  --viewport-color: #c6ccd0;
  --viewport-hover-color: #dde1e4;
  --viewport-active-color: #fcfcfc;
  --viewport-selection-arrow: url("./images/select-arrow.svg#dark");
  --viewport-selection-arrow-hovered:
    url("./images/select-arrow.svg#dark-hovered");
  --viewport-selection-arrow-selected:
    url("./images/select-arrow.svg#dark-selected");
}

* {
  box-sizing: border-box;
}

#root,
html, body {
  margin: 0;
}

#app {
  /* Center the viewports container */
  display: flex;
  align-items: center;
  flex-direction: column;
  height: 100vh;

  /* Snap to the top of the app when there isn't enough vertical space anymore
     to center the viewports (so we don't lose the global toolbar) */
  position: sticky;
  top: 0;
}

/**
 * Common style for containers and toolbar buttons
 */

.container {
  background-color: var(--theme-toolbar-background);
  border: 1px solid var(--theme-splitter-color);
}

.toolbar-button {
  margin: 1px 3px;
  width: 16px;
  height: 16px;
  /* Reset styles from .devtools-button */
  min-width: initial;
  min-height: initial;
  align-self: center;
}

.toolbar-button:active::before {
  filter: url("chrome://devtools/skin/images/filters.svg#checked-icon-state");
}

/**
 * Global Toolbar
 */

#global-toolbar {
  color: var(--theme-body-color-alt);
  border-radius: 2px;
  box-shadow: var(--rdm-box-shadow);
  margin: 10% 0 30px 0;
  padding: 4px 5px;
  display: inline-flex;
  -moz-user-select: none;
}

#global-toolbar > .title {
  border-right: 1px solid var(--theme-splitter-color);
  padding: 1px 6px 0 2px;
}

#global-toolbar .toolbar-button {
  margin: 0 0 0 5px;
  padding: 0;
}

#global-toolbar .toolbar-button,
#global-toolbar .toolbar-button::before {
  width: 12px;
  height: 12px;
}

#global-touch-simulation-button::before {
  background-image: url("./images/touch-events.svg");
  margin: -6px 0 0 -6px;
}

#global-touch-simulation-button.active::before {
  filter: url("chrome://devtools/skin/images/filters.svg#checked-icon-state");
}

#global-screenshot-button::before {
  background-image: url("./images/screenshot.svg");
  margin: -6px 0 0 -6px;
}

#global-exit-button::before {
  background-image: url("./images/close.svg");
  margin: -6px 0 0 -6px;
}

#global-screenshot-button:disabled {
  filter: url("chrome://devtools/skin/images/filters.svg#checked-icon-state");
  opacity: 1 !important;
}


#viewports {
  /* Make sure left-most viewport is visible when there's horizontal overflow.
     That is, when the horizontal space become smaller than the viewports and a
     scrollbar appears, then the first viewport will still be visible */
  position: sticky;
  left: 0;
  /* Individual viewports are inline elements, make sure they stay on a single
     line */
  white-space: nowrap;
}

/**
 * Viewport Container
 */

.viewport {
  display: inline-block;
  /* Align all viewports to the top */
  vertical-align: top;
}

.resizable-viewport {
  border: 1px solid var(--theme-splitter-color);
  box-shadow: var(--rdm-box-shadow);
  position: relative;
}

/**
 * Viewport Toolbar
 */

.viewport-toolbar {
  border-width: 0;
  border-bottom-width: 1px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  height: 18px;
}

.viewport-device-selector {
  -moz-appearance: none;
  background-color: var(--theme-toolbar-background);
  background-image: var(--viewport-selection-arrow);
  background-position: 136px;
  background-repeat: no-repeat;
  background-size: 7px;
  border: none;
  color: var(--viewport-color);
  height: 100%;
  padding: 0 16px 0 0;
  text-align: center;
  text-overflow: ellipsis;
  width: 150px;
}

.viewport-device-selector.selected {
  background-image: var(--viewport-selection-arrow-selected);
  color: var(--viewport-active-color);
}

.viewport-device-selector:hover {
  background-image: var(--viewport-selection-arrow-hovered);
  color: var(--viewport-hover-color);
}

.viewport-device-selector:focus {
  background-image: var(--viewport-selection-arrow-selected);
  color: var(--viewport-active-color);
}

.viewport-device-selector > option {
  text-align: left;
  padding: 5px 10px;
}

.viewport-device-selector > option,
.viewport-device-selector > option:hover,
.viewport-device-selector:hover > option:hover {
  color: var(--viewport-active-color);
}

.viewport-rotate-button {
  position: absolute;
  right: 0;
}

.viewport-rotate-button::before {
  background-image: url("./images/rotate-viewport.svg");
}

/**
 * Viewport Content
 */

.viewport-content.resizing {
  pointer-events: none;
}

/**
 * Viewport Browser
 */

.browser-container {
  width: inherit;
  height: inherit;
}

.browser {
  display: block;
  border: 0;
}

/**
 * Viewport Resize Handles
 */

.viewport-resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  bottom: 0;
  right: 0;
  background-image: url("./images/grippers.svg");
  background-position: bottom right;
  padding: 0 1px 1px 0;
  background-repeat: no-repeat;
  background-origin: content-box;
  cursor: se-resize;
}

.viewport-resize-handle.hidden {
  display: none;
}

.viewport-horizontal-resize-handle {
  position: absolute;
  width: 5px;
  height: calc(100% - 16px);
  right: -4px;
  top: 0;
  cursor: e-resize;
}

.viewport-vertical-resize-handle {
  position: absolute;
  width: calc(100% - 16px);
  height: 5px;
  left: 0;
  bottom: -4px;
  cursor: s-resize;
}

/**
 * Viewport Dimension Label
 */

.viewport-dimension {
  display: flex;
  justify-content: center;
  font: 10px sans-serif;
  margin-top: 10px;
}

.viewport-dimension-editable {
  border-bottom: 1px solid transparent;
}

.viewport-dimension-editable,
.viewport-dimension-input {
  color: var(--theme-body-color-inactive);
  transition: all 0.25s ease;
}

.viewport-dimension-editable.editing,
.viewport-dimension-input.editing {
  color: var(--viewport-active-color);
}

.viewport-dimension-editable.editing {
  border-bottom: 1px solid var(--theme-selection-background);
}

.viewport-dimension-editable.editing.invalid {
  border-bottom: 1px solid #d92215;
}

.viewport-dimension-input {
  background: transparent;
  border: none;
  text-align: center;
}

.viewport-dimension-separator {
  -moz-user-select: none;
}

/**
 * Device Modal
 */

.device-modal {
  border-radius: 2px;
  box-shadow: var(--rdm-box-shadow);
  position: absolute;
  margin: auto;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 642px;
  height: 612px;
}

.device-modal.hidden {
  display: none;
}

.device-modal-content {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  overflow: auto;
  height: 550px;
  width: 600px;
  margin: 20px;
}

#device-close-button,
#device-close-button::before {
  position: absolute;
  top: 5px;
  right: 2px;
  width: 12px;
  height: 12px;
}

#device-close-button::before {
  background-image: url("./images/close.svg");
  margin: -6px 0 0 -6px;
}

.device-type {
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.device-header {
  font-weight: bold;
  text-transform: capitalize;
  padding: 0 0 3px 23px;
}

.device-label {
  padding-bottom: 3px;
}

.device-input-checkbox {
  margin-right: 5px;
}

#device-submit-button {
  background-color: var(--theme-tab-toolbar-background);
  border-width: 1px 0 0 0;
  border-top-width: 1px;
  border-top-style: solid;
  border-top-color: var(--theme-splitter-color);
  color: var(--theme-body-color);
  width: 100%;
  height: 20px;
}

#device-submit-button:hover {
  background-color: var(--toolbar-tab-hover);
}

#device-submit-button:hover:active {
  background-color: var(--submit-button-active-background-color);
  color: var(--submit-button-active-color);
}
