/*=== Global =========*/
:root {
  --blue-dark: #363f5f;
  --green: #49aa26;
  --green-dark: #2d4a22;
  --green-light: #3dd705;
  --lilac: #969cd3;
  --off-white: #f0f2f5;
  --red: #e92929;
}
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}
html {
  font-size: 93.75%; /* 15px */
  overflow-x: hidden;
}
body {
  background-color: var(--off-white);
  font-family: 'Poppins', sans-serif;
  overflow-x: hidden;
}
main {
  position: relative;
}
.container {
  width: min(90vw, 800px);
  margin: auto;
}

/*=== Titles ====*/
h2 {
  margin-top: 3.2rem;
  margin-bottom: 0.8rem;
  color: var(--blue-dark);
  font-weight: normal;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: auto;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/*=== Links & Buttons ======*/
a {
  color: var(--green);
  text-decoration: none;
}
a:hover {
  color: var(--green-light);
}
.button{
  display: inline-block;
  border-radius: 0.25rem;
  padding: 0.8rem 1rem;
}
.button.new {
  border: 2px solid var(--green);
}
.button.new:hover {
  border-color: var(--green-light);
}
.button.clear {
  color: var(--red);
  border: 2px solid var(--red);
  opacity: 0.6;
}
.button.clear:hover {
  opacity: 1;
}
.button.cancel {
  color: var(--red);
  border: 2px var(--red) solid;
  border-radius: 0.25rem;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}
.button.cancel:hover {
  border: 2px solid var(--red);
  opacity: 1;
}
.button.download, 
.upload {
  border: 2px solid var(--green);
  color: var(--green);
}
.button.download:hover, 
.upload:hover {
  border: 2px solid var(--green-light);
  color: var(--green-light);
}
button {
  width: 100%;
  height: 50px;
  padding: 0;
  border: none;
  border-radius: 0.25rem;
  color: white;
  font-size: 14px;
  background-color: var(--green);
  cursor: pointer;
}
button:hover {
  background-color: var(--green-light);
}

/*=== Header =========*/
header {
  background-color: var(--green-dark);
  padding: 4rem 0 10rem;
  text-align: center;
}

header img#logo {
  width: 172px;
  height: 24px;
}

/*=== Balance =========*/
#balance {
  margin-top: -6rem;
}
#balance h2 {
  color: white;
  margin-top: 0;
}
.card {
  background-color: white;
  padding: 1.5rem 2rem;
  border-radius: 0.25rem;
  margin-bottom: 1.4rem;
  color: var(--blue-dark);
  transition: transform 0.3s ease;
}
.card:hover {
  transform: translateY(-0.8rem);
}
.card h3 {
  font-weight: normal;
  font-size: 1rem;

  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card h3 img {
  width: 32px;
  height: 32px;
}
.card p {
  font-size: 2rem;
  line-height: 3rem;
  margin-top: 1rem;
}
.card.total {
  background-color: var(--green);
  color: white;
}
.card.total.negative {
  background-color: var(--red);
}
#incomeDisplay {
  color: var(--green);
}
#expenseDisplay {
  color: var(--red);
}

/*=== Table =========*/
#transactions{
  width: 100%;
  display: block;
  overflow-x: auto;
}
#transactions .actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .8rem;
}
table {
  width: 100%;
  border-spacing: 0 0.5rem;
  color: var(--blue-dark);
}
table tbody tr {
  opacity: 0.7;
  height: auto;
}
table tbody tr:hover {
  opacity: 1;
}
table thead tr th:first-child,
table tbody tr td:first-child {
  border-radius: 0.25rem 0 0 0.25rem;
  width: 40%;
}
table thead tr th:last-child,
table tbody tr td:last-child {
  border-radius: 0 0.25rem 0.25rem 0;
}
table tbody tr td:last-child {
  width: 100%;
  display: flex;
  justify-content: space-around;
}
table tbody tr td:last-child img {
  width: 28px;
  height: 28px;
  cursor: pointer;
}
table thead th {
  background-color: white;
  font-weight: normal;
  padding: 1rem 2rem;
  text-align: left;
}
#th-description, 
#th-value,
#th-date,
#th-search{
  cursor: pointer;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}
#th-search input#search {
  width: 100%;
  height: 100%;
  font-family: 'Poppins', sans-serif;
  border: none;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  outline-color: var(--blue-dark);
  outline-width: 1px;
  background: var(--off-white) url('assets/search.svg') no-repeat scroll 98%;
}

table thead .th-sort-desc,
table thead .th-sort-desc {
  position: relative;
}
table thead .th-sort-asc::after{
  content: '';
  position: absolute;
  background-image: url('assets/arrow-up.svg');
  background-size: cover;
  background-position: center;
  width: 18px;
  height: 18px;
}
table thead .th-sort-desc::after{
  content: '';
  position: absolute;
  background-image: url('assets/arrow-down.svg');
  background-size: cover;
  background-position: center;
  width: 18px;
  height: 18px;
}
table thead .th-sort-asc::after,
table thead .th-sort-desc::after{
  margin-left: 0.4rem;
}
table tbody td {
  background-color: white;
  padding: 1rem 2rem;
}
td.description {
  color: var(--dark-blue);
}
td.income {
  color: var(--green);
}
td.expense {
  color: var(--red);
}
#transactions .actions.bottom {
  margin-top: .8rem;
  margin-bottom: 0;
}
#transactions .actions.bottom .json {
  display: flex;
}
.actions.bottom .button {
  display: flex;
  align-items: center;
}
.actions.bottom svg {
  margin-left: 0.8rem;
  width: 18px;
  height: 18px;
}
.json .button-wrapper {
  margin-left: 0.8rem;
  position: relative;
  text-align: center;
  cursor: pointer;
}
.json .button-wrapper label {
  display: flex;
  align-items: center;
  border-radius: 0.25rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
}
.button-wrapper #upload {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0;
  z-index: -1;
  cursor: pointer;
}
/*=== Modal ======*/
.modal-overlay {
  width: 100%;
  height: 100%;
  
  background-color: rgba(0, 0, 0, 0.7);

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  visibility: hidden;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--off-white);
  padding: 2.4rem;

  width: 90%;
  max-width: 550px;
  border-radius: 0.25rem;
}
.modal-content {
  max-width: 550px;
}
.modal-content h2 {
  margin-top: 0;
}

/*=== Form ======*/
.input-group {
  margin-top: 0.8rem;
}
.input-group input {
  border: none;
  padding: 0.8rem;
  width: 100%;
  border-radius: 0.25rem;
  font-size: 14px;
  border: 1px solid transparent;
}

.input-group small {
  opacity: 0.4;
  font-size: 12px;
}
.input-group.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.input-group.actions .button,
.input-group.actions button {
  width: 48%;
}

.input-group span.error {
  display: flex;
  padding: 0;
  background-color: rgba(233, 41, 41, 0.3);
  color: var(--red);
  font-size: 12px;
  border-radius: 0 0 0.2rem 0.2rem ;
  margin-top: -2px;
}

.input-group span.error.active {
  border-left: 1px var(--red) solid;
  border-right: 1px var(--red) solid;
  border-bottom: 1px var(--red) solid;
  padding: 0.4em;
}

/*=== Footer =========*/
footer {
  padding: 4rem 0 2rem;
  text-align: center;
  opacity: .6;
}
footer p {
  color: var(--blue-dark);
}

/*=== GitHub Corners by Tim Holman (@twholman) ======*/
.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}

/*=== Responsive ======*/
@media (min-width: 800px) {
  html {
    font-size: 87.5%;
  }
  #balance {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
  
}

@media (max-width: 500px) {
  .actions,
  .json {
    flex-direction: column;
    width: 100%;
  }
  #transactions .actions {
    margin-bottom: 0;

  }
  #transactions .actions .button{
    width: 100%;
    margin-bottom: 0.8rem;
  }
  .json .button-wrapper {
    margin-left: 0;
    margin-bottom: 0.8rem;
  }
  .input-group {
    flex-direction: row;
  }
  footer {
    padding-top: 0.8rem;
  }
}