/*GLOBAL STYLES*/
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

* {
    margin: 0;
    padding: 0;
    font-family: 'DM Sans', sans-serif;
    box-sizing: border-box;
}

body {
    background: linear-gradient(90deg, #abd0ff 0%, #9c6cff 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    user-select: none;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    margin: 50px auto;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    min-width: 400px;
    max-width: 550px;
    text-align: center;
    animation: fadeInContainer 1.5s ease-out forwards;
    -webkit-tap-highlight-color: transparent;
}

h1 {
    color: rgb(102, 126, 234);
    font-weight: 700;
}

hr {
    margin-top: 20px;
    border-radius: 20px;
    border: none;
    list-style: none;
    background: #667eea;
    height: 2px;
    width: 50%;
}

.items-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: max-content;
    margin: 20px auto;
    gap: 8px;
}

input[type="text"] {
    padding: 12px 15px;
    border: 2px solid #eee;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: #667eea;
}

.main-elements {
    justify-content: center;
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 5px;
}

.buttons {
    display: flex;
    gap: 5px;
}

button {
    cursor: pointer;
    border: none;
    padding: 8px 12px;
    background: #667eea;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    transition: filter 0.3s ease, box-shadow 0.3s ease;
}

.delBtn:hover, #btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(91, 107, 242, 0.1);
}

#btn, #clear {
    border: 2px solid #667eea;
    padding: 10px 20px;
}

#btn {
    background-color: #667eea;
    color: #fff;
}

.delBtn {
    background: #667eea;
    margin-left: 10px;
    color: #ffffff;
    font-weight: bold;
    user-select: none;
    -webkit-user-drag: none;
}

#clear {
    cursor: pointer;
    background: none;
    border: 2px solid #5b6bf2;
    color: #5b6bf2;
    box-shadow: inset 0 0 0 rgba(68, 85, 229, 0);
    transition: all 0.3s ease;
}

#clear:hover {
    border-color: #4455e5;
    color: #4455e5;
    box-shadow: inset 0 -10px 10px rgba(68, 85, 229, 0.15);
}

ol {
    padding: 0 5px 0 0;
    list-style: none;
    text-align: left;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}

/* SCROLL */
ol::-webkit-scrollbar {
    width: 6px;
}

ol::-webkit-scrollbar-track {
    background: transparent;
}

ol::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 10px;
}

ol::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.4);
}

li {
    width: auto;
    margin-top: 15px;
    cursor: pointer;
    background: #ffffff;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeIn 0.4s ease;
    border-left: 5px solid #667eea;
    transition: border-left-color 0.3s, background-color 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    user-select: text !important;
    touch-action: pan-y;
    -webkit-user-drag: auto;
    user-drag: auto;
}

li:hover {
    background: #f4f5ff;
}

.agree {
    border-left-color: #ccc;
}

.done {
    text-decoration: line-through;
    opacity: 0.6;
    cursor: pointer;
}

#counter, #activeItems, #completedItems {
    color: #667eea;
    font-weight: bold;
}

#message {
    color: #8c8c8c;
    text-shadow: 0 2px 2px rgba(115, 115, 115, 0.2);
    margin-top: 10px;
}

.jump-animation {
    animation: bounce 0.3s ease;
}

.message-animation {
    animation: messageFade 0.6s ease;
}

/* KEYFRAMES */
@keyframes messageFade {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes bounce {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-1px);
    }
    100% {
        transform: translateY(0);
    }
}

@keyframes fadeInContainer {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* MEDIA QUERIES */
@media (max-width: 768px) {

    @media (pointer: coarse) {
        html, body {
            overflow-y: hidden !important;
            height: 100%;
        }
    }

    @media (pointer: fine) {
        html, body {
            overflow-y: auto !important;
        }
    }

    /* GENERAL MOBILE STYLES */
    .container {
        min-width: unset;
        width: 85%;
        max-width: 360px;
        padding: 1.5rem 1rem;
    }

    .main-elements {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    input[type="text"] {
        width: 80%;
    }

    .buttons {
        width: 90%;
        justify-content: center;
    }

    hr {
        width: 80%;
    }
}
