/* SPDX-FileCopyrightText: 2023 Sayantan Santra <sayantan.santra689@gmail.com> */
/* SPDX-License-Identifier: MIT */

@import url("https://fonts.googleapis.com/css2?family=Montserrat&display=swap");
@font-face {
  font-family: Montserrat, "Open Sans", Helvetica, Arial, sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  font-family: Montserrat;
}
body {
  color: light-dark(black, #e8e6e3);
  background-color: light-dark(white, #181a1b);
}
.container {
  max-width: 80em;
  margin: 1em auto auto;
}

.chhoto-button {
  background-color: light-dark(#0078e7, #0060b9);
}
.pure-form input.chhoto-input {
  width: 65%;
  border-color: light-dark(#cccccc, #3e4446);
  box-shadow: light-dark(#dddddd, #2b2f31) 0 0.1em 0.2em inset;
}
.pure-form input.chhoto-input:focus {
  border-color: light-dark(#cccccc, #3e4446);
}

#expiryDelay {
  background-color: light-dark(white, #2b2a33);
  border-color: light-dark(#cccccc, #3e4446);
  box-shadow: light-dark(#dddddd, #2b2f31) 0 0.1em 0.2em inset;
}

::placeholder {
  color: light-dark(#757575, #636061);
}

#logo {
  color: light-dark(#333333, #c8c3bc);
  border-bottom-color: light-dark(#e5e5e5, #373c3e);
  font-size: 2em;
}
#logo img {
  height: 0.8em;
}

a {
  color: light-dark(blue, #3391ff);
}
.linkButton {
  background: none;
  padding: 0;
  border: none;
  color: light-dark(blue, #3391ff);
  text-decoration: underline;
  text-align: left;
  cursor: pointer;
}

.chhoto-table {
  width: 98%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 0.3em;
  box-shadow: 0 0 0 0.1em light-dark(#e0e0e0, #2a2d2f);
  border-color: light-dark(black, #867d6e);
}
.chhoto-table tr td div {
  max-height: 4.5em;
  line-height: 1.5em;
  word-break: break-word;
  overflow: auto;
}
.chhoto-table tr td[label="Long URL"] div {
  word-break: break-all;
}
.chhoto-table tr td[name="numColumn"] div {
  word-break: normal;
}
.chhoto-table tr td[name="hitsColumn"] div {
  word-break: normal;
}
.chhoto-table tr:nth-child(even) {
  background-color: light-dark(#f2f2f2, #080a0b);
}
.chhoto-table caption {
  color: light-dark(black, #e8e6e3);
  text-align: left;
  font-size: 1.5em;
  font-style: normal;
  font-family: Montserrat;
}
.chhoto-table thead {
  color: light-dark(black, #e8e6e3);
  background-color: light-dark(#e0e0e0, #2a2d2f);
}
.chhoto-table th,
.chhoto-table td {
  border-left: none;
  max-width: 36em;
}

#short-url-header {
  min-width: 6em;
}

th[name="hitsColumn"],
td[name="hitsColumn"] {
  text-align: right;
}

th[name="expiryColumn"],
td[name="expiryColumn"] {
  text-align: center;
}

th[name="actions"],
td[name="actions"] div {
  align-items: center;
  justify-items: center;
  text-align: center;
  min-width: 8em;
}
td[name="actions"] div button,
.pure-table caption button.svg-button {
  aspect-ratio: 1;
  border-style: none;
  cursor: pointer;
  display: table-cell;
  vertical-align: middle;
  background-color: transparent;
}
td[name="actions"] div button.svg-button svg,
.pure-table caption button.svg-button svg {
  height: 1.3em;
}

.pure-table caption span {
  margin-right: 1em;
}

form input[name="shortUrl"]::placeholder {
  text-transform: none;
}

div[name="links-div"] {
  position: absolute;
  right: 0.5%;
  top: 0.5%;
}

#password {
  width: 100%;
  margin-bottom: 1em;
}
#wrong-pass {
  color: light-dark(red, #ff1a1a);
}

#edit-dialog,
#qr-code-dialog,
#login-dialog {
  border-radius: 1em;
  border-width: 0.15em;
}
#login-dialog div {
  position: relative;
}
#password-eye-button {
  position: absolute;
  right: 0.1em;
  top: 1.3em;
  transform: translateY(-50%);
  background-color: transparent;
  border-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

#edit-dialog form,
#login-dialog form {
  text-align: center;
}
#edited-url {
  width: 100%;
}
#edit-cancel-button {
  background-color: light-dark(#dd1a1a, #901010);
}

#alert-box {
  padding: 0.5em;
  border-radius: 0.3em;
  margin-top: 0.2em;
  width: fit-content;
}

#qr-code-dialog {
  background-color: white;
  border-color: grey;
  text-align: right;
}
#qr-code-dialog div {
  margin: 0.5em;
}
.qr-button {
  background-color: transparent;
  color: black;
  border-style: none;
  position: absolute;
  top: 0.3em;
  right: 0.3em;
  cursor: pointer;
}
.qr-button svg {
  height: 2em;
}
#qr-download {
  right: 2em;
  text-decoration: none;
}

.tooltip {
  position: relative;
}
.tooltip .tooltiptext {
  visibility: hidden;
  width: 8em;
  background-color: light-dark(#eeeeee, #484a4b);
  color: light-dark(black, #e8e6e3);
  text-align: center;
  padding: 0.3em 0;
  border-radius: 0.4em;
  position: absolute;
  z-index: 1;
  bottom: calc(50% + 1.25em);
  left: 50%;
  margin-left: -4em;
  opacity: 0;
  transition: opacity 0.3s;
}
.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -0.3em;
  border-width: 0.3em;
  border-style: solid;
  border-color: light-dark(#eeeeee, #484a4b) transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Settings for mobile devices */
@media (pointer: none), (pointer: coarse) {
  .container {
    max-width: 98vw;
  }
  .pure-form input.chhoto-input {
    width: 98%;
  }

  .chhoto-table {
    border-collapse: collapse;
  }
  .chhoto-table tr:not(:last-child) {
    border-bottom: 0.15em dotted light-dark(black, #867d6e);
  }

  .chhoto-table thead {
    display: none;
  }

  .chhoto-table td {
    display: flex;
    justify-content: left;
    width: 97vw;
    padding: 0.1em;
  }

  .chhoto-table tr td[name="shortColumn"] {
    padding-top: 0.5em;
  }
  .chhoto-table tr td[name="actions"] {
    padding-bottom: 0.5em;
  }

  #alert-box {
    display: none;
  }

  .chhoto-table td::before {
    content: attr(label);
    font-weight: bold;
    min-width: 6em;
    text-align: left;
    align-content: center;
  }
  .chhoto-table td div {
    align-content: center;
  }

  .chhoto-table th[name="numColumn"],
  .chhoto-table td[name="numColumn"] {
    display: none;
  }

  .chhoto-table caption {
    padding-top: 0;
  }

  .tooltip .tooltiptext {
    left: 8em;
  }
}
