.expense-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 50rem;
  max-width: 90%;
  border-radius: 1rem;
  background-color: #f3f3f3;
  box-shadow: 0 4rem 6rem rgba(0, 0, 0, 0.3);
  z-index: 2002;
  transition: all 0.5s;
}

#expense-modal.show {
  display: flex !important;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 0;
  /* border: 1px solid #888; */
  border-radius: 1rem;
  width: 100%;
  /* max-width: 60rem; */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  /* animation: modalFadeIn 0.3s; */
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 15px;
  background-color: rgb(249, 102, 102, 0.8);
  color: #333;
  border-radius: 5px 5px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 2.2rem;
  font-weight: 500;
  margin: 0; /* Poistetaan ylimääräiset marginaalit */
  line-height: 1.2;
}

.close-button {
  color: #333;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

/* Viimeinen span (summa) oikealle */
.modal-body li span:last-child {
  text-align: right;
}

/* Keskimmäinen span (päivämäärä) keskelle */
.modal-body li span:nth-child(2) {
  text-align: left;
}

.modal-body li:last-child {
  border-bottom: none;
}

.modal-body {
  max-height: 40rem; /* Aseta sopiva maksimikorkeus */
  overflow-y: auto; /* Mahdollistaa pystysuuntaisen vierityksen, kun sisältö ylittää max-height-arvon */
  padding: 15px; /* Sisäinen täyte, jotta sisältö ei ole kiinni reunoissa */
  scrollbar-width: thin; /* Firefox-selaimille */
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent; /* Firefox-selaimille vierityspalkin väri */
}

/* Kun scrollable-luokka on lisätty, nämä tyylit aktivoituvat */
.modal-body.scrollable {
  border-bottom: 1px solid #eee; /* Visuaalinen vihje vieritettävästä sisällöstä */
}

/* Vierityspalkin ulkoasu Webkit-selaimille (Chrome, Safari, Edge) */
.modal-body::-webkit-scrollbar {
  width: 8px; /* Vierityspalkin leveys */
}

.modal-body::-webkit-scrollbar-track {
  background: transparent; /* Vierityspalkin tausta */
}

.modal-body::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3); /* Vierityspalkin väri */
  border-radius: 4px; /* Pyöristetyt kulmat */
}

/* Kun tapahtumia on paljon, lisätään pieni visuaalinen vihje käyttäjälle */
.modal-body.scrollable::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 1),
    rgba(255, 255, 255, 0)
  );
  pointer-events: none; /* Jotta käyttäjä voi vierittää tämän elementin läpi */
}

.modal-body ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.modal-body li {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  color: #444;
  font-size: 1.6rem;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #eee;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: background-color 0.2s;
}

.modal-body li:hover {
  background-color: #f5f5f5;
}

.modal-body .expense-date {
  font-weight: bold;
}

.modal-body .expense-amount {
  text-align: right;
  font-weight: bold;
}

.modal-empty-message {
  font-size: 1.4rem;
  text-align: center;
  color: #555;
  padding: 20px;
}
.modal-footer {
  padding: 15px;
  text-align: right;
  border-top: 1px solid #ddd;
}

.modal-close-btn {
  background-color: rgb(249, 102, 102, 0.8);
  color: #333;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.modal-close-btn:hover {
  background-color: rgb(249, 102, 102);
}
