@import url("reset.css");

* { box-sizing: border-box; }
body { font: normal 16px Helvetica, Arial, sans-serif; }
a { text-decoration: none; }

/* BUTTON */
button {
  display: inline-block;
  background: inherit;
  padding: 10px 15px;
  color: #654b8e;
  border: 1px solid #654b8e;
  border-radius: 5px;
  transition: all .25s ease-in;
  cursor: pointer;
}

button:hover {
  background: #654b8e;
  color: white;
}


/* INPUTS */
input {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  transition: all .25s ease-in;
}

input:focus {
  outline: none;
  border: 1px solid rgba(101, 175, 233, .75);
  box-shadow: 0 0 10px 1px rgba(101, 175, 233, .5);
}

input.invalid { border-color: red; }
input.invalid:focus { box-shadow: 0 0 10px 1px red; }


/* HEADER */
header {
  background: #654b8e;
  padding: 25px 0;
  color: rgba(255, 255, 255, .7);
  font-size: 20px;
  text-align: center;
}

header a {
  display: inline-block;
  margin-bottom: 20px;
  color: white;
  font-size: 36px;
}

/* MAIN */
main { padding-bottom: 150px; }


/* WRAPPER */
.wrapper {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
}


/* MENU */
#menu {
  position: absolute;
  top: 0;
  background: #f5f5f5;
  width: 100%;
  padding: 25px 0;
  text-align: center;
  border: 1px solid #dfdfdf;
  border-top: none;
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
  z-index: 1;
}

.add-contact { margin-right: 150px; }

#search:disabled,
.reset:disabled {
  cursor: not-allowed;
}

.reset:disabled {
  background: inherit;
  color: #654b8e;
}


/* FOOTER */
footer {
  padding: 20px 0 50px 0;
  text-align: center;
  border-top: 1px solid #dfdfdf;
}


/* NEW CONTACT */
#form-section {
  display: none;
  position: relative;
  background: white;
  padding-top: 50px;
  font-size: 14px;
  z-index: 2;
}

#form-section h2 {
  padding-bottom: 20px;
  margin-bottom: 20px;
  font-size: 30px;
  text-align: center;
  border-bottom: 1px solid #dfdfdf;
}

#form-section form {
  width: 500px;
  margin: 0 auto;
}

#form-section dt {
  float: left;
  width: 30%;
  padding: 10px 0;
  font-weight: bold;
  text-align: right;
}

#form-error,
.error {
  color: red;
  font-size: 16px;
  text-align: center;
}

#form-error { opacity: 0; }

.error {
  display: block;
  height: 18px;
  margin: 10px 0;
  opacity: 0;
  text-align: left;
}

#form-section dd { margin: 25px 0 25px 35%; }
#form-section input { width: 100%; }

.btn-group {
  margin-left: 35%;
  text-align: center;
}

.btn-group button { width: 45%; }
.btn-group button + button { margin-left: 10%; }


/* CONTACTS */
#contacts {
  position: relative;
  padding-top: 150px;
  font-size: 0;
}

/* NO CONTACTS */
.no-contacts {
  background: #f5f5f5;
  padding: 40px 0;
  font-size: 24px;
  text-align: center;
  border: 1px solid #dfdfdf;
  border-radius: 5px;
}


/* CONTACT */
.contact {
  position: relative;
  display: inline-block;
  vertical-align: top;
  width: 24%;
  height: 300px;
  margin: 0 .5% 20px .5%;
  font-size: 14px;
  border-bottom: 1px solid #dfdfdf;
}

.contact::after {
  display: block;
  content: "";
  min-width: 100%;
  margin-top: 70px;
}

.contact h3 {
  font-size: 24px;
  margin-bottom: 20px;
}

.contact dt { font-weight: bold; }
.contact dd { margin: 2px 0 10px 0; }
.confirm { color: red; }

.edit-delete,
.yes-no {
  position: absolute;
  bottom: 10px;
}

.yes-no { display: none; }

.confirm {
  position: absolute;
  bottom: 60px;
  opacity: 0;
}

button.yes {
  color: red;
  border-color: red;
}

button.yes:hover {
  color: white;
  background: red;
}

button.no {
  color: green;
  border-color: green;
}

button.no:hover {
  color: white;
  background: green;
}


/* TAGS */
.tag {
  display: inline-block;
  background: #d0f2ef;
  padding: 3px;
  margin: 2px 1px;
  border: 1px solid #99fff6;
  cursor: pointer;
  transition: background .25s ease-in;
}

.tag:hover { background: #99fff6; }


/* Contacts are now 3 per row */
@media (max-width: 1000px) {
  #menu {
    width: 100%;
    border-right: none;
    border-left: none;
    border-radius: 0;
  }

  .contact {
    width: 29%;
    margin-left: 2%;
    margin-right: 2%;
  }
}


/* Contacts are now 3 per row */
@media (max-width: 768px) {
  .add-contact {
    display: block;
    margin: 0 auto 10px auto;
  }

  .contact { width: 46%; }
}


/*
* Contacts are now 2 per row
* Form looks better for mobile
*/
@media (max-width: 600px) {
  .contact {
    width: 90%;
    left: 5%;
    text-align: center;
  }

  .contact:last-child { border: none; }
  .contact dd { margin: 5px 0 20px 0; }

  .edit-delete,
  .yes-no {
    left: 50%;
    margin-left: -50px;
  }

  .confirm {
    right: 0;
    left: 0;
  }

  main { padding-bottom: 75px; }
  #form-section { padding-top: 10px; }
  #form-section h2 { margin-bottom: 10px; }

  #form-section form {
    width: 90%;
    margin: 0 auto;
  }

  #form-section dt {
    float: none;
    width: 100%;
    padding: 10px 0;
    text-align: left;
  }

  #form-section dd { margin: 0 0 10px 0; }

  .btn-group {
    margin-top: 10px;
    margin-left: 0;
  }
}