* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    position: relative;
}

#taskInput {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

#taskInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#addBtn {
    padding: 15px 25px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

#addBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#taskList {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 12px;
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.task-item.completed {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
    opacity: 0.8;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #6c757d;
}

.task-text {
    flex: 1;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 400;
}

.task-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    background-color: #f8f9ff;
}

.button-group {
    display: flex;
    gap: 8px;
}

.edit-btn {
    background: linear-gradient(45deg, #17a2b8, #138496);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.edit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

.save-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.cancel-btn {
    background: linear-gradient(45deg, #6c757d, #5a6268);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.cancel-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.delete-btn {
    background: linear-gradient(45deg, #dc3545, #c82333);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.delete-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
    transform: scale(1.2);
}

.stats-container {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.stat-item:nth-child(2) .stat-number {
    color: #28a745;
}

.stat-item:nth-child(3) .stat-number {
    color: #ffc107;
}

.stat-item:nth-child(4) .stat-number {
    color: #17a2b8;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

/* make the filter buttons goood looking*/
.filter-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background: #f0f2f5;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.filter-btn {
    padding: 10px 20px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: #e9ecef;
    color: #495057;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.filter-btn:hover {
    background-color: #dee2e6;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.filter-btn.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.filter-btn.active:hover {
    transform: none; /* no translateY for active button on hover */
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}
.filter-btn.danger {
    background: linear-gradient(45deg, #dc3545, #c82333);
    color: white;
    border-color: #c82333;
}
.filter-btn.danger:hover {
    background: linear-gradient(45deg, #c82333, #dc3545);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}
.filter-btn.danger:disabled {
    background: #e9ecef;
    color: #adb5bd;
    border-color: #ced4da;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    .stats-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .button-group {
        width: 100%;
        justify-content: space-between;
    }

    .filter-container {
        flex-direction: column;
        gap: 8px;
    }

    .filter-btn {
        width: 100%;
    }
    .input-container {
        flex-direction: column;
    }
    .sort-container {
        flex-direction: column;
        align-items: flex-start;
    }
}
.message-box, .confirm-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px 35px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    text-align: center;
    max-width: 350px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    animation: fadeIn 0.3s ease-out; 
}

.message-box p, .confirm-box p {
    margin-bottom: 20px;
    font-size: 16px;
    color: #343a40;
}

.message-box button, .confirm-box button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.message-box button {
    background-color: #667eea;
    color: white;
}

.message-box button:hover {
    background-color: #5a6ac1;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.confirm-yes {
    background-color: #28a745;
    color: white;
}

.confirm-yes:hover {
    background-color: #218838;
}

.confirm-no {
    background-color: #dc3545;
    color: white;
}

.confirm-no:hover {
    background-color: #c82333;
}

.message-box.info {
    border: 2px solid #667eea;
}
.message-box.success {
    border: 2px solid #28a745;
}
.message-box.warning {
    border: 2px solid #ffc107;
}
.message-box.error {
    border: 2px solid #dc3545;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.priority-label {
    font-size: 10px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: auto;
}
.priority-select, .sort-select, .date-input {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23667eea%22%20d%3D%22M287%2C197.3L159.2%2C69.5c-3.2-3.2-8.4-3.2-11.6%2C0L5.4%2C197.3c-3.2%2C3.2-3.2%2C8.4%2C0%2C11.6l11.6%2C11.6c3.2%2C3.2%2C8.4%2C3.2%2C11.6%2C0l124.2-124.2l124.2%2C124.2c3.2%2C3.2%2C8.4%2C3.2%2C11.6%2C0l11.6-11.6C290.2%2C205.7%2C290.2%2C200.5%2C287%2C197.3z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
}

.priority-select:focus, .sort-select:focus , .date-input:focus{
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.task-item.priority-high {
    border-left: 5px solid #dc3545;
    background: linear-gradient(135deg, #ffe0e0 0%, #fffafa 100%);
}
.task-item.priority-medium {
    border-left: 5px solid #ffc107;
    background: linear-gradient(135deg, #fff8e1 0%, #fffaf0 100%);
}
.task-item.priority-low {
    border-left: 5px solid #17a2b8;
    background: linear-gradient(135deg, #e0f7fa 0%, #f0fcff 100%);
}
.priority-label.priority-high {
    background-color: #dc3545;
    color: white;
}

.priority-label.priority-medium {
    background-color: #ffc107;
    color: #343a40;
}

.priority-label.priority-low {
    background-color: #17a2b8;
    color: white;
}

.gemini-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

#geminiBtn {
    padding: 12px 25px;
    background: linear-gradient(45deg, #11998e, #38ef7d);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.3);
    align-self: center;
}

#geminiBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 239, 125, 0.4);
}

.gemini-response {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    min-height: 50px;
    color: #343a40;
    line-height: 1.6;
    /* hidden except when response */
    display: none; 
    /*  so that it mantains gemini writing as it is*/
    white-space: pre-wrap; 
    animation: fadeIn 0.5s;
}

/* js to show load */
.gemini-response.loading {
    display: block;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.due-date-display {
    font-size: 0.85rem;
    padding: 3px 8px;
    border-radius: 5px;
    margin-left: 10px;
    white-space: nowrap; /* dont let date wrap*/
    transition: all 0.3s ease;
}

.task-item.overdue .due-date-display {
    color: #fff;
    background-color: #dc3545;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.task-item.due-today .due-date-display {
    color: #000;
    background-color: #ffc107;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.2);
}

.task-item.due-soon .due-date-display {
    color: #fff;
    background-color: #17a2b8;
    box-shadow: 0 2px 4px rgba(23, 162, 184, 0.2);
}

/* default state */
.task-item:not(.overdue):not(.due-today):not(.due-soon) .due-date-display {
    color: #6c757d;
    background-color: #e9ecef;
}
