@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

*,
*::after,
*::before {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

body {
  background-color: #222222;
  color: #afafaf;
  font-family: 'Poppins', 'Arial';
}

#main-container {
  display: flex;
  justify-content: center;
  margin: 0 auto;
  flex-direction: row;
  gap: 1em;
}

button {
  cursor: pointer;
  outline: none;
  border: none;
  color: white;
  background-color: #a53f3f;
  border-radius: 0.25em;
  box-shadow: 0px 0px 5px black;

  &:hover {
    background-color: #c16060;
  }
}

h1 {
  font-size: 2.5em;
  text-align: center;
  margin-bottom: 1em;
  margin-top: 1em;
  color: #a53f3f;
  text-shadow: 0 0 10px black;
}

nav {
  border-radius: 0.5em;

  ul {
    border: 1px solid black;
    border-radius: 0.5em;
    background-color: #1a1a1a;
    box-shadow: 2px 2px 7px rgb(0, 0, 0);
    background-color: #1a1a1a;
    border-radius: 0.5em;
    list-style-type: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    li {
      text-shadow: 0px 0px 3px black;
      padding: 1.25em;
      cursor: pointer;
      background-color: #1a1a1a;
      transition: all 0.2s ease;

      img {
        max-width: 16px;
      }

      &:nth-of-type(1) {
        border-top-left-radius: 0.5em;
        border-top-right-radius: 0.5em;
      }

      &:nth-of-type(4) {
        border-bottom-left-radius: 0.5em;
        border-bottom-right-radius: 0.5em;
      }

      &:hover {
        color: #c16060;
        background-color: rgb(40, 40, 40);
      }

      &:not(:hover) {
        background-color: red;
        background-color: #1a1a1a;
        transition: none;
      }

      &.active {
        color: #c16060;
        background-color: rgb(15, 14, 14);
      }
    }
  }
}

main {
  border: 1px solid black;
  background-color: #1a1a1a;
  box-shadow: 2px 2px 7px rgb(0, 0, 0);
  border-radius: 0.5em;
  width: 70%;

  .contact {
    border-bottom: 1px solid #151515;

    &:hover {
      background-color: #1c1c1c;
    }
  }

  select {
    min-width: 100px;
    padding: 0.2em;
    background-color: #dcc3c3;
    box-shadow: 0px 0px 5px black;
    border: none;
    border-radius: 0.2em;
  }

  input {
    background-color: #dcc3c3;
    border-radius: 0.2em;
    border: none;
    height: 2em;
    padding: 0 0.35em;
  }

  /* Seccion añadir */
  #add-section {
    display: grid;
    grid-template-columns: 1fr;

    /* Para los labels y los inputs */
    .fila {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      padding: 1em;
    }

    /* Para el botón */
    .fila-alinear-dcha {
      display: flex;
      justify-content: end;
      padding: 1em;
      gap: 1em;
    }

    button {
      width: 20%;
      height: 3em;

      @media (max-width: 768px) {
        width: 100%;
        height: 3em;
      }
    }

    input {
      width: 80%;
      
      @media (max-width: 768px) {
        width: 70%;
      }
    }

    #error {
      color: red;
    }
  }

  /* Sección listar */
  #list-section {
    #list-section-info {
      padding: 2em;
      text-align: center;
    }

    #no-contacts-container {
      display: flex;
      flex-direction: column;
      justify-items: center;
      align-items: center;

      #add-button-list {
        margin-bottom: 1em;
        width: 20%;
        height: 3em;
        padding: 0.5em;
      
        @media (max-width: 768px) {
          width: fit-content;
          height: 3em;
        }
      }
    }


    .contact {
      display: grid;
      grid-template-columns: 3fr 3fr 2fr 1fr;
      gap: 1em;
      align-items: center;
      padding: 0.5em 1em;
      margin: 0.5em;
      border-radius: 0.5em;
      background-color: #222222;

      @media (max-width: 768px) {
        grid-template-columns: 1fr;
        text-align: center;
      }

      &:nth-last-of-type(1) {
        border-bottom: none;
      }

      &:hover {
        background-color: #2e2e2e;
      }

      #button-container {
        display: flex;
        gap: 0.5em;
        justify-content: end;

        @media (max-width: 768px) {
          justify-content: center;
          /* background-color: red; */
          width: 100%;
        }

        button {
          font-size: 1em;
          width: fit-content;
          background-color: transparent;
          border: none;
          cursor: pointer;
          text-align: right;
          border-radius: 0.2em;
          padding: 0.5em;
          justify-self: end;
          box-shadow: none;
          /* transition: all 0.1s ease; */

          @media (max-width: 768px) {
            text-align: center;
            width: 50%;
            justify-self: center;
            background-color: rgb(40, 40, 40);
          }

          &:hover {
            background-color: rgb(77, 77, 77);
          }
        }
      }
    }
  }

  /* Sección Editar */
  #edit-section {
    select {
      width: 80%;
    }

    /* Para los labels y los inputs */
    .fila {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      padding: 1em;
      gap: 2em;
    }

    /* Para el botón */
    .fila-alinear-dcha {
      display: flex;
      padding: 1em;
      gap: 1em;
      justify-content: end;

    }

    button {
      width: 20%;
      height: 3em;

      @media (max-width: 768px){
        width: 50%;
        height: 3em;
       }

      &:disabled {
        color: rgb(170, 170, 170);
        background-color: #737373;
      }
    }

    input {
      width: 80%;

       @media (max-width: 768px){
        width: 65%;
       }
    }

    #error {
      color: red;
    }
  }

  /* Sección Buscar */
  #search-section {
    .search-menu {
      margin-top: 1em;
      margin-bottom: 1em;
      display: flex;
      flex-direction: column;
      gap: 0.5em;
      justify-content: center;
      align-items: center;

      #input-search-string {
        max-width: 200px;
        height: 1.8em;
        margin-left: 1em;
      }

      @media (max-width: 768px){
        span {
          display: none;
        }

        #input-search-string {
          width: 50%;
          height: 1.8em;
          margin-left: 1em;
        }
      }
    }

    input[type="checkbox"] {
      height: auto;
    }

    #checkbox-exact-search {
      width: 12px;
    }

    #checkbox-case-sensitive {
      width: 12px;
      margin-left: 1em;
    }

    .contact {
      display: grid;
      grid-template-columns: 2fr 2fr 1fr;
      gap: 1em;
      align-items: center;
      padding: 0.75em 1em;
    }

    .contact> :nth-child(3) {
      text-align: right;
    }

    label {
      margin-top: 3em;
    }

    p#info {
      padding: 2em;
      text-align: center;
    }
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  #main-container {
    display: flex;
    justify-content: center;
    margin: 0 auto;
    flex-direction: column;
    gap: 1em;
  }

  nav {
    ul {
      display: grid;
      grid-template-columns: 1fr 1fr;
      margin: 0 1em;

      li {
        &:nth-of-type(1) {
          border-top-left-radius: 0.5em;
          border-top-right-radius: 0em;
        }

        &:nth-of-type(2) {
          border-top-right-radius: 0.5em;
        }

        &:nth-of-type(3) {
          border-bottom-left-radius: 0.5em;
        }

        &:nth-of-type(4) {
          border-bottom-left-radius: 0.5em;
          border-bottom-left-radius: 0em;
        }
      }
    }
  }

  main {
    border: 1px solid black;
    background-color: #1a1a1a;
    box-shadow: 2px 2px 7px rgb(0, 0, 0);
    border-radius: 0.5em;
    width: 92%;
    margin: 0 1em;
  }
}