/* Copyright (c) 2022, The Tor Project, Inc. */

/* General rules */

html,
body {
  width: 100%;
  height: 100%;
}

label {
  display: flex;
  align-items: center;
  padding: 6px 0;
}

input[type="text"] {
  margin: 0;
  width: 360px;
  max-width: 100%;
}

textarea {
  margin: 0;
  width: var(--content-width);
  max-width: 100%;
  box-sizing: border-box;
}

select,
option {
  font-weight: var(--font-weight-bold);
}

dt {
  margin: var(--ruleset-vmargin) 0 0 0;
  padding: 0;
  color: var(--text-color-deemphasized);
  font-size: var(--font-size-small);
}

dd {
  margin: 8px 0 0 0;
  padding: 0;
  max-width: 600px;
  box-sizing: border-box;
}

hr {
  width: 40px;
  margin: 0;
  border: none;
  border-top: 1px solid var(--border-color);
}

.hidden {
  display: none !important;
}

/* Initial warning */

#warning-wrapper {
  display: none;
}

.state-warning #warning-wrapper {
  display: flex;
  align-items: center;
  height: 100%;
}

#warning {
  margin-top: -20vh;
  padding: 0 160px;
  background-image: url("chrome://global/skin/icons/warning.svg");
  background-position: 84px 0;
  background-repeat: no-repeat;
  background-size: 48px;
  fill: #ffbd4f;
  -moz-context-properties: fill;
}

#warning:dir(rtl) {
  background-position: right 84px top 0;
}

#warning-description {
  margin: 30px 0 16px 0;
}

#warning-buttonbar {
  margin-top: 30px;
  text-align: right;
}

/* Actual content */

:root {
  --sidebar-width: 320px;
  --content-width: 600px;
  --ruleset-vmargin: 40px;
}

#main-content {
  display: flex;
  height: 100%;
}

.state-warning #main-content {
  display: none;
}

section {
  display: none;
  flex: 1 0 auto;
  padding: 40px;
}

.title {
  display: flex;
  align-items: center;
  width: var(--content-width);
  max-width: 100%;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.title h1 {
  margin: 0;
  padding: 0;
  padding-inline-start: 35px;
  font-size: var(--font-size-xlarge);
  font-weight: var(--font-weight-bold);
  background-image: url("chrome://browser/content/rulesets/securedrop.svg");
  background-position: 0 center;
  background-size: 22px;
  min-height: 22px;
  background-repeat: no-repeat;
}

#main-content h1:dir(rtl) {
  background-position: right 0 top 4px;
}

/* Ruleset list */

aside {
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--sidebar-width);
  box-sizing: border-box;

  border-inline-end: 1px solid var(--border-color);
  background-color: var(--background-color-box);
}

#ruleset-heading {
  padding: 16px;
  text-align: center;
  font-weight: var(--font-weight-bold);
  border-bottom: 1px solid var(--border-color);
}

#ruleset-list-container {
  flex: 1;
}

#ruleset-list-empty {
  padding: 16px;
  text-align: center;
}

#ruleset-list-empty-description {
  font-size: var(--font-size-small);
}

#ruleset-list {
  margin: 0;
  padding: 0;
}

#ruleset-list li {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 10px 18px;
  list-style: none;
  border-inline-start: 4px solid transparent;
  border-bottom: 1px solid var(--border-color);
}

#ruleset-list li:last-child {
  border-bottom: none;
}

#ruleset-list .icon {
  width: 16px;
  height: 16px;
  margin-inline-end: 12px;
  background-image: url("chrome://browser/content/rulesets/securedrop.svg");
  background-size: 16px;
}

#ruleset-list .icon.has-favicon {
  background: transparent;
}

#ruleset-list .name {
  font-weight: var(--font-weight-bold);
}

#ruleset-list .description {
  font-size: var(--font-size-small);
  color: var(--text-color-deemphasized);
}

#ruleset-list .selected {
  /* stylelint-disable-next-line stylelint-plugin-mozilla/use-border-color-tokens */
  border-inline-start-color: var(--color-accent-primary);
}

#ruleset-list .selected.disabled {
  border-inline-start-color: var(--border-color);
}

#ruleset-list li:not(.selected):hover {
  background-color: var(--button-background-color-hover);
  color: var(--button-text-color-hover);
}

#ruleset-list li:not(.selected):hover:active {
  background-color: var(--button-background-color-active);
}

#ruleset-list #ruleset-template {
  display: none;
}

/* Ruleset details */

.state-details #ruleset-details {
  display: block;
}

#ruleset-jwk-value {
  padding: 8px;
  border-radius: var(--border-radius-xsmall);
  background-color: var(--background-color-box);
  font-size: var(--font-size-small);
  line-break: anywhere;
  /* ASCII-only text, so can set line-height. */
  line-height: 1.4;
}

#ruleset-edit {
  margin-inline-start: auto;
  padding-inline-start: 32px;
  background-image: url("chrome://global/skin/icons/edit.svg");
  background-repeat: no-repeat;
  background-position: 8px;
  -moz-context-properties: fill;
  fill: currentColor;
  min-width: auto;
  flex: 0 0 auto;
}

#ruleset-enable {
  margin-top: var(--ruleset-vmargin);
}

#ruleset-buttonbar {
  margin: var(--ruleset-vmargin) 0;
}

#ruleset-updated {
  margin-top: 24px;
  color: var(--text-color-deemphasized);
  font-size: var(--font-size-small);
}

/* Edit ruleset */

.state-edit #edit-ruleset {
  display: block;
}

#edit-ruleset label {
  color: var(--text-color-deemphasized);
  display: block;
}

#edit-ruleset label,
#edit-buttonbar {
  margin-top: var(--ruleset-vmargin);
}

label#edit-enable {
  display: flex;
  align-items: center;
}
