:root {
    /* Colors */
    --alert-red: #c93847;
    --background: #f4f5fb;
    --text-slate: #374151;
    --text-bold: #1e3256;
    --text-gray: #9ca3af;
    --border-gray: #d1d5db;
    --main-pink: #ca3884;
}

* {
    font-family: 'Inter';
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--background);
    overflow-x: hidden;
}

html,
body {
    height: 100%;
}

.container {
    width: min(1200px, calc(100% - 32px));
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-content: start;
    column-gap: 20px;
    margin: 0 auto;
    min-height: 100%;
}

.logo {
    display: flex;
    height: 40px;
    margin-top: 25px;
    margin-bottom: 62px;
    align-items: center;
    justify-content: center;
    grid-column: 6 / span 2;
}

.main-wrapper {
    grid-column: 3 / span 8;
    padding: 0 clamp(16px, 5vw, 75px);
    min-width: 0;
}

#back-button {
    cursor: pointer;
    width: 57px;
    height: 24px;
}

h2 {
    margin: 16px 0 0 0;
    color: var(--text-bold);
}

.form-wrapper {
    width: 100%;
    height: 44px;
    margin-top: 44px;
    display: flex;
    gap: 16px;
    align-items: stretch;
}

#add-item {
    box-sizing: border-box;
    border: 2px solid var(--border-gray);
    border-radius: 12px;
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    height: 100%;
    padding: 0 18px 0 18px;
    transition: all .2s ease-in-out;
    outline: none;
}

#add-item:focus {
    border-color: var(--main-pink);
}

#add-item::placeholder {
    color: var(--text-gray);
}

#add-btn {
    color: #fff;
    font-size: 16px;
    width: 160px;
    flex: 0 0 160px;
    height: 100%;
    margin: 0;
    border-radius: 12px;
    outline: 0;
    border: 0;
    background-color: var(--main-pink);
    transition: all .15s ease-in-out;
    cursor: pointer;
}

#add-btn:hover {
    background-color: #b32c72;
}

.logo img {
    max-width: 100%;
    height: auto;
}

.list-container {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: min(48dvh, 380px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0;
}

.list-item {
    width: 100%;
    min-height: 48px;
    background-color: #ffffff;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color .2s ease;
}

.list-item:hover {
    background-color: #f9fafb;
}

.checkbox-envelope {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    border: 0;
    background: transparent;
}

.checkbox {
    width: 16px;
    height: 16px;
    border: 1.5px solid #b9c2d0;
    border-radius: 999px;
    background-color: var(--main-pink);
    border-color: var(--main-pink);
    position: relative;
    cursor: pointer;
}

.checkbox::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox.hidden {
    background-color: transparent;
    border-color: #b9c2d0;
}

.checkbox.hidden::after {
    display: none;
}

.item-name {
    color: var(--text-slate);
    font-size: 16px;
    line-height: 20px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item.completed {
    background-color: #eceff4;
    opacity: .72;
}

.list-item.completed .item-name {
    color: #6b7280;
    text-decoration: line-through;
}

.trash-icon-envelope {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s ease;
    border: 0;
    background: transparent;
}

.trash-icon-envelope:hover {
    opacity: 1;
}

.trash-icon-envelope img {
    width: 19px;
    height: 19px;
    display: block;
}

.list-container::-webkit-scrollbar {
    width: 8px;
}

.list-container::-webkit-scrollbar-track {
    background: transparent;
}

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

.list-container::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%) translateY(8px);
    width: min(640px, calc(100% - 24px));
    min-height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast.success {
    background-color: #2e9c62;
}

.toast.error {
    background-color: var(--alert-red);
}

.toast button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    opacity: .9;
}

.toast button:hover {
    opacity: 1;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.toast-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

#toast-message {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1024px) {
    .logo {
        grid-column: 5 / span 4;
        margin-bottom: 40px;
    }

    .main-wrapper {
        grid-column: 2 / span 10;
        padding: 0 clamp(12px, 4vw, 48px);
    }
}

@media (max-width: 768px) {
    .container {
        width: min(100%, calc(100% - 24px));
        grid-template-columns: 1fr;
        row-gap: 24px;
    }

    .logo {
        grid-column: 1;
        margin-top: 18px;
        margin-bottom: 8px;
    }

    .main-wrapper {
        grid-column: 1;
        padding: 0;
    }

    h2 {
        font-size: 34px;
        line-height: 1.2;
    }

    .form-wrapper {
        height: auto;
        flex-direction: column;
        gap: 12px;
    }

    .list-container {
        margin-top: 24px;
        max-height: min(50dvh, 360px);
    }

    #add-item,
    #add-btn {
        width: 100%;
        height: 44px;
    }

    #add-btn {
        flex-basis: auto;
    }

    .toast {
        width: calc(100% - 16px);
        left: 8px;
        right: 8px;
        bottom: 10px;
        transform: translateY(8px);
    }

    .toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .container {
        width: min(100%, calc(100% - 16px));
    }

    #back-button {
        width: 52px;
        height: 22px;
    }

    h2 {
        font-size: 30px;
        margin-top: 14px;
    }

    .form-wrapper {
        margin-top: 28px;
    }

    #add-item,
    #add-btn {
        height: 42px;
        font-size: 15px;
    }

    .list-item {
        padding: 10px;
        gap: 10px;
    }

    .item-name {
        font-size: 15px;
    }

    .list-container {
        max-height: min(46dvh, 320px);
    }

    .toast {
        min-height: 42px;
        padding: 9px 12px;
        font-size: 13px;
    }

    #toast-message {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}