@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

:root {
    --primary: #8a2be2;
    --primary-dark: #5f1d9e;
    --secondary: #00c6fb;
    --bg-dark: #121212;
    --bg-darker: #0a0a0a;
    --text-light: #f5f5f5;
    --text-lighter: #ffffff;
    --card-bg: rgba(30, 30, 30, 0.9);
    --card-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(255, 255, 255, 0.1);
    --task-bg: rgba(255, 255, 255, 0.05);
    --task-hover: rgba(255, 255, 255, 0.012);
    --checkbox-bg: rgba(255, 255, 255, 0.1);
    --checkbox-hover: rgba(255, 255, 255, 0.2);
    --text-muted: rgba(255, 255, 255, 0.6);
    --text-completed: rgba(255, 255, 255, 0.5);
    --filter-active: rgba(138, 43, 226, 0.2);
    --filter-hover: rgba(138, 43, 226, 0.15);
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.3);

    --danger: #ff4d4d;
    --succes: #00e676;
    --high-priority: #ff4d4d;
    --medium-priority: #fdcb6e;
    --low-priority: #00b894;

    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-fast: all 0.15s ease-out;
}

[data-theme="light"] {
    --primary: #6c5ce7;
    --primary-dark: #5649d2;
    --secondary: #0984e3;
    --bg-dark: #f5f6fa;
    --bg-darker: #dfe6e9;
    --text-light: #2d3436;
    --text-lighter: #000000;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(0, 0, 0, 0.1);
    --input-bg: rgba(0, 0, 0, 0.05);
    --task-bg: rgba(255, 255, 255, 0.9);
    --task-hover: rgba(255, 255, 255, 1);
    --checkbox-bg: rgba(0, 0, 0, 0.1);
    --checkbox-hover: rgba(0, 0, 0, 0.2);
    --text-muted: rgba(45, 52, 54, 0.7);
    --text-completed: rgba(45, 52, 54, 0.5);
    --filter-active: rgba(108, 92, 231, 0.1);
    --filter-hover: rgba(108, 92, 231, 0.08);
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}


body {
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, var(--bg-darker), var(--bg-dark));
    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    margin: 0;
    color: var(--text-light);
    line-height: 1.6;
    transition: var(--transition);
    overflow: hidden;
}

.todo-container {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--card-border);
    transform-style: preserve-3d;
    perspective: 1000px;
    position: relative;
    transition: var(--transition);
    transform: translateY(20px);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.todo-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom right,
            rgba(138, 43, 226, 0.08) 0%,
            rgba(0, 198, 251, 0.04) 50%,
            rgba(138, 43, 226, 0.08) 100%);
    transform: rotate(30deg);
    z-index: -1;
    animation: shine 20s linear infinite;
    opacity: 0.6;
    pointer-events: none;
}

@keyframes shine {
    0% {
        transform: rotate(30deg) translate(-3%, -3%);
    }

    100% {
        transform: rotate(30deg) translate(3%, 3%);
    }
}

h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 2.5rem;
    transition: var(--transition);
    animation: textGlow 3s ease-in-out infinite alternate;
    font-weight: 600;
}

@keyframes textGlow {
    from { text-shadow: 0 0 5px rgba(138, 43, 226, 0.3); }
    to { text-shadow: 0 0 15px rgba(0, 198, 251, 0.05); }
}

.theme-selector {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.theme-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--card-border);
    transition: var(--transition);
    transform: scale(0);
    cursor: pointer;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: calc(var(--i)*0.1s);
}

@keyframes popIn {
    to { transform: scale(1); }
}

.theme-btn:hover {
    transform: scale(1.1) rotate(10deg) !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.theme-btn:active {
    border-color: var(--text-light);
    transform: scale(1.1) !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.mode-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--task-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1.2rem;
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
    animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s both;
    cursor: pointer;
}

@keyframes bounceIn {
    0%   { transform: scale(0); opacity: 0; }
    50%  { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.mode-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    background: var(--task-hover);
}

.add-task {
    display: flex;
    margin-bottom: 1.6rem;
    gap: 0.5rem;
    position: relative;
}

#new-task {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    background: var(--input-bg);
    color: var(--text-light);
    transition: var(--transition);
    border: 1px solid var(--card-border);
}

#new-task:focus {
    border-color: var(--primary);
    background: var(--task-hover);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#new-task::placeholder {
    color: var(--text-muted);
    transition: var(--transition-fast);
}

#new-task:focus::placeholder { opacity: 0.5; }

#add-btn {
    color: #fff;
    border: none;
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    border-radius: 8px;
    border: none;
    padding: 0 1.5rem;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#add-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

#add-btn:hover {
    background: linear-gradient(to right, var(--primary-dark), var(--primary));
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#add-btn:hover::before { left: 100%; }

#add-btn:active { transform: translateY(1px); }

.task-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.filter-btn {
    background: none;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-muted);
    position: relative;
    cursor: pointer;
}

.filter-btn:hover {
    color: var(--text-light);
    background: var(--filter-hover);
}

.filter-btn.active {
    background: var(--filter-active);
    color: var(--text-light);
}

.filter-btn.active::after {
    content: '';
    position: relative;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    animation: underlineGrow 0.3s ease-out;
}

@keyframes underlineGrow {
    from { width: 0; }
    to   { width: 50%; }
}

.task-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-height: 100px;
    position: relative;
    overflow-y: auto;
    flex: 1;
    padding-right: 5px;
    margin-bottom: 10px;
}

.task-list::-webkit-scrollbar { width: 6px; }

.task-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.task-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.task-list::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

.task {
    background: var(--task-bg);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    border-left: 3px solid var(--primary);
    transform-origin: top center;
    will-change: transform, opacity;
}

.task:hover {
    transform: translateY(-3px);
    background: var(--task-hover);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.task.completed {
    border-left-color: var(--succes);
    opacity: 0.8;
}

.task.completed:hover { opacity: 1; }

.task-content {
    flex: 1;
    margin: 0 1rem;
    word-break: break-word;
    color: var(--text-light);
    transition: var(--transition);
}

.task.completed .task-content {
    text-decoration: line-through;
    color: var(--text-completed);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.task-btn {
    background: var(--task-bg);
    border: 1px solid var(--card-border);
    font-size: 1rem;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
}

.task-btn:hover { transform: scale(1.1); }

.complete-btn:hover {
    background: rgba(0, 230, 118, 0.15);
    color: var(--succes);
    border-color: var(--succes);
}

.delete-btn:hover {
    background: rgba(255, 77, 77, 0.15);
    color: var(--danger);
    border-color: var(--danger);
}

.priority-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
}

.priority-high {
    background-color: var(--high-priority);
    box-shadow: 0 0 5px var(--high-priority);
    animation: pulse 1.5s infinite ease-in-out;
}

.priority-medium {
    background-color: var(--medium-priority);
    box-shadow: 0 0 5px var(--medium-priority);
    animation: pulse 1.5s infinite ease-in-out;
}

.priority-low {
    background-color: var(--low-priority);
    box-shadow: 0 0 5px var(--low-priority);
    animation: pulse 2.5s infinite ease-in-out;
}

@keyframes pulse {
    0%,
    100% { transform: scale(1); opacity: 0.8; }
    50%  { transform: scale(1.1); }
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s forwards;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary);
    opacity: 0.7;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% { transform: translateY(0); }
    50%  { transform: translateY(-10px); }
}

@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
}

.checkbox-container {
    display: block;
    position: relative;
    width: 22px;
    height: 22px;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
    width: 22px;
    background-color: var(--checkbox-bg);
    border-radius: 5px;
    transition: var(--transition);
    border: 1px solid var(--card-border);
}

.checkbox-container:hover .checkmark {
    background-color: var(--checkbox-hover);
    transform: scale(1.1);
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--succes);
    border-color: var(--succes);
}

.checkmark::after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark::after {
    display: block;
    animation: checkmarkDraw 0.3s forwards;
}

@keyframes checkmarkDraw {
    from {
        width: 0;
        height: 0;
        border-width: 0;
    }

    to {
        width: 5px;
        height: 10px;
        border-width: 0 2px 2px 0;
    }
}

.checkbox-container .checkmark::after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.priority-selector-container {
    display: flex;
    justify-content: center;
    margin: 0.3rem 0;
    width: 100%;
    position: relative;
    z-index: 10;
}

.priority-selector {
    display: flex;
    background: var(--task-bg);
    padding: 0.3rem;
    border-radius: 50px;
    box-shadow: var(--shadow);
    align-items: center;
    transition: var(--transition);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: visible;
    isolation: isolate;
}

.priority-selector::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
            rgba(138, 43, 226, 0.1) 0%,
            rgba(0, 198, 251, 0.05) 50%,
            rgba(138, 43, 226, 0.1) 100%);
    z-index: 0;
    opacity: 0.5;
    border-radius: 50px;
}

.priority-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0.6rem;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.priority-options {
    display: flex;
    gap: 0.5rem;
    position: relative;
    z-index: 100;
    align-items: center;
}

.priority-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border: 2px solid transparent;
    z-index: 100;
}

.priority-option::before {
    content: attr(data-priority);
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    background: var(--card-bg);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    opacity: 0;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--card-border);
    z-index: 1000;
    pointer-events: none;
}

.priority-option::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transition: var(--transition);
    z-index: 1;
}

.priority-option:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

.priority-option[data-priority="High"]::after {
    background: var(--high-priority);
    box-shadow: 0 0 2px rgba(255, 77, 77, 0.3);
}

.priority-option[data-priority="Medium"]::after {
    background: var(--medium-priority);
    box-shadow: 0 0 2px rgba(255, 203, 103, 0.3);
}

.priority-option[data-priority="Low"]::after {
    background: var(--low-priority);
    box-shadow: 0 0 2px rgba(0, 184, 148, 0.3);
}

.priority-option.selected {
    border-color: rgba(255, 255, 255, 0.3);
}

.priority-option.selected::after {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 0 8px currentColor;
}

.priority-option.selected[data-priority="High"] {
    background: rgba(255, 77, 77, 0.1);
}

.priority-option.selected[data-priority="Medium"] {
    background: rgba(253, 203, 110, 0.1);
}

.priority-option.selected[data-priority="Low"] {
    background: rgba(0, 184, 148, 0.1);
}

.priority-slider {
    position: absolute;
    top: 50%;
    left: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    z-index: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    transform: translateY(-50%);
    pointer-events: none;
}

.task-meta {
    display: flex;
    flex-direction: column;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0.3rem;
}

.task-date {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.task-date i { font-size: 0.6rem; }

.datetime-inputs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
}

.date-input,
.time-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    transition: var(--transition);
}

.date-input:focus,
.time-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(138, 43, 226, 0.2);
}

.task-enter { animation: taskEnter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

@keyframes taskEnter {
    0% {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }

    100% {
        transform: translateY(0) scale(0.95);
        opacity: 1;
    }
}

.task-exit { animation: taskExit 0.4s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards; }

@keyframes taskExit {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
}

/* Responsive Design */

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    .todo-container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .add-task {
        flex-direction: column;
    }

    #add-btn {
        padding: 0.7rem;
        justify-content: center;
    }

    .mode-toggle {
        top: 1rem;
        right: 1rem;
    }

    .priority-selector {
        padding: 0.4rem;
    }

    .priority-label {
        margin: 0 0.5rem;
        font-size: 0.8rem;
    }

    .priority-option {
        width: 32px;
        height: 32px;
    }

    .priority-option::after {
        width: 18px;
        height: 18px;
    }

    .priority-option::before {
        top: -26px;
        font-size: 0.65rem;
    }

    .priority-slider {
        width: 26px;
        height: 26px;
    }

    .datetime-inputs {
        flex-direction: column;
        gap: 0.3rem;
    }
}

@media (max-width: 400px) {
    .priority-label {
        display: none;
    }

    .priority-option {
        width: 28px;
        height: 28px;
    }

    .priority-option::after {
        width: 16px;
        height: 16px;
    }
}