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

:root {
  --dark: hsl(43, 93%, 54%);
  --medium: hsl(48, 99%, 58%);
  --light: hsl(47, 95%, 75%);
  --grey: hsl(0, 0%, 80%);
  --black-hover: hsl(220, 7%, 40%);
  --yellow-hover: hsl(43, 93%, 60%);
}

body {
  min-height: 100vh;
  padding: 1rem;
  font-family: "Poppins", sans-serif;
  font-weight: 400;
  background-color: var(--dark);
}

main {
  width: 100%;
  max-width: 600px;
  margin: 4rem auto;
}

.border-radius {
  border-radius: 0.3rem;
}

h1 {
  margin-bottom: 1.5rem;
}

.input-box {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 600px;
}

input {
  padding: 0.2rem;
  min-width: 0;
  width: 100%;
  border: none;
  border-radius: 0.3rem;
}

button {
  padding: 0.2rem 0.8rem;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
}

#search {
  background-color: var(--light);
  font-weight: 500;
  border: none;
  transition: 0.4s;
}

#search:hover {
  background-color: hsl(43, 93%, 90%);
}

#add {
  color: white;
  background-color: hsl(220, 38%, 3%);
  font-weight: 500;
  border: none;
  transition: 0.4s;
}

#add:hover {
  background-color: var(--black-hover);
}

.input-box input {
  background-color: rgb(248, 248, 248);
}

#add-edit-modal {
  background-color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 90%;
  width: 90%;
  max-width: 600px;
  padding: 2rem 3rem;
  border-radius: 0.5rem;
}

#mobile-preview {
  border: 1px solid black;
  background-color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 70%;
  width: 100%;
  max-width: 300px;
  padding: 2rem;
  border-radius: 0.5rem;
  z-index: 10;
}

.modal-title {
  display: flex;
  justify-content: space-between;
}

.close-btn {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

.modal-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

.pfp,
.pfp-mobile {
  width: 200px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  align-self: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pfp span,
.initials-mobile {
  font-size: 5rem;
}

form {
  display: flex;
  flex-direction: column;
}

#enter-name,
#enter-number {
  padding: 0.5rem 0.2rem;
  border-bottom: 2px solid var(--dark);
  border-radius: 0;
}

#enter-name:focus,
#enter-number:focus {
  outline: none;
  box-shadow: 0 0 5px var(--dark);
}

.modal-body-mobile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  gap: 1rem;
}

.modal-body-mobile p {
  display: flex;
  justify-content: space-between;
}

.label {
  color: var(--dark);
}

.close-btn-mobile {
  display: flex;
  justify-self: flex-end;
  border: none;
  background: none;
}

.modal-body input {
  flex: 0 0 auto;
  margin-bottom: 1rem;
}

.btns-wrapper,
.btns-wrapper-mobile {
  display: flex;
  gap: 0.8rem;
  width: 100%;
  margin-top: 1rem;
}

.btns-wrapper button,
.btns-wrapper-mobile button {
  flex: 1 1 50%;
  padding: 0.5rem 0;
  border-radius: 0.5rem;
}

#cancel {
  background-color: black;
  color: white;
  transition: 0.4s;
  border: none;
}

#cancel:hover {
  background-color: var(--black-hover);
}

#save {
  background-color: var(--medium);
  border: none;
  transition: 0.4s;
}

#save:hover {
  background-color: var(--yellow-hover);
}

.edit-btn-mobile {
  background-color: var(--medium);
  border: none;
  transition: 0.4s;
}

.edit-btn-mobile:hover {
  background-color: var(--yellow-hover);
}

.delete-btn-mobile {
  background-color: black;
  border: none;
  color: white;
  transition: 0.4s;
}

.delete-btn-mobile:hover {
  background-color: var(--black-hover);
}

.hide {
  display: none;
}

.list-wrapper {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  border: none;
  border-radius: 0.5rem;
  background-color: rgb(248, 248, 248);
  margin: 1rem 0;
  height: 400px;
  width: 600px;
}

.contact-list {
  margin: 0 0.5rem 0.5rem 0.5rem;
  overflow-y: auto;
  height: 100%;
}

.contact-list .empty-list {
  text-align: center;
  margin: 3rem;
  padding: 1rem 0;
  border: 2px dashed var(--grey);
  color: var(--grey);
}

#add-2 {
  border: none;
  background: none;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  text-decoration: underline;
  color: var(--medium);
}

.contact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
  border-radius: 0.8rem;
  background-color: var(--light);
  padding: 1rem;
  margin-top: 0.5rem;
  width: 100%;
  transition: 0.4s;
}

.contact:hover {
  background-color: var(--medium);
}

.contact.active {
  background-color: var(--medium);
}

.icons-wrapper {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.icons-wrapper button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  border-radius: 0.5rem;
  transition: 0.4s;
  border: none;
}

.icons-wrapper button:first-child {
  background-color: var(--dark);
}

.icons-wrapper button:first-child:hover {
  background-color: var(--yellow-hover);
}

.icons-wrapper button:nth-child(2) {
  border: none;
  background-color: black;
  color: var(--medium);
  transition: 0.4s;
}

.icons-wrapper button:nth-child(2):hover {
  background-color: var(--black-hover);
}

.contact-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid rgb(189, 189, 189);
  background-color: rgb(255, 252, 235);
  margin: 0.5rem 0.5rem 0.5rem 0;
  padding: 2rem;
  min-height: 0;
}

.contact-preview .empty-preview {
  text-align: center;
  color: var(--grey);
}

.pfp-small {
  width: 150px;
  margin: 0 auto 1rem auto;
}

.pfp-small span {
  font-size: 3rem;
}

.preview-btns-wrapper {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 1rem;
}

.preview-btns-wrapper button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  border-radius: 0.3rem;
}

.edit-btn {
  background-color: var(--medium);
  border: none;
  transition: 0.4s;
}

.edit-btn:hover {
  background-color: var(--yellow-hover);
}

.delete-btn {
  color: white;
  background-color: black;
  border: none;
  transition: 0.4s;
}

.delete-btn:hover {
  background-color: var(--black-hover);
}

.justify {
  display: flex;
  justify-content: space-between;
  text-align: right;
  font-size: 0.9rem;
}

@media (max-width: 769px) {
  body {
    margin: 0 1rem;
  }
  .list-wrapper {
    width: 100%;
    grid-template-columns: 1fr;
  }
  .contact-preview {
    display: none;
  }

  #overlay {
    display: none;
  }
  #overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background-color: rgb(0, 0, 0, 0.8);
    z-index: 9;
  }
}
