* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --primary-color: #16151E;
    --secondary-color: #1A1924;
    --input-bg-color: #24243D;
    --font-color: #E1E1E6;
    --number-color: #8C8CBA;
    --letter-bg-color: #633BBC;

    font-family: 'Roboto', sans-serif;
    font-size: 62.5%;

    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    font-size: 1.6rem;

    display: grid;
    place-items: center;

    background: var(--input-bg-color);
}

input, button {
    all: unset;
}

#app {
    width: 100%;
    max-width: 43rem;
    max-height: 90vh;
    min-height: 66rem;

    border-radius: .8rem;
    background: var(--secondary-color);
    overflow: hidden;
    box-shadow: 3px 4px 26px 0px #00000040;

    animation: fromBottom 1s backwards;
}

header {
    padding: 4rem;
    height: 16.8rem;
    border-radius: .8rem;
    background: var(--primary-color);
}

header div {
    display: flex;
    justify-content: space-between;
}

header h1 {
    font-size: 2rem;
    line-height: 2.3rem;
    color: var(--font-color);
}

header .add-new-contact-btn {
    cursor: pointer;
    border-radius: 50%;
    transition: background .15s;
}

header .add-new-contact-btn:hover {
    background: #ffffff46;
}

header #search {
    width: 100%;
    height: 4rem;
    box-sizing: border-box;

    margin-top: 2.4rem;
    padding: 1.3rem 2.4rem 1.3rem 5rem;

    font-weight: 400;
    font-size: 1.2rem;
    line-height: 1.4rem;

    border-radius: .5rem;
    color: var(--font-color);
    background: var(--input-bg-color) url(./assets/search.svg);
    background-repeat: no-repeat;
    background-position: 2.4rem;
}

header #search::placeholder {
    color: var(--font-color);
}

.contact-list {
    padding: 4.8rem 4rem 2rem;
}

.container {
    max-height: 42.7rem;
    overflow-y: auto;
    overflow-x: hidden;

    display: flex;
    flex-direction: column;
    gap: 4.8rem;
}

.container::-webkit-scrollbar{
    width: .8rem;
}
  
.container::-webkit-scrollbar-track{
    background: transparent;
}

.container::-webkit-scrollbar-thumb {
    background: #282843;
    border-radius: 999px;
}
  

.contact-wrapper {
    position: relative;
}

.letter {
    width: 4rem;
    height: 4rem;

    display: grid;
    place-items: center;

    font-weight: 700;
    line-height: 1.9rem;

    position: absolute;
    top: 0;
    left: 0;

    border-radius: .8rem;
    color: var(--font-color);
    background: var(--letter-bg-color);
}

.contact {
    display: flex;
    align-items: center;
    gap: 1.6rem;

    padding-left: 9.2rem;

    position: relative;
}

.contact:not(:last-child) {
    margin-bottom: 3.2rem;
}

.info {
    display: flex;
    flex-direction: column;
    gap: .4rem;

    flex: 1;
}

.name {
    font-weight: 700;
    line-height: 1.9rem;
    color: var(--font-color);
}

.number {
    font-size: 1.2rem;
    line-height: 1.4rem;
    color: var(--number-color);
}

.photo {
    width: 4.8rem;
    height: 4.8rem;
}

.photo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #e1e1e1;
}

.trash-btn {
    width: 1.5rem;
    position: absolute;
    top: 50%;
    right: 2.4rem;
    transform: translateY(-50%);

    cursor: pointer;
}

.background-blur {
    width: 100%;
    height: 100%;

    position: absolute;
    top: 0;
    left: 0;
    backdrop-filter: blur(3px);
}

.add-new-contact {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    max-width: 38.5rem;
    width: 100%;

    padding: 2.4rem 2rem;
    border-radius: .8rem;
    background: #363447;
}

.add-new-contact input[type=text] {
    background: #282843;
}

.add-new-contact .img-preview {
    width: 6.8rem;
    height: 6.8rem;
    object-fit: cover;
    border-radius: 50%;
    background: #e1e1e1;
}

.file-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.6rem;
}

.file-wrapper label {
    border-radius: 999px;
    padding: .8rem 1.6rem;

    opacity: .8;
    font-size: 1.4rem;
    cursor: pointer;
    background: #282843;
    color: var(--font-color);

    transition: opacity .3s ease-in-out;
}

.file-wrapper label:hover {
    opacity: 1;
}

#file {
    display: none;
}

.input-wrapper {
    margin-block: 3.2rem;
}

.input-wrapper label {
    display: inline-block;
    margin-bottom: .4rem;
    font-size: 1.4rem;

    opacity: .8;
    color: var(--font-color);
}

.input-wrapper input {
    width: 100%;
    height: 3.2rem;
    border-radius: .4rem;

    color: var(--font-color);
    font-size: 1.4rem;

    padding-inline: 1.6rem;
    box-sizing: border-box;
    transition: all .3s ease-in-out;
}

.input-wrapper input::placeholder {
    font-size: 1.4rem;
}

#search:hover,
#search:focus,
.input-wrapper input:hover,
.input-wrapper input:focus {
    outline: .1rem solid #d1d1d1;
}

.input-wrapper input:nth-of-type(1) {
    margin-bottom: 1.2rem;
}

.add-new-contact button {
    display: block;
    margin: auto;
    padding: .8rem 2.4rem;

    cursor: pointer;
    color: var(--font-color);
    border-radius: 999px;
    background: #282843;

    transition: all .3s ease-in-out;
}

.add-new-contact button:hover {
    scale: 1.1;
}

.close {
    display: block;
    width: 2rem;
    height: 1.6rem;

    margin: 0 0 1.6rem auto;
    cursor: pointer;
}

.background-blur {
    display: none;
    animation: fromBottom .6s backwards;
}

.removeContact {
    animation: fadeOut .7s forwards;
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(2rem);
        opacity: 0;
    }
}

@keyframes fromBottom {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 470px) {
    #app {
        max-height: none;
        max-width: none;
        height: 100vh;
    }

    .contact-list {
        height: calc(100% - 16.8rem);
    }

    .container {
        padding-bottom: 1.6rem;
        max-height: none;
        height: 100%;
    }

    .add-new-contact {
        width: 90%;
        margin: auto;
    }
}

@media (max-width: 390px) {
    :root {
        font-size: 50%;
    }

    #app {
        max-width: none;
    }
}