/* ===== FONTE ===== */
/* @import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,400;0,700;1,100;1,400;1,700&display=swap'); */
@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,400;0,500;0,600;0,700;1,100;1,400;1,600;1,700&display=swap");

/* ===== GLOBAL ===== */
:root {
  /* ===== Font Colors ===== */
  --dark-blue: #363f5f;
  --green: #49aa26;
  --light-green: #3dd705;
  --red: #e92929;
  --table-color: #969cb3;

  /* ===== Theme ===== */
  --body-bg: #f0f2f5;
  --card-bg: #fff;

  /* ===== Transition Delays ===== */
  --nav-delay: 0.2s;
  --theme-delay: 0.2s;

  /* ===== SVG Animation ===== */
  --line-animation-delay: 1.3s; /* linha completar a volta */
  --line-timing-function: linear;
  --line-delay: 0.084s;

  /* delay da animação de cada letra */
  --line-i-delay: 0s;
  --line-ii-delay: calc(var(--line-delay) * 2);
  --line-iii-delay: calc(var(--line-delay) * 3);
  --line-iv-delay: calc(var(--line-delay) * 4);
  --line-v-delay: calc(var(--line-delay) * 5);
  --line-vi-delay: calc(var(--line-delay) * 6);
  --line-vii-delay: calc(var(--line-delay) * 7);
  --line-viii-delay: calc(var(--line-delay) * 8);
  --line-ix-delay: calc(var(--line-delay) * 9);
  --line-x-delay: calc(var(--line-delay) * 10);
  --line-xi-delay: calc(var(--line-delay) * 11);
  --line-xii-delay: calc(var(--line-delay) * 12);

  /* delay da animação de preenchimento */
  --fill-animation-delay: 0.4s;
  /* função de tempo */
  --fill-timing-function: linear;
  /* calcula o tempo para preencher */
  --fill-delay: calc(var(--line-xii-delay) + var(--line-animation-delay));
}

html {
  font-size: 93.75%; /* 100% de fonte = 16px (padrão do navegador) ||| Então para ser 15px: (100 * 15) / 16 = 93.75 */
}

html.dark {
  /* ===== Theme ===== */
  --body-bg: #222;
  --card-bg: #555;

  /* ===== Fonte ===== */
  --dark-blue: #f0f2f5;
  --red: #f44336;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--body-bg);
  font-family: "Poppins", sans-serif;
  transition: background var(--theme-delay) linear;
}

.container {
  /* Enquanto "90vw" for menor que "800px", ele utiliza "90vw". Quando passar, ele se mantém em "800px" */
  width: min(90vw, 800px);
  margin: 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== Global Elements ===== */
ul {
  list-style: none;
}

/* ===== Links & Buttons ===== */
a {
  color: var(--green);
  text-decoration: none;
  transition: color 0.2s linear;
}

a:hover {
  color: var(--light-green);
}

button {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 0.25rem;
  color: #fff;
  background-color: var(--green);
  cursor: pointer;
  transition: background-color 0.2s linear;
}

button:hover {
  background-color: var(--light-green);
}

.button.new {
  display: inline-block;
  margin-bottom: 0.8rem;
}

.button.cancel {
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: 0.25rem;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s linear;
}

.button.cancel:hover {
  opacity: 1;
}

/* ===== TITLES ===== */
h2 {
  margin: 3.2rem 0 0.8rem 0;
  color: var(--dark-blue);
  font-weight: 400;
}

/* ===== NAV =====*/
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  transition: var(--nav-delay) linear;
}

nav.active {
  background: #2d4a22f2;
}

nav img {
  height: 1.25rem;
  margin: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: var(--nav-delay) linear;
}

nav.active img {
  opacity: 1;
  visibility: visible;
}

nav li a {
  color: #fff;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

nav li a:hover {
  color: #fff;
}

nav li a span {
  display: inline-block;
  font-weight: 700;
}

nav li a span:first-child {
  margin-right: 0.45rem;
  display: none;
}

/* ===== HEADER ===== */
header {
  background: #2d4a22;
  padding: 4rem 0 11rem;
  text-align: center;
}

header svg {
  visibility: visible;
  opacity: 1;
  transition: var(--nav-delay) linear var(--nav-delay);
}

header svg.hide {
  visibility: hidden;
  opacity: 0;
}

/* ===== BALANCE ===== */
#balance {
  margin-top: -8rem;
}

#balance h2 {
  color: #fff;
  margin-top: 0;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  padding: 1.5rem 2rem;
  border-radius: 0.25rem;
  margin-bottom: 2rem;
  color: var(--dark-blue);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
  transition: var(--theme-delay) linear;
}

.card h3 {
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card p {
  margin-top: 1rem;
  overflow-x: auto;
}

.card.total {
  background: var(--green);
  color: #fff;
  transition: background 0.2s linear;
}

.card.total.red {
  background-color: var(--red);
}

/* ===== TABLE ===== */
#transaction {
  width: 100%;
}

.table-container {
  overflow-x: auto; /* habilita rolagem no eixo x quando necessário (quando estiver no mobile, por exemplo) */
}

#data-table {
  width: 100%;
  border-spacing: 0 0.5rem; /* eixo vertical / horizontal */
  color: var(--table-color);
}

table thead th {
  background: var(--card-bg);
  font-weight: 400;
  padding: 1rem 2rem;
  text-align: left;
  transition: var(--theme-delay) linear;
}

table tbody tr {
  opacity: 0.7;
}

table tbody tr:hover {
  opacity: 1;
}

table tbody td {
  background: var(--card-bg);
  padding: 1rem 1.3rem;
  transition: var(--theme-delay) linear;
}

table thead tr th:first-child,
table tbody tr td:first-child {
  border-radius: 0.25rem 0 0 0.25rem;
}

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 img {
  cursor: pointer;
}

td.description {
  color: var(--dark-blue);
}

td.income {
  color: #12a454;
}

td.expense {
  color: var(--red);
}

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

/* ===== MODAL ===== */
.modal-overlay {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  position: fixed;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  z-index: 999;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--body-bg);
  padding: 2.4rem;
  border-radius: 8px;
  width: min(90vw, calc(500px + 2.4rem)); /* ler a linha 28 */
  z-index: 1;
}

/* ===== Formulário do Modal ===== */
#form {
  width: 100%;
}

#form h2 {
  margin-top: 0;
}

.input-group {
  margin-top: 0.8rem;
}

.input-group input {
  border: none;
  border-radius: 0.2rem;
  padding: 0.8rem;
  width: 100%;
}

.input-group .help {
  color: var(--table-color);
}

.input-group.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-group.actions a.button,
.input-group.actions button {
  width: 48%;
}

/* ===== Modal do Menu =====*/
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.7);
  visibility: hidden;
  opacity: 0;
}

.menu-overlay.active {
  visibility: visible;
  opacity: 1;
}

/* ===== Container e itens do Menu ===== */
.menu {
  background: var(--body-bg);
  width: min(90vw, 400px);
  padding: 3rem 2rem;
  border-radius: 8px;
  text-align: center;
  position: relative;
  transition: background var(--theme-delay) linear;
  box-shadow: 0 5px 8px rgba(0, 0, 0, 0.6);
}

.menu h2 {
  letter-spacing: 0.1rem;
  margin: 0 0 1.5rem;
  text-transform: uppercase;
  font-weight: 600;
}

.menu .bar {
  width: 100%;
  height: 2px;
  background-color: var(--card-bg);
  border-radius: 2px;
  transition: var(--theme-delay) linear;
}

.menu ul {
  margin-top: 2rem;
}

.menu ul li ~ li {
  margin-top: 0.5rem;
}

.menu li a {
  color: var(--dark-blue);
  font-weight: 600;
  text-transform: uppercase;
  padding: 1rem 0;
  letter-spacing: 0.05rem;
  border-radius: 8px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s linear;
  overflow: hidden;
}

.menu li a:hover {
  background: var(--card-bg);
}

.menu li a span {
  position: relative;
  border-bottom: 1px dotted var(--dark-blue);
  line-height: 1rem;
  transition: border-bottom var(--theme-delay) linear;
  z-index: 1;
}

.menu li a i {
  position: absolute;
  left: auto;
  top: 50%;
  font-size: 3rem;
  opacity: 0.15;
  transform: translate(-50%, -50%) rotate(9deg);
  z-index: -1;
}

.menu li a i.fa-sun {
  opacity: 0.25;
  color: orange;
}

.menu li a i.fa-moon {
  opacity: 0.25;
  color: black;
}

.menu .close-menu {
  position: absolute;
  top: 5px;
  right: 5px;
  color: var(--dark-blue);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--theme-delay) linear;
}
