html {
  box-sizing: border-box;
  font-size: 16px;
  font-family: Inter, sans-serif;
}

body {
  font-size: 16px;
  min-width: 560px;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ol,
ul {
  margin: 0;
  padding: 0;
  font-weight: normal;
}

ol,
ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

input,
button,
select {
  font-family: Inter, sans-serif;
}

@font-face {
  font-family: "Inter";
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
  font-named-instance: "Regular";
  src: url("fonts/Inter-roman.var.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 100 900;
  font-display: swap;
  font-style: italic;
  font-named-instance: "Italic";
  src: url("fonts/Inter-italic.var.woff2") format("woff2");
}
:root {
  --black: black;
  --white: white;
  --grey: #ccc;
  --table-border: #e6e6e6;
  --border-grey: #eee;
  --light: #f6f6f6;
  --tab-background: #e9e9e9;
  --red: #f74c00;
  --light-red: #fffafa;
  --foreground: #333;
  --background: white;
}

body.dark {
  --black: white;
  --white: black;
  --table-border: #3a3a3a;
  --grey: #4b4b4b;
  --border-grey: #242424;
  --light: #202020;
  --tab-background: #2c2c2c;
  --light-red: #171616;
  --foreground: white;
  --background: #0a0a0a;
}
body.dark .invert-body {
  display: block !important;
}
body.dark.invert pre {
  color: var(--white);
  background: var(--black);
}
body.dark.no-invert iframe {
  filter: invert(1);
}
body.dark .list li.attachments .subject::before {
  filter: invert(1);
}

html,
body {
  height: 100%;
  max-height: 100vh;
  background: var(--background);
  color: var(--foreground);
}

header {
  height: 4rem;
  background: var(--light-red);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 {
  line-height: 4rem;
  padding-left: 6.5rem;
  background: url("img/mailcrab.svg") no-repeat center left 1rem;
  background-size: 5rem;
  font-weight: 300;
  font-size: 2.5rem;
  color: var(--foreground);
}
header h1 span {
  color: var(--red);
  font-weight: 400;
}
header div {
  display: flex;
  margin-right: 0.5rem;
}
header button {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0 1rem 0 1.9rem;
  border: 1px solid var(--border-grey);
  cursor: pointer;
  border-radius: 0;
  font-weight: 400;
  font-size: 0.9rem;
  height: 2.5rem;
  line-height: 2rem;
  background: var(--background) url("img/trash.svg") no-repeat top 0.6rem left 0.75rem;
  background-size: 14px;
  color: var(--foreground);
}
header button.dark-mode {
  background: var(--background) url("img/dark-mode.svg") no-repeat top 0.7rem left 0.95rem;
}
header button span {
  font-size: 0.8rem;
  margin-left: 0.25rem;
  font-weight: 500;
}
header button:hover {
  border-color: var(--red);
}

.main {
  height: calc(100vh - 4rem);
  display: flex;
  flex: 1;
}
@media (max-width: 1024px) {
  .main {
    flex-direction: column;
  }
}

.empty {
  margin: 4rem 0;
  text-align: center;
  font-size: 3rem;
  font-weight: 200;
  color: var(--grey);
}

@keyframes slide-down {
  from {
    padding: 0 0.75rem 0 3.5rem;
    max-height: 0;
  }
  to {
    padding: 0.75rem 0.75rem 0.75rem 3.5rem;
    max-height: 5rem;
  }
}
.list {
  border-right: 1px solid var(--border-grey);
  width: 30%;
  height: 100%;
  min-width: 40rem;
  max-width: 50rem;
  overflow-y: auto;
}
@media (max-width: 1400px) {
  .list {
    min-width: 30rem;
  }
}
@media (max-width: 1150px) {
  .list {
    min-width: 25rem;
  }
}
@media (max-width: 1024px) {
  .list {
    width: 100%;
    max-width: 100%;
    height: 40%;
  }
}
.list ul {
  display: flex;
  flex-direction: column-reverse;
}
.list li {
  padding: 0.75rem 0.75rem 0.75rem 3.5rem;
  border-bottom: 1px solid var(--border-grey);
  line-height: 1.6;
  cursor: pointer;
  transition: all 150ms ease-in;
  animation: slide-down 300ms ease-in;
  overflow: hidden;
  font-size: 0.9rem;
  background: var(--background) url("img/envelope.svg") no-repeat center left 0.75rem;
  background-size: 2rem;
  color: var(--foreground);
}
.list li:last-child {
  border-top: 1px solid var(--border-grey);
}
.list li:hover, .list li.selected {
  background-color: var(--light-red);
}
.list li.opened {
  opacity: 0.5;
  background-image: url("img/envelope-open.svg");
}
.list li.selected {
  color: var(--foreground) !important;
  font-weight: 500;
  background-image: url("img/envelope-open-text.svg");
}
.list li .head {
  display: flex;
  justify-content: space-between;
}
.list li .head .name {
  font-weight: 500;
}
.list li .head .date {
  white-space: nowrap;
}
.list li .head .name + .email {
  margin-left: 0.5rem;
  color: var(--black);
  opacity: 0.4;
}
.list li .head .name + .email::before {
  content: "<";
}
.list li .head .name + .email::after {
  content: ">";
}
.list li .recipients .label {
  color: var(--black);
  opacity: 0.6;
}
.list li .recipients .email,
.list li .recipients .etc {
  color: var(--black);
  opacity: 0.4;
}
.list li .preview {
  display: flex;
  justify-content: space-between;
}
.list li .preview .subject {
  color: var(--black);
  opacity: 0.9;
  display: block;
}
.list li .preview .size {
  margin-left: 0.5rem;
  color: var(--black);
  opacity: 0.4;
}
.list li.attachments .subject::before {
  content: " ";
  display: inline-block;
  margin-right: 0.2rem;
  width: 0.9rem;
  height: 0.9rem;
  background: url("img/paperclip.svg") no-repeat center left;
}

.recipients > .email + .email:before {
  content: ", <";
  display: inline-block;
  color: var(--black);
  opacity: 0.4;
}
.recipients .email::before {
  content: "<";
  color: var(--black);
  opacity: 0.4;
}
.recipients .email::after {
  content: ">";
  color: var(--black);
  opacity: 0.4;
}

.view {
  background-color: var(--light);
  padding: 1rem;
  flex: 1;
  overflow-x: hidden;
  border-top: 1px solid var(--border-grey);
}
.view .view-inner {
  background-color: var(--white);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.view .view-inner ul {
  display: block;
  background-color: var(--light);
  display: flex;
}
.view .view-inner ul li button {
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  margin-right: 0.3rem;
  cursor: pointer;
  border: none;
  background-color: var(--tab-background);
  color: var(--foreground);
}
.view .view-inner ul li button:hover, .view .view-inner ul li button.active {
  background: var(--white);
  transition: all 150ms ease-in;
}
.view .view-inner ul li.delete {
  margin-left: auto;
}
.view .view-inner ul li.delete button {
  margin-right: 0;
  margin-bottom: 0.25rem;
  padding: 0.5rem 1.5rem 0.5rem 2rem;
  background: var(--white) url("img/trash.svg") no-repeat center left 1rem;
  background-size: 12px;
  border: 1px solid var(--grey);
}
.view .view-inner ul li.delete button:hover {
  border: 1px solid var(--red);
}
.view .view-inner .tab-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow-x: hidden;
  font-size: 0.9rem;
}
.view .view-inner .tab-content table {
  border-collapse: collapse;
}
.view .view-inner .tab-content table th {
  font-weight: 500;
  text-align: left;
  width: 10rem;
}
.view .view-inner .tab-content table td,
.view .view-inner .tab-content table th {
  padding: 0.5rem;
  border-bottom: 1px solid var(--table-border);
}
.view .view-inner .tab-content table .name {
  font-weight: 500;
}
.view .view-inner .tab-content table .name + .email {
  color: rgba(var(--black), 0.8);
}
.view .view-inner .tab-content table .name + .email::before {
  content: " <";
}
.view .view-inner .tab-content table .name + .email::after {
  content: ">";
}
.view .view-inner .tab-content .actions a,
.view .view-inner .tab-content .actions button {
  display: inline-block;
  padding: 0.5rem 0.5rem 0.5rem 2rem;
  margin: 0.75rem 0.5rem 0 0;
  font-size: 0.9rem;
  border: 1px solid var(--grey);
  text-decoration: none;
  color: var(--black);
  transition: all 150ms ease-in;
  background: var(--white) url("img/file.svg") no-repeat center left 0.5rem;
  background-size: 1rem;
}
.view .view-inner .tab-content .actions a.application-pdf,
.view .view-inner .tab-content .actions button.application-pdf {
  background-image: url("img/file-pdf.svg");
}
.view .view-inner .tab-content .actions a .size,
.view .view-inner .tab-content .actions button .size {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  color: rgba(var(--black), 0.7);
}
.view .view-inner .tab-content .actions a:hover,
.view .view-inner .tab-content .actions button:hover {
  background-color: var(--light-red);
}
.view .view-inner .tab-content .actions .invert-body {
  float: right;
  cursor: pointer;
  display: none;
  background-image: url("img/dark-mode.svg");
  margin-right: 0;
}
.view .view-inner .tab-content pre {
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  padding: 0;
}
.view .view-inner .tab-content .body {
  width: 100%;
  flex: 1;
  padding: 0;
  margin-top: 0.75rem;
  color: var(--black);
  background: var(--white);
  border: 1px solid var(--table-border);
}
.view .view-inner .tab-content .body pre {
  font-family: Inter, sans-serif;
  line-height: 1.4;
}
.view .view-inner .tab-content .body iframe,
.view .view-inner .tab-content .body pre {
  width: 100%;
  height: 100%;
  padding: 0.5rem;
}
.view .view-inner .tab-content .body iframe {
  border: none;
  background: white;
}

.bouncing-loader {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes bouncing-loader {
  to {
    opacity: 0.1;
  }
}
.bouncing-loader {
  display: flex;
  justify-content: center;
  width: 100%;
  height: 100%;
  align-items: center;
  margin-top: auto;
}

.bouncing-loader > div {
  width: 1rem;
  height: 1rem;
  margin: 3rem 0.25rem;
  background: var(--red);
  border-radius: 50%;
  animation: bouncing-loader 0.6s infinite alternate;
}

.bouncing-loader > div:nth-child(2) {
  animation-delay: 0.2s;
}

.bouncing-loader > div:nth-child(3) {
  animation-delay: 0.4s;
}
